This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author methane
Recipients Guido.van.Rossum, gvanrossum, iritkatriel, methane, rhettinger, serhiy.storchaka, terry.reedy
Date 2021-08-31.02:52:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1630378342.8.0.11681106809.issue36521@roundup.psfhosted.org>
In-reply-to
Content
I grepped top 5000 downloaded packages and I can not find any real use of PyFunction_New(WithQualName).
So I don't know what is current workflow of PyFunction_New.

My current wip implementation adds new API (e.g. PyFunction_NewWithDoc()).
Old API keep using co_consts[0] for docstring for backward compatibility.

Adding code.co_doc is not free.

* All code objects have one additional pointer. So it eats memory.
* Unmarshal need to call `r_object()` for all code objects. So it increase startup time.

Note that code objects is not for only functions. Class, modules, lambdas, comprehensions uses code objects without docstring.
And if PEP 649 is accepted, even function annotations will use code objects. It will double the number of code objects in the highly annotated source files.
History
Date User Action Args
2021-08-31 02:52:22methanesetrecipients: + methane, gvanrossum, rhettinger, terry.reedy, serhiy.storchaka, Guido.van.Rossum, iritkatriel
2021-08-31 02:52:22methanesetmessageid: <1630378342.8.0.11681106809.issue36521@roundup.psfhosted.org>
2021-08-31 02:52:22methanelinkissue36521 messages
2021-08-31 02:52:22methanecreate