Skip to content

Commit 14cb593

Browse files
committed
Address review
1 parent 1445a8d commit 14cb593

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

Lib/test/test_faulthandler.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,12 +388,11 @@ def test_disable(self):
388388

389389
@skip_segfault_on_android
390390
def test_dump_ext_modules(self):
391-
# Disable sys.stdlib_module_names
391+
# Don't filter stdlib module names: disable sys.stdlib_module_names
392392
code = """
393393
import faulthandler
394394
import sys
395395
import math
396-
# Don't filter stdlib module names
397396
sys.stdlib_module_names = frozenset()
398397
faulthandler.enable()
399398
faulthandler._sigsegv()
@@ -418,8 +417,7 @@ def test_dump_ext_modules(self):
418417
"""
419418
stderr, exitcode = self.get_output(code)
420419
stderr = '\n'.join(stderr)
421-
match = re.search(r'^Extension modules:', stderr, re.MULTILINE)
422-
self.assertIsNone(match)
420+
self.assertNotIn('Extension modules:', stderr)
423421

424422
def test_is_enabled(self):
425423
orig_stderr = sys.stderr
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
When :mod:`faulthandler` dumps the list of third-party extension modules,
2-
ignore ``math.integer`` sub-module since ``math`` package is part of
3-
:data:`sys.stdlib_module_names`. Patch by Victor Stinner.
2+
ignore sub-modules of stdlib packages. Patch by Victor Stinner.

Python/pylifecycle.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3405,7 +3405,8 @@ _Py_DumpExtensionModules(int fd, PyInterpreterState *interp)
34053405
}
34063406
assert(key_len > len);
34073407

3408-
// Ignore "math.integer" if key starts with "math."
3408+
// Ignore sub-modules of stdlib packages. For example,
3409+
// ignore "math.integer" if key starts with "math.".
34093410
Py_UCS4 ch = PyUnicode_ReadChar(key, len);
34103411
if (ch == '.') {
34113412
is_stdlib_ext = 1;

0 commit comments

Comments
 (0)