From: Dong-hee Na Date: Sat, 2 Apr 2022 00:56:30 +0000 (+0900) Subject: no-issue: Add assertion to PyModule_GetName for understanding (GH-32236) X-Git-Tag: v3.11.0a7~63 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b183f486493e7e4c332566392ef18c6b346a6561;p=thirdparty%2FPython%2Fcpython.git no-issue: Add assertion to PyModule_GetName for understanding (GH-32236) --- diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c index 738b262288bc..dba20a0b3646 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); }