File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Misc/NEWS.d/next/Core_and_Builtins Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 1+ Make `compile ` builtin function deterministic by sorting
2+ `__static_attributes__ ` before dumping to the bytecode #.. section: Library
3+ #.. section: Documentation #.. section: Tests #.. section: Build #..
4+ section: Windows #.. section: macOS #.. section: IDLE #.. section:
5+ Tools/Demos #.. section: C API
6+
7+ # Write your Misc/NEWS.d entry below. It should be a simple ReST paragraph.
8+ # Don't start with "- Issue #<n>: " or "- gh-issue-<n>: " or that sort of
9+ stuff.
10+ ###########################################################################
Original file line number Diff line number Diff line change @@ -911,7 +911,14 @@ PyObject *
911911_PyCompile_StaticAttributesAsTuple (compiler * c )
912912{
913913 assert (c -> u -> u_static_attributes );
914- return PySequence_Tuple (c -> u -> u_static_attributes );
914+ PyObject * static_attributes_unsorted = PySequence_List (c -> u -> u_static_attributes );
915+ if (static_attributes_unsorted == NULL ) {
916+ return NULL ;
917+ }
918+ PyList_Sort (static_attributes_unsorted );
919+ PyObject * static_attributes = PySequence_Tuple (static_attributes_unsorted );
920+ Py_DECREF (static_attributes_unsorted );
921+ return static_attributes ;
915922}
916923
917924int
You can’t perform that action at this time.
0 commit comments