Skip to content

bpo-42990: Add __builtins__ attribute to functions #24559

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

Merged
merged 1 commit into from
Feb 18, 2021
Merged

bpo-42990: Add __builtins__ attribute to functions #24559

merged 1 commit into from
Feb 18, 2021

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Feb 17, 2021

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.

https://bugs.python.org/issue42990

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.
@vstinner
Copy link
Member Author

@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.

@markshannon
Copy link
Member

LGTM

@vstinner vstinner merged commit a3c3ffa into python:master Feb 18, 2021
@vstinner vstinner deleted the func_builtins branch February 18, 2021 11:35
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants