summaryrefslogtreecommitdiffstats
path: root/Programs/_testembed.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-03-10 10:14:07 (GMT)
committerGitHub <noreply@github.com>2021-03-10 10:14:07 (GMT)
commit307745aa42196ad3fd97fee4a1ae6496bb895596 (patch)
treeac50f9198da22b1400df4815b6a875fd3364bb70 /Programs/_testembed.c
parentb4f9089d4aa787c5b74134c98e5f0f11d9e63095 (diff)
downloadcpython-307745aa42196ad3fd97fee4a1ae6496bb895596.zip
cpython-307745aa42196ad3fd97fee4a1ae6496bb895596.tar.gz
cpython-307745aa42196ad3fd97fee4a1ae6496bb895596.tar.bz2
bpo-43445: Add frozen modules to sys.stdlib_module_names (GH-24798)
Add frozen modules to sys.stdlib_module_names. For example, add "_frozen_importlib" and "_frozen_importlib_external" names. Add "list_frozen" command to Programs/_testembed.
Diffstat (limited to 'Programs/_testembed.c')
-rw-r--r--Programs/_testembed.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/Programs/_testembed.c b/Programs/_testembed.c
index 52c5674..0901933 100644
--- a/Programs/_testembed.c
+++ b/Programs/_testembed.c
@@ -1721,6 +1721,20 @@ static int test_unicode_id_init(void)
}
+// List frozen modules.
+// Command used by Tools/scripts/generate_stdlib_module_names.py script.
+static int list_frozen(void)
+{
+ const struct _frozen *p;
+ for (p = PyImport_FrozenModules; ; p++) {
+ if (p->name == NULL)
+ break;
+ printf("%s\n", p->name);
+ }
+ return 0;
+}
+
+
/* *********************************************************
* List of test cases and the function that implements it.
@@ -1792,6 +1806,8 @@ static struct TestCase TestCases[] = {
{"test_audit_run_stdin", test_audit_run_stdin},
{"test_unicode_id_init", test_unicode_id_init},
+
+ {"list_frozen", list_frozen},
{NULL, NULL}
};