pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/commit/196b53eb1e62871ca80dee180e4891b4dd5c52ac

ylesheet" href="https://github.githubassets.com/assets/global-d18f184ea1a06a2c.css" /> bpo-45189: Drop the "list_frozen" command from _test_embed. (GH-30273) · python/cpython@196b53e · GitHub
Skip to content

Commit 196b53e

Browse files
authored
bpo-45189: Drop the "list_frozen" command from _test_embed. (GH-30273)
1 parent 3581c7a commit 196b53e

2 files changed

Lines changed: 5 additions & 32 deletions

File tree

Programs/_testembed.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,26 +1827,6 @@ static int test_frozenmain(void)
18271827
}
18281828
#endif // !MS_WINDOWS
18291829

1830-
1831-
// List frozen modules.
1832-
// Command used by Tools/scripts/generate_stdlib_module_names.py script.
1833-
static int list_frozen(void)
1834-
{
1835-
const struct _frozen *p;
1836-
for (p = _PyImport_FrozenBootstrap; ; p++) {
1837-
if (p->name == NULL)
1838-
break;
1839-
printf("%s\n", p->name);
1840-
}
1841-
for (p = _PyImport_FrozenStdlib; ; p++) {
1842-
if (p->name == NULL)
1843-
break;
1844-
printf("%s\n", p->name);
1845-
}
1846-
return 0;
1847-
}
1848-
1849-
18501830
static int test_repeated_init_and_inittab(void)
18511831
{
18521832
// bpo-44441: Py_RunMain() must reset PyImport_Inittab at exit.
@@ -1960,8 +1940,6 @@ static struct TestCase TestCases[] = {
19601940
{"test_frozenmain", test_frozenmain},
19611941
#endif
19621942

1963-
// Command
1964-
{"list_frozen", list_frozen},
19651943
{NULL, NULL}
19661944
};
19671945

Tools/scripts/generate_stdlib_module_names.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# This script lists the names of standard library modules
22
# to update Python/stdlib_mod_names.h
3+
import _imp
34
import os.path
45
import re
56
import subprocess
@@ -11,7 +12,6 @@
1112
STDLIB_PATH = os.path.join(SRC_DIR, 'Lib')
1213
MODULES_SETUP = os.path.join(SRC_DIR, 'Modules', 'Setup')
1314
SETUP_PY = os.path.join(SRC_DIR, 'setup.py')
14-
TEST_EMBED = os.path.join(SRC_DIR, 'Programs', '_testembed')
1515

1616
IGNORE = {
1717
'__init__',
@@ -117,16 +117,11 @@ def list_modules_setup_extensions(names):
117117
# List frozen modules of the PyImport_FrozenModules list (Python/frozen.c).
118118
# Use the "./Programs/_testembed list_frozen" command.
119119
def list_frozen(names):
120-
args = [TEST_EMBED, 'list_frozen']
121-
proc = subprocess.run(args, stdout=subprocess.PIPE, text=True)
122-
exitcode = proc.returncode
123-
if exitcode:
124-
cmd = ' '.join(args)
125-
print(f"{cmd} failed with exitcode {exitcode}")
126-
sys.exit(exitcode)
127120
submodules = set()
128-
for line in proc.stdout.splitlines():
129-
name = line.strip()
121+
for name in _imp._frozen_module_names():
122+
# To skip __hello__, __hello_alias__ and etc.
123+
if name.startswith('__'):
124+
continue
130125
if '.' in name:
131126
submodules.add(name)
132127
else:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy