mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #19255: The builtins module is restored to initial value before
cleaning other modules. The sys and builtins modules are cleaned last.
This commit is contained in:
parent
8f9f0f12e8
commit
87a5c515d0
7 changed files with 96 additions and 39 deletions
|
@ -298,6 +298,14 @@ PyModule_GetState(PyObject* m)
|
|||
|
||||
void
|
||||
_PyModule_Clear(PyObject *m)
|
||||
{
|
||||
PyObject *d = ((PyModuleObject *)m)->md_dict;
|
||||
if (d != NULL)
|
||||
_PyModule_ClearDict(d);
|
||||
}
|
||||
|
||||
void
|
||||
_PyModule_ClearDict(PyObject *d)
|
||||
{
|
||||
/* To make the execution order of destructors for global
|
||||
objects a bit more predictable, we first zap all objects
|
||||
|
@ -308,11 +316,6 @@ _PyModule_Clear(PyObject *m)
|
|||
|
||||
Py_ssize_t pos;
|
||||
PyObject *key, *value;
|
||||
PyObject *d;
|
||||
|
||||
d = ((PyModuleObject *)m)->md_dict;
|
||||
if (d == NULL)
|
||||
return;
|
||||
|
||||
/* First, clear only names starting with a single underscore */
|
||||
pos = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue