After upgrading from mangum==0.20.0 to 0.21.0, we now get:
DeprecationWarning: There is no current event loop asyncio.get_event_loop()
This appears to come from Mangum.init calling _setup_event_loop() (added in 0.21.0), which calls asyncio.get_event_loop() when no loop is set.
I have pytest set to fail tests on warnings so noticed upgrading to mangum 0.21.0 caused test failures
Repro:
Python 3.13+
from fastapi import FastAPI
from mangum import Mangum
app = FastAPI()
handler = Mangum(app) # emits DeprecationWarning
Expected:
No DeprecationWarning during adapter construction.
Actual:
DeprecationWarning emitted on import/initialization.
Notes:
- In 0.20.0, adapter.py does not call get_event_loop().
- This warning is treated as error in test environments, so it breaks our CI.
Environment:
- mangum 0.21.0
- Python 3.13 (also likely 3.12 with default warnings enabled)
After upgrading from mangum==0.20.0 to 0.21.0, we now get:
DeprecationWarning: There is no current event loop asyncio.get_event_loop()This appears to come from Mangum.init calling _setup_event_loop() (added in 0.21.0), which calls asyncio.get_event_loop() when no loop is set.
I have pytest set to fail tests on warnings so noticed upgrading to mangum 0.21.0 caused test failures
Repro:
Python 3.13+
Expected:
No DeprecationWarning during adapter construction.
Actual:
DeprecationWarning emitted on import/initialization.
Notes:
Environment: