Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gh-124442: make __static_attributes__ deterministic by sorting #124492

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 6 commits into from
Sep 28, 2024

Conversation

kp2pml30
Copy link
Contributor

@kp2pml30 kp2pml30 commented Sep 25, 2024

@ghost
Copy link

ghost commented Sep 25, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

Comment on lines 1 to 10
Make :func:`compile` builtin function deterministic by sorting
``__static_attributes__`` before dumping to the bytecode #.. section:
Library #.. section: Documentation #.. section: Tests #.. section: Build #..
section: Windows #.. section: macOS #.. section: IDLE #.. section:
Tools/Demos #.. section: C API

# Write your Misc/NEWS.d entry below. It should be a simple ReST paragraph.
# Don't start with "- Issue #<n>: " or "- gh-issue-<n>: " or that sort of
stuff.
###########################################################################
Copy link
Member

@AA-Turner AA-Turner Sep 25, 2024

Choose a reason for hiding this comment

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

Suggested change
Make :func:`compile` builtin function deterministic by sorting
``__static_attributes__`` before dumping to the bytecode #.. section:
Library #.. section: Documentation #.. section: Tests #.. section: Build #..
section: Windows #.. section: macOS #.. section: IDLE #.. section:
Tools/Demos #.. section: C API
# Write your Misc/NEWS.d entry below. It should be a simple ReST paragraph.
# Don't start with "- Issue #<n>: " or "- gh-issue-<n>: " or that sort of
stuff.
###########################################################################
Make the :func:`compile` builtin function deterministic by sorting
:attr:`~class.__static_attributes__` before writing to bytecode.

@bedevere-app
Copy link

bedevere-app bot commented Sep 25, 2024

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@kp2pml30
Copy link
Contributor Author

I have made the requested changes; please review again

@bedevere-app
Copy link

bedevere-app bot commented Sep 25, 2024

Thanks for making the requested changes!

@AA-Turner: please review the changes made to this pull request.

@AA-Turner
Copy link
Member

@kp2pml30 please avoid force-pushing, it makes reviews harder. The Developer's Guide asks that we avoid force-pushing.

I'd also suggest adding a test in test_compile, perhaps that the unsorted __static_attributes__ is equal to the sorted. (Others probably have better ideas for tests!)

A

@kp2pml30 kp2pml30 requested a review from Eclips4 September 25, 2024 11:06
Signed-off-by: kp2pml30 <[email protected]>
@JelleZijlstra
Copy link
Member

I'm going to push some changes here as I'd like to get this fixed in 3.13.0.

@JelleZijlstra JelleZijlstra merged commit 04c837d into python:main Sep 28, 2024
37 checks passed
@JelleZijlstra JelleZijlstra added the needs backport to 3.13 bugs and security fixes label Sep 28, 2024
@miss-islington-app
Copy link

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

@miss-islington-app
Copy link

Sorry, @kp2pml30 and @JelleZijlstra, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 04c837d9d8a474777ef9c1412fbba14f0682366c 3.13

@bedevere-app
Copy link

bedevere-app bot commented Sep 28, 2024

GH-124738 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 Sep 28, 2024
JelleZijlstra added a commit to JelleZijlstra/cpython that referenced this pull request Sep 28, 2024
… sorting (pythonGH-124492)

(cherry picked from commit 04c837d)

Co-authored-by: Kira <[email protected]>
Signed-off-by: kp2pml30 <[email protected]>
Co-authored-by: Jelle Zijlstra <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
Yhg1s pushed a commit that referenced this pull request Oct 1, 2024
…ng (GH-124492) (#124738)

* [3.13] gh-124442: make `__static_attributes__` deterministic by sorting (GH-124492)
(cherry picked from commit 04c837d)

Co-authored-by: Kira <[email protected]>
Signed-off-by: kp2pml30 <[email protected]>
Co-authored-by: Jelle Zijlstra <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
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