mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
gh-124442: make __static_attributes__
deterministic by sorting (#124492)
Signed-off-by: kp2pml30 <kp2pml30@gmail.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
This commit is contained in:
parent
69a4063ca5
commit
04c837d9d8
3 changed files with 30 additions and 1 deletions
|
@ -911,7 +911,17 @@ PyObject *
|
|||
_PyCompile_StaticAttributesAsTuple(compiler *c)
|
||||
{
|
||||
assert(c->u->u_static_attributes);
|
||||
return PySequence_Tuple(c->u->u_static_attributes);
|
||||
PyObject *static_attributes_unsorted = PySequence_List(c->u->u_static_attributes);
|
||||
if (static_attributes_unsorted == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (PyList_Sort(static_attributes_unsorted) != 0) {
|
||||
Py_DECREF(static_attributes_unsorted);
|
||||
return NULL;
|
||||
}
|
||||
PyObject *static_attributes = PySequence_Tuple(static_attributes_unsorted);
|
||||
Py_DECREF(static_attributes_unsorted);
|
||||
return static_attributes;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue