STINNER Victor <[email protected]> added the comment:
Attached func_builtins2.py mimicks the cloudpicke bug:
---
def func(s): return len(s)
code = func.__code__
FuncType = type(func)
func2_globals = {}
func2 = FuncType(code, func2_globals)
# func2.func_builtins = {'None': None}
func2.__globals__['__builtins__'] = __builtins__
# frame created with {'None': None} builtins: "len" key is missing
func2("abc")
---
In Python 3.10, setting func2.__globals__['__builtins__'] has no longer an
impact on the frame created to call func2().
----------
Added file: https://bugs.python.org/file49816/func_builtins2.py
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue43228>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com