mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
gh-126072: do not add None
to co_consts
if there is no docstring (GH-126101)
This commit is contained in:
parent
2ab377a47c
commit
35df4eb959
16 changed files with 148 additions and 58 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue