bpo-45189: Drop the "list_frozen" command from _test_embed. (GH-30273)

This commit is contained in:
Dong-hee Na 2021-12-28 11:05:50 +09:00 committed by GitHub
parent 3581c7abbe
commit 196b53eb1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 32 deletions

View file

@ -1,5 +1,6 @@
# This script lists the names of standard library modules
# to update Python/stdlib_mod_names.h
import _imp
import os.path
import re
import subprocess
@ -11,7 +12,6 @@ SRC_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
STDLIB_PATH = os.path.join(SRC_DIR, 'Lib')
MODULES_SETUP = os.path.join(SRC_DIR, 'Modules', 'Setup')
SETUP_PY = os.path.join(SRC_DIR, 'setup.py')
TEST_EMBED = os.path.join(SRC_DIR, 'Programs', '_testembed')
IGNORE = {
'__init__',
@ -117,16 +117,11 @@ def list_modules_setup_extensions(names):
# List frozen modules of the PyImport_FrozenModules list (Python/frozen.c).
# Use the "./Programs/_testembed list_frozen" command.
def list_frozen(names):
args = [TEST_EMBED, 'list_frozen']
proc = subprocess.run(args, stdout=subprocess.PIPE, text=True)
exitcode = proc.returncode
if exitcode:
cmd = ' '.join(args)
print(f"{cmd} failed with exitcode {exitcode}")
sys.exit(exitcode)
submodules = set()
for line in proc.stdout.splitlines():
name = line.strip()
for name in _imp._frozen_module_names():
# To skip __hello__, __hello_alias__ and etc.
if name.startswith('__'):
continue
if '.' in name:
submodules.add(name)
else: