Commit 6775d5d
committed
Add sub-interpreter and free-threading support to py_asgi
- Convert global PyObject* to per-interpreter state structure
- Add get_asgi_interp_state() for thread-safe state access
- Use pthread mutex for state table protection
- Support up to 64 concurrent sub-interpreters
- Lazy initialization of per-interpreter cached objects
- Proper cleanup when interpreters are finalized
This enables proper operation with:
- Python 3.12+ sub-interpreters
- Python 3.13+ free-threading (no-GIL) mode
The macros (ASGI_KEY_TYPE, etc.) now access per-interpreter state
transparently, maintaining backward compatibility.1 parent dfcbe5d commit 6775d5d
2 files changed
Lines changed: 490 additions & 334 deletions
0 commit comments