Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Currently, the zeroth constant in a code object'sco_consts tuple is the docstring, iff it is a string.
This means that any code object without a docstring must not have a string as its first constant. To guarantee this we generally insertNone as the first constant.
This prevents a few improvements we would like to make, such as movingNone fromLOAD_CONST toLOAD_COMMON_CONST,
and complicates handling of code objects in the compiler.
I propose adding a flag toco_flags,CO_HAS_DOCSTRING. If this flag is set then the docstring is the zeroth string, otherwise there is no docstring.