Commit 0c5b5af
authored
Fix Python 3.13 GIL and event loop compatibility
- Add gil_acquire()/gil_release() helpers that check PyGILState_Check()
before calling PyGILState_Ensure() to avoid double-acquisition on Python 3.12+
- Fix event loop thread isolation: ErlangEventLoop for main thread only,
SelectorEventLoop for worker threads
- Worker threads in py_callback.c now create SelectorEventLoop directly,
bypassing the policy to avoid ErlangEventLoop conflicts
- Use per-call ErlNifEnv for timer scheduling to prevent races in
free-threaded Python mode
- Fail fast on RuntimeError in erlang_loop.py instead of silently
swallowing initialization errors that cause hangs
Fixes py_async_e2e_SUITE timeouts on Python 3.12+ by ensuring proper
thread isolation for asyncio event loops.1 parent 952ed3b commit 0c5b5af
4 files changed
Lines changed: 297 additions & 63 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1654 | 1654 | | |
1655 | 1655 | | |
1656 | 1656 | | |
1657 | | - | |
1658 | | - | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
1659 | 1672 | | |
1660 | 1673 | | |
1661 | 1674 | | |
| |||
1664 | 1677 | | |
1665 | 1678 | | |
1666 | 1679 | | |
1667 | | - | |
| 1680 | + | |
1668 | 1681 | | |
1669 | 1682 | | |
1670 | 1683 | | |
| |||
0 commit comments