Skip to content

Commit 1b0ba7b

Browse files
committed
update __doc__ for function object
1 parent 13602e2 commit 1b0ba7b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Objects/funcobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ PyFunction_NewWithQualName(PyObject *code, PyObject *globals, PyObject *qualname
162162
PyObject *consts = code_obj->co_consts;
163163
assert(PyTuple_Check(consts));
164164
PyObject *doc;
165-
if (PyTuple_Size(consts) >= 1) {
165+
if (PyTuple_Size(consts) >= 1 && code_obj->co_flags & CO_HAS_DOCSTRING) {
166166
doc = PyTuple_GetItem(consts, 0);
167167
if (!PyUnicode_Check(doc)) {
168168
doc = Py_None;

0 commit comments

Comments
 (0)