pybind / pybind11

Seamless operability between C++11 and Python
https://pybind11.readthedocs.io/
Other
15.58k stars 2.09k forks source link

[FEAT] Support "multi-phase initialization" of modules #2548

Open YannickJadoul opened 4 years ago

YannickJadoul commented 4 years ago

Apparently, Python >= 3.5 supports "multi-phase initialization", allowing for sub-interpreters to be used: https://docs.python.org/3/c-api/module.html#multi-phase-initialization

Something tells me this might also be relevant to #1558? (@EricCousineau-TRI might be interested?)

Something to try and play around with, if we have time? :-)

EricCousineau-TRI commented 3 years ago

See discussion in old PR: https://github.com/pybind/pybind11/pull/1558#issuecomment-704265826

pwuertz commented 11 months ago

Multi-phase initialization (PEP 489) is now a prerequisite for supporting the new per-interpreter GIL (PEP 684) introduced in Python 3.12.