Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
_imp._override_frozen_modules_for_tests -> _override_frozen_stdlib_fo…
…r_tests.
  • Loading branch information
ericsnowcurrently committed Nov 4, 2021
commit 2a5613f0c61c82537ad994ae1dd24b095e6d6daf
2 changes: 1 addition & 1 deletion Include/internal/pycore_interp.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ struct _is {
PyObject *importlib;
// override for config->use_frozen_stdlib (for tests)
// (-1: "off", 1: "on", 0: no override)
int override_frozen_modules;
int override_frozen_stdlib;

/* Used in Modules/_threadmodule.c. */
long num_threads;
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/support/import_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ def frozen_modules(enabled=True):
This only applies to modules that haven't been imported yet.
Also, some essential modules will always be imported frozen.
"""
_imp._override_frozen_modules_for_tests(1 if enabled else -1)
_imp._override_frozen_stdlib_for_tests(1 if enabled else -1)
try:
yield
finally:
_imp._override_frozen_modules_for_tests(0)
_imp._override_frozen_stdlib_for_tests(0)


def import_fresh_module(name, fresh=(), blocked=(), *,
Expand Down
16 changes: 8 additions & 8 deletions Python/clinic/import.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Python/import.c
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ static bool
use_frozen_stdlib(void)
{
PyInterpreterState *interp = _PyInterpreterState_GET();
int override = interp->override_frozen_modules;
int override = interp->override_frozen_stdlib;
if (override > 0) {
return true;
}
Expand Down Expand Up @@ -2303,7 +2303,7 @@ _imp__frozen_module_names_impl(PyObject *module)
}

/*[clinic input]
_imp._override_frozen_modules_for_tests
_imp._override_frozen_stdlib_for_tests

override: int
/
Expand All @@ -2315,11 +2315,11 @@ See frozen_modules() in Lib/test/support/import_helper.py.
[clinic start generated code]*/

static PyObject *
_imp__override_frozen_modules_for_tests_impl(PyObject *module, int override)
/*[clinic end generated code: output=36d5cb1594160811 input=501242da72b8ef23]*/
_imp__override_frozen_stdlib_for_tests_impl(PyObject *module, int override)
/*[clinic end generated code: output=3f769bf38d4fd4cf input=8c1be52885465f03]*/
{
PyInterpreterState *interp = _PyInterpreterState_GET();
interp->override_frozen_modules = override;
interp->override_frozen_stdlib = override;
Py_RETURN_NONE;
}

Expand Down Expand Up @@ -2485,7 +2485,7 @@ static PyMethodDef imp_methods[] = {
_IMP_IS_BUILTIN_METHODDEF
_IMP_IS_FROZEN_METHODDEF
_IMP__FROZEN_MODULE_NAMES_METHODDEF
_IMP__OVERRIDE_FROZEN_MODULES_FOR_TESTS_METHODDEF
_IMP__OVERRIDE_FROZEN_STDLIB_FOR_TESTS_METHODDEF
_IMP_CREATE_DYNAMIC_METHODDEF
_IMP_EXEC_DYNAMIC_METHODDEF
_IMP_EXEC_BUILTIN_METHODDEF
Expand Down