mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-42955: Add sys.modules_names (GH-24238)
Add sys.module_names, containing the list of the standard library module names.
This commit is contained in:
parent
879986d8a9
commit
db584bdad3
10 changed files with 305 additions and 275 deletions
|
@ -334,8 +334,9 @@ class FaultHandlerTests(unittest.TestCase):
|
|||
def test_dump_ext_modules(self):
|
||||
code = """
|
||||
import faulthandler
|
||||
# _testcapi is a test module and not considered as a stdlib module
|
||||
import _testcapi
|
||||
import sys
|
||||
# Don't filter stdlib module names
|
||||
sys.module_names = frozenset()
|
||||
faulthandler.enable()
|
||||
faulthandler._sigsegv()
|
||||
"""
|
||||
|
@ -346,7 +347,8 @@ class FaultHandlerTests(unittest.TestCase):
|
|||
if not match:
|
||||
self.fail(f"Cannot find 'Extension modules:' in {stderr!r}")
|
||||
modules = set(match.group(1).strip().split(', '))
|
||||
self.assertIn('_testcapi', modules)
|
||||
for name in ('sys', 'faulthandler'):
|
||||
self.assertIn(name, modules)
|
||||
|
||||
def test_is_enabled(self):
|
||||
orig_stderr = sys.stderr
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue