summaryrefslogtreecommitdiffstats
path: root/Objects/moduleobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/moduleobject.c')
-rw-r--r--Objects/moduleobject.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
index 738b262..dba20a0 100644
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -510,8 +510,10 @@ const char *
PyModule_GetName(PyObject *m)
{
PyObject *name = PyModule_GetNameObject(m);
- if (name == NULL)
+ if (name == NULL) {
return NULL;
+ }
+ assert(Py_REFCNT(name) >= 2);
Py_DECREF(name); /* module dict has still a reference */
return PyUnicode_AsUTF8(name);
}