-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: FixFuture attached to different loop
error on read_database_uri
#21641
Conversation
Hmm.. we also use this logic in |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #21641 +/- ##
==========================================
- Coverage 80.54% 80.53% -0.01%
==========================================
Files 1603 1604 +1
Lines 231266 231395 +129
Branches 2650 2678 +28
==========================================
+ Hits 186262 186348 +86
- Misses 44387 44419 +32
- Partials 617 628 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
nest-asyncio maintains the original loop when executing a nested task. The one we currently have doesn't -
Script - import polars as pl
import asyncio
from polars.io.database._utils import _run_async
async def main():
loop = asyncio.get_running_loop()
task = loop.create_task(asyncio.sleep(0))
_run_async(test(loop, task))
async def test(original_loop, task):
print(
f"_run_async {pl.__version__} {asyncio.get_running_loop() is original_loop = }"
)
try:
await task
except Exception as e:
print(f"ERR: {str(e)}")
else:
print("OK")
if __name__ == "__main__":
asyncio.run(main()) The underlying async driver is probably also creating objects that reference the original loop before we enter the nested context. |
e97445e
to
12bc793
Compare
cd26219
to
30988fe
Compare
Future attached to different loop
on read_database_uri
Future attached to different loop
on read_database_uri
Future attached to different loop
error on read_database_uri
Reverts feat(python): Dropnest-asyncio
in favor of custom logic #20793