bpo-42990: Add __builtins__ attribute to functions by vstinner · Pull Request #24559 · python/cpython
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Expose the new PyFunctionObject.func_builtins member in Python as a
new __builtins__ attribute on functions.
Document also the behavior change in What's New in Python 3.10.
Expose the new PyFunctionObject.func_builtins member in Python as a new __builtins__ attribute on functions. Document also the behavior change in What's New in Python 3.10.
@markshannon: I wrote this PR to expose the new function attribute in Python but also to document the subtle behavior change.
Using the new attribute, cloudpickle will be able to hack the function builtins update the update method, as already done for function globals.
adorilson pushed a commit to adorilson/cpython that referenced this pull request
Mar 13, 2021