summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na@python.org>2021-12-28 02:05:50 (GMT)
committerGitHub <noreply@github.com>2021-12-28 02:05:50 (GMT)
commit196b53eb1e62871ca80dee180e4891b4dd5c52ac (patch)
tree8f20c0e4057215bc59e578a1e2b138db664d5b0e /Tools
parent3581c7abbe15bad6ae08fc38887e5948f8f39e08 (diff)
downloadcpython-196b53eb1e62871ca80dee180e4891b4dd5c52ac.zip
cpython-196b53eb1e62871ca80dee180e4891b4dd5c52ac.tar.gz
cpython-196b53eb1e62871ca80dee180e4891b4dd5c52ac.tar.bz2
bpo-45189: Drop the "list_frozen" command from _test_embed. (GH-30273)
Diffstat (limited to 'Tools')
-rw-r--r--Tools/scripts/generate_stdlib_module_names.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/Tools/scripts/generate_stdlib_module_names.py b/Tools/scripts/generate_stdlib_module_names.py
index 3e896ba..fe1e429 100644
--- a/Tools/scripts/generate_stdlib_module_names.py
+++ b/Tools/scripts/generate_stdlib_module_names.py
@@ -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: