[issue46070] [subinterpreters] asyncio crash when importing _asyncio in subinterpreter (Python 3.8 regression)

STINNER Victor report at bugs.python.org
Fri Jan 7 12:45:00 EST 2022


STINNER Victor <vstinner at python.org> added the comment:

In the 3.9 branch, the commit 4d2cfd354969590ba8e0af0447fd84f8b5e61952 fixed the _asyncio extension. win_py399_crash_reproducer.py still branch on Windows in the 3.9 branch. The code can be simplified with:

    code = "import _sre"

Moreover, even if I modify PyInit__sre() to only call PyModule_Create(), it does still crash. I can still reproduce the crash with the following simplified _sre.c code:
---
static PyMethodDef _functions[] = {
    _SRE_COMPILE_METHODDEF
    {NULL, NULL}
};

static struct PyModuleDef sremodule = {
        PyModuleDef_HEAD_INIT,
        "_" SRE_MODULE,
        NULL,
        -1,
        _functions,
        NULL,
        NULL,
        NULL,
        NULL
};

PyMODINIT_FUNC PyInit__sre(void)
{
    return PyModule_Create(&sremodule);
}
---

If _SRE_COMPILE_METHODDEF is removd from _functions, the script no longer crash.

Is there something specific about method objects? Is it safe to share them between multiple interpreters? See my message msg408662 which gives some details.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46070>
_______________________________________


More information about the Python-bugs-list mailing list