STINNER Victor <vstin...@python.org> added the comment:

> +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 ;-)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42990>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to