-
Type: Bug
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
The solution implemented in MOTOR-902 uses:
return asyncio.get_event_loop_policy().get_event_loop()
to attempt to workaround https://bugs.python.org/issue39529
This was pointed out to us as problematic by a (the?) Tornado maintainer here: https://github.com/mongodb/motor/pull/170
The gist is that even though asyncio.get_event_loop_policy().get_event_loop() is not deprecated in Python yet, it will break when the asyncio.get_event_loop() behavior is changed (planned for Python 3.12). We want users to see DeprecationWarnings when using motor incorrectly like this:
>>> import motor.motor_asyncio >>> client = motor.motor_asyncio.AsyncIOMotorClient() >>> client.test.pages.drop() # this should raise a DeprecationWarning because it was called without a running loop
- related to
-
MOTOR-902 Since Python 3.10 asyncio.get_event_loop() is deprecated
- Closed