mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
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.
This commit is contained in:
parent
f7b5bacd7a
commit
250035d134
8 changed files with 96 additions and 0 deletions
|
@ -556,6 +556,16 @@ class CAPITest(unittest.TestCase):
|
|||
self.assertIn('Fatal Python error: test_fatal_error: MESSAGE\n',
|
||||
err)
|
||||
|
||||
match = re.search('^Extension modules:(.*)$', err, re.MULTILINE)
|
||||
if not match:
|
||||
self.fail(f"Cannot find 'Extension modules:' in {err!r}")
|
||||
modules = set(match.group(1).strip().split(', '))
|
||||
# Test _PyModule_IsExtension(): the list doesn't have to
|
||||
# be exhaustive.
|
||||
for name in ('sys', 'builtins', '_imp', '_thread', '_weakref',
|
||||
'_io', 'marshal', '_signal', '_abc', '_testcapi'):
|
||||
self.assertIn(name, modules)
|
||||
|
||||
|
||||
class TestPendingCalls(unittest.TestCase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue