Skip to content
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

gh-118921: Add copy() method for FrameLocalsProxy #118923

Merged
merged 3 commits into from May 10, 2024

Conversation

gaogaotiantian
Copy link
Member

@gaogaotiantian gaogaotiantian commented May 10, 2024

@gaogaotiantian
Copy link
Member Author

@gvanrossum do we want to support copy.copy(proxy) as well?

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG, one nit. I don't think there's much evidence that people are using copy.copy() for the same purpose, and mappingproxy doesn't support it either.

x = 0
d = sys._getframe().f_locals
d_copy = d.copy()
self.assertIs(type(d_copy), dict)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think assertIsInstance is good enough here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I did not use that method a lot so I didn't think of it.

@gvanrossum gvanrossum added the 3.13 bugs and security fixes label May 10, 2024
@gvanrossum gvanrossum merged commit 35c4361 into python:main May 10, 2024
38 checks passed
@gvanrossum gvanrossum added the needs backport to 3.13 bugs and security fixes label May 10, 2024
@miss-islington-app
Copy link

Thanks @gaogaotiantian for the PR, and @gvanrossum for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 10, 2024
…-118923)

(cherry picked from commit 35c4361)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
@bedevere-app
Copy link

bedevere-app bot commented May 10, 2024

GH-118933 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label May 10, 2024
gvanrossum pushed a commit that referenced this pull request May 10, 2024
…) (#118933)

(cherry picked from commit 35c4361)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
@gaogaotiantian gaogaotiantian deleted the framelocalsproxy-copy branch May 12, 2024 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants