diff options
author | Victor Stinner <vstinner@python.org> | 2021-01-18 20:47:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-18 20:47:13 +0100 |
commit | 250035d134ad482e724f73ce654682254b513ee0 (patch) | |
tree | 48d2b3627adfe0b0e04aaaee25f35f4999cde254 /Objects | |
parent | bpo-42944 Fix Random.sample when counts is not None (GH-24235) (diff) | |
download | cpython-250035d134ad482e724f73ce654682254b513ee0.tar.gz cpython-250035d134ad482e724f73ce654682254b513ee0.tar.bz2 cpython-250035d134ad482e724f73ce654682254b513ee0.zip |
bpo-42923: Dump extension modules on fatal error (GH-24207)
The Py_FatalError() function and the faulthandler module now dump the
list of extension modules on a fatal error.
Add _Py_DumpExtensionModules() and _PyModule_IsExtension() internal
functions.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/moduleobject.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c index 6590387dac5..e57ea86e769 100644 --- a/Objects/moduleobject.c +++ b/Objects/moduleobject.c @@ -35,6 +35,19 @@ PyTypeObject PyModuleDef_Type = { }; +int +_PyModule_IsExtension(PyObject *obj) +{ + if (!PyModule_Check(obj)) { + return 0; + } + PyModuleObject *module = (PyModuleObject*)obj; + + struct PyModuleDef *def = module->md_def; + return (def != NULL && def->m_methods != NULL); +} + + PyObject* PyModuleDef_Init(struct PyModuleDef* def) { |