summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/funcobject.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index e72a7d9..1f2387f 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -162,7 +162,8 @@ PyFunction_NewWithQualName(PyObject *code, PyObject *globals, PyObject *qualname
PyObject *consts = code_obj->co_consts;
assert(PyTuple_Check(consts));
PyObject *doc;
- if (PyTuple_Size(consts) >= 1) {
+ if (code_obj->co_flags & CO_HAS_DOCSTRING) {
+ assert(PyTuple_Size(consts) >= 1);
doc = PyTuple_GetItem(consts, 0);
if (!PyUnicode_Check(doc)) {
doc = Py_None;