Skip to content

Commit d9510fd

Browse files
committed
fix attribute error for asyncio.get_running_loop
1 parent 34a8321 commit d9510fd

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
linux:
99
rm -rf "dist/*";rm -rf "build/*";python3 setup.py bdist_wheel;twine upload "dist/*;rm -rf "dist/*";rm -rf "build/*""
1010
win32:
11-
rm -rf dist;rm -rf build;python3 setup.py bdist_wheel;twine upload "dist/*";rm -rf dist;rm -rf build;rm -rf uniparser.egg-info
11+
rm -r dist;rm -r build;python3 setup.py bdist_wheel;twine upload "dist/*";rm -r dist;rm -r build;rm -r uniparser.egg-info
1212
"""
1313

1414
py_version = sys.version_info

uniparser/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
'get_available_async_request', 'get_available_sync_request', 'LazyImporter',
1919
'TorequestsAiohttpAsyncAdapter', 'SyncRequestAdapter'
2020
]
21-
__version__ = '1.8.8'
21+
__version__ = '1.8.9'

uniparser/utils.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@
2929

3030
async def to_thread(func, *args, **kwargs):
3131
"""copy python3.9"""
32-
loop = asyncio.get_running_loop()
32+
try:
33+
loop = asyncio.get_running_loop()
34+
except AttributeError:
35+
loop = asyncio.get_event_loop()
3336
ctx = copy_context()
3437
func_call = partial(ctx.run, func, *args, **kwargs)
3538
return await loop.run_in_executor(None, func_call)

0 commit comments

Comments
 (0)