This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2022年01月07日 15:18 by pablogsal, last changed 2022年04月11日 14:59 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg409975 - (view) | Author: Pablo Galindo Salgado (pablogsal) * (Python committer) | Date: 2022年01月07日 15:18 | |
Reproducer:
Code for native_ext.cpp:
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <assert.h>
#include <pthread.h>
#include <malloc.h>
#pragma GCC push_options
#pragma GCC optimize ("O0")
PyObject*
run_simple(PyObject*, PyObject*)
{
PyGILState_STATE gstate;
gstate = PyGILState_Ensure();
PyGILState_Release(gstate);
Py_RETURN_NONE;
}
static PyMethodDef methods[] = {
{"run_simple", run_simple, METH_NOARGS, "Execute a chain of native functions"},
{NULL, NULL, 0, NULL},
};
#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef moduledef = {PyModuleDef_HEAD_INIT, "native_ext", "", -1, methods};
PyMODINIT_FUNC
PyInit_native_ext(void)
{
return PyModule_Create(&moduledef);
}
#else
PyMODINIT_FUNC
initnative_ext(void)
{
Py_InitModule("native_ext", methods);
}
#endif
Code for setup.py:
import os
from distutils.core import Extension
from distutils.core import setup
ROOT = os.path.realpath(os.path.dirname(__file__))
setup(
name="native_ext",
version="0.0",
ext_modules=[
Extension(
"native_ext",
language="c++",
sources=[os.path.join(ROOT, "native_ext.cpp")],
),
],
zip_safe=False,
)
Compile extension:
python setup.py build_ext --inplace
Execute the following script:
from test.support import run_in_subinterp
run_in_subinterp("""
import sys
sys.path.append(".")
import native_ext
native_ext.run_simple()
""")
The script deadlocks
|
|||
| msg409987 - (view) | Author: Eric Snow (eric.snow) * (Python committer) | Date: 2022年01月07日 17:03 | |
Is this a duplicate of bpo-15751? (also see bpo-10915) |
|||
| msg409990 - (view) | Author: Pablo Galindo Salgado (pablogsal) * (Python committer) | Date: 2022年01月07日 17:41 | |
Yeah, this is indeed related/duplicate of bpo-15751 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:59:54 | admin | set | github: 90453 |
| 2022年01月07日 17:41:32 | pablogsal | set | superseder: [subinterpreters] Make the PyGILState API compatible with subinterpreters |
| 2022年01月07日 17:41:22 | pablogsal | set | messages: + msg409990 |
| 2022年01月07日 17:41:11 | pablogsal | set | status: open -> closed resolution: duplicate stage: resolved |
| 2022年01月07日 17:03:19 | eric.snow | set | messages: + msg409987 |
| 2022年01月07日 15:18:15 | pablogsal | create | |