diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2023-03-14 20:01:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-14 20:01:35 (GMT) |
commit | cdb21ba74d933e262bc1696b6ce78b50cb5a4443 (patch) | |
tree | bfdf1ff0a564d9b7bc3f7288f115ccd3bc9c3d12 /Python/bltinmodule.c | |
parent | 80abd62647b2a36947a11a6a8e395061be6f0c61 (diff) | |
download | cpython-cdb21ba74d933e262bc1696b6ce78b50cb5a4443.zip cpython-cdb21ba74d933e262bc1696b6ce78b50cb5a4443.tar.gz cpython-cdb21ba74d933e262bc1696b6ce78b50cb5a4443.tar.bz2 |
gh-102660: Handle m_copy Specially for the sys and builtins Modules (gh-102661)
It doesn't make sense to use multi-phase init for these modules. Using a per-interpreter "m_copy" (instead of PyModuleDef.m_base.m_copy) makes this work okay. (This came up while working on gh-101660.)
Note that we might instead end up disallowing re-load for sys/builtins since they are so special.
https://github.com/python/cpython/issues/102660
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r-- | Python/bltinmodule.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 12ca0ba..a8a3462 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -3098,6 +3098,9 @@ _PyBuiltin_Init(PyInterpreterState *interp) } Py_DECREF(debug); + /* m_copy of Py_None means it is copied some other way. */ + builtinsmodule.m_base.m_copy = Py_NewRef(Py_None); + return mod; #undef ADD_TO_ALL #undef SETBUILTIN |