summaryrefslogtreecommitdiffstats
path: root/Objects/moduleobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/moduleobject.c')
-rw-r--r--Objects/moduleobject.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
index d59475e..6821710 100644
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -299,6 +299,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
whose name starts with a single underscore, before we clear
@@ -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;