mirror of
https://github.com/python/cpython.git
synced 2025-10-17 04:08:28 +00:00
gh-98627: Add an Optional Check for Extension Module Subinterpreter Compatibility (gh-99040)
Enforcing (optionally) the restriction set by PEP 489 makes sense. Furthermore, this sets the stage for a potential restriction related to a per-interpreter GIL. This change includes the following: * add tests for extension module subinterpreter compatibility * add _PyInterpreterConfig.check_multi_interp_extensions * add Py_RTFLAGS_MULTI_INTERP_EXTENSIONS * add _PyImport_CheckSubinterpIncompatibleExtensionAllowed() * fail iff the module does not implement multi-phase init and the current interpreter is configured to check https://github.com/python/cpython/issues/98627
This commit is contained in:
parent
3dea4ba6c1
commit
89ac665891
15 changed files with 557 additions and 19 deletions
|
@ -1656,13 +1656,15 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
|
|||
api=API_PYTHON, env=env)
|
||||
|
||||
def test_init_main_interpreter_settings(self):
|
||||
EXTENSIONS = 1<<8
|
||||
THREADS = 1<<10
|
||||
DAEMON_THREADS = 1<<11
|
||||
FORK = 1<<15
|
||||
EXEC = 1<<16
|
||||
expected = {
|
||||
# All optional features should be enabled.
|
||||
'feature_flags': FORK | EXEC | THREADS | DAEMON_THREADS,
|
||||
'feature_flags':
|
||||
FORK | EXEC | THREADS | DAEMON_THREADS,
|
||||
}
|
||||
out, err = self.run_embedded_interpreter(
|
||||
'test_init_main_interpreter_settings',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue