[issue36521] Consider removing docstrings from co_consts in code objects

Serhiy Storchaka report at bugs.python.org
Thu Apr 4 04:40:34 EDT 2019


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

I think it is for historical reasons. Currently statements consisting of a constant expression are not compiled to a bytecode and do not add a value to co_consts. But when this optimization was not yet added, the first element of co_consts with a docstring was a docstring. So why add co_doc if the docstring is already available?

This can be changed, but this is a breaking change, and what we will got instead?

Function's __name__ is set from code object's co_name.

----------

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


More information about the Python-bugs-list mailing list