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 vstinner
Recipients Mark.Shannon, brett.cannon, gvanrossum, petr.viktorin, rhettinger, serhiy.storchaka, vstinner, yselivanov
Date 2021-02-17.22:00:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1613599240.55.0.549763490584.issue42990@roundup.psfhosted.org>
In-reply-to
Content
> +1 on exposing f,__builtins__.

This change is related to bpo-43228 "Regression in function builtins": cloudpickle is broken by this issue (new PyFunctionObject.func_builtins member).

> Of course, the thing I'd really want is a way to state that all references to builtins are meant to have the exact semantics of those builtins, so the compiler can translate e.g. len(x) into a new opcode that just calls PyObject_Size().  (I can dream, can't I?)

I tried to implement such optimization in my old https://faster-cpython.readthedocs.io/fat_python.html project. I implemented guards to de-optimize the code if a builtin is overriden.

> I suppose enough checking of dict version tags can get us there, or at least close enough.

The dict version comes from my FAT Python project: PEP 509. It is used to optimize method calls. See also PEP 510 and PEP 511 ;-)
History
Date User Action Args
2021-02-17 22:00:40vstinnersetrecipients: + vstinner, gvanrossum, brett.cannon, rhettinger, petr.viktorin, Mark.Shannon, serhiy.storchaka, yselivanov
2021-02-17 22:00:40vstinnersetmessageid: <1613599240.55.0.549763490584.issue42990@roundup.psfhosted.org>
2021-02-17 22:00:40vstinnerlinkissue42990 messages
2021-02-17 22:00:40vstinnercreate