Skip to content

Commit 2116dc0

Browse files
fix: detect run_sync availability at run-time instead of patch-time
1 parent 17dee7d commit 2116dc0

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/promplate_pyodide/__init__.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,14 @@ async def afetch(cls, url: str, **kwargs):
2323

2424
return obj
2525

26-
if stack_switching_supported():
27-
28-
@classmethod
29-
def fetch(cls, url: str, **kwargs): # type: ignore
26+
@classmethod
27+
def fetch(cls, url: str, **kwargs):
28+
if stack_switching_supported():
3029
from pyodide.ffi import run_sync # type: ignore
3130

3231
return run_sync(cls.afetch(url, **kwargs))
3332

34-
else:
35-
36-
@classmethod
37-
def fetch(cls, url: str, **kwargs):
33+
else:
3834
from pyodide.http import open_url
3935

4036
res = open_url(cls._join_url(url))

0 commit comments

Comments
 (0)