[issue36521] Consider removing docstrings from co_consts in code objects

Serhiy Storchaka report at bugs.python.org
Wed Apr 3 23:37:00 EDT 2019


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

co_consts[0] is used for setting the initial value of __doc__. See PyFunction_NewWithQualName().

    consts = ((PyCodeObject *)code)->co_consts;
    if (PyTuple_Size(consts) >= 1) {
        doc = PyTuple_GetItem(consts, 0);
        if (!PyUnicode_Check(doc))
            doc = Py_None;
    }
    else
        doc = Py_None;
    Py_INCREF(doc);
    op->func_doc = doc;

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36521>
_______________________________________


More information about the Python-bugs-list mailing list