summaryrefslogtreecommitdiffstats
path: root/Objects/moduleobject.c
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na@python.org>2022-04-02 00:56:30 (GMT)
committerGitHub <noreply@github.com>2022-04-02 00:56:30 (GMT)
commitb183f486493e7e4c332566392ef18c6b346a6561 (patch)
tree3e50d902336fdd274a23a7e87d24f815203505e8 /Objects/moduleobject.c
parent082d3495d0c820972f09f6109a98ed7eb5a7b79f (diff)
downloadcpython-b183f486493e7e4c332566392ef18c6b346a6561.zip
cpython-b183f486493e7e4c332566392ef18c6b346a6561.tar.gz
cpython-b183f486493e7e4c332566392ef18c6b346a6561.tar.bz2
no-issue: Add assertion to PyModule_GetName for understanding (GH-32236)
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);
}