summaryrefslogtreecommitdiffstats
path: root/Lib/ctypes/test
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2021-09-14 23:31:45 (GMT)
committerGitHub <noreply@github.com>2021-09-14 23:31:45 (GMT)
commita65c86889e208dddb26a7ebe7840c24edbcca775 (patch)
treeec55222c3ac183806fc06f0d60514ab21e6dc560 /Lib/ctypes/test
parent1aaa85949717e4ab2ed700e58762f0a3ce049a37 (diff)
downloadcpython-a65c86889e208dddb26a7ebe7840c24edbcca775.zip
cpython-a65c86889e208dddb26a7ebe7840c24edbcca775.tar.gz
cpython-a65c86889e208dddb26a7ebe7840c24edbcca775.tar.bz2
bpo-45020: Add -X frozen_modules=[on|off] to explicitly control use of frozen modules. (gh-28320)
Currently we freeze several modules into the runtime. For each of these modules it is essential to bootstrapping the runtime that they be frozen. Any other stdlib module that we later freeze into the runtime is not essential. We can just as well import from the .py file. This PR lets users explicitly choose which should be used, with the new "-X frozen_modules=[on|off]" CLI flag. The default is "off" for now. https://bugs.python.org/issue45020
Diffstat (limited to 'Lib/ctypes/test')
-rw-r--r--Lib/ctypes/test/test_values.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/ctypes/test/test_values.py b/Lib/ctypes/test/test_values.py
index aa31d44..03bc9bb 100644
--- a/Lib/ctypes/test/test_values.py
+++ b/Lib/ctypes/test/test_values.py
@@ -72,14 +72,16 @@ class PythonValuesTestCase(unittest.TestCase):
self.assertGreater(abs(entry.size), 10)
self.assertTrue([entry.code[i] for i in range(abs(entry.size))])
# Check the module's package-ness.
- spec = importlib.util.find_spec(modname)
+ with import_helper.frozen_modules():
+ spec = importlib.util.find_spec(modname)
if entry.size < 0:
# It's a package.
self.assertIsNotNone(spec.submodule_search_locations)
else:
self.assertIsNone(spec.submodule_search_locations)
- expected = imp._frozen_module_names()
+ with import_helper.frozen_modules():
+ expected = imp._frozen_module_names()
self.maxDiff = None
self.assertEqual(modules, expected, "PyImport_FrozenModules example "
"in Doc/library/ctypes.rst may be out of date")