Skip to content

annotationlib: Remove some unnecessary dict copies - #132495

Merged
JelleZijlstra merged 2 commits into
python:mainfrom
JelleZijlstra:simplyannotate
Apr 16, 2025
Merged

JelleZijlstra merged 2 commits into
python:mainfrom
JelleZijlstra:simplyannotate

Conversation

@JelleZijlstra

Copy link
Copy Markdown
Member

We were copying the dictionary multiple times in a few cases. Once is enough.

@AlexWaygood AlexWaygood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

could we add some comments or docstrings to indicate clearly which internal functions are meant to uphold the invariant that they always return a fresh dictionary, and which aren't?

@JelleZijlstra

Copy link
Copy Markdown
Member Author

Good point, added docstrings

@AlexWaygood AlexWaygood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

@JelleZijlstra
JelleZijlstra merged commit a8ca26d into python:main Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants