gh-115775: Compiler adds __static_attributes__ field to classes (#115913)

This commit is contained in:
Irit Katriel 2024-03-26 15:18:17 +00:00 committed by GitHub
parent 70969d53a7
commit 79be75735c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 136 additions and 11 deletions

View file

@ -724,6 +724,7 @@ _PyStaticObjects_CheckRefcnt(PyInterpreterState *interp) {
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(__slotnames__));
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(__slots__));
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(__spec__));
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(__static_attributes__));
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(__str__));
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(__sub__));
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(__subclasscheck__));

View file

@ -213,6 +213,7 @@ struct _Py_global_strings {
STRUCT_FOR_ID(__slotnames__)
STRUCT_FOR_ID(__slots__)
STRUCT_FOR_ID(__spec__)
STRUCT_FOR_ID(__static_attributes__)
STRUCT_FOR_ID(__str__)
STRUCT_FOR_ID(__sub__)
STRUCT_FOR_ID(__subclasscheck__)

View file

@ -722,6 +722,7 @@ extern "C" {
INIT_ID(__slotnames__), \
INIT_ID(__slots__), \
INIT_ID(__spec__), \
INIT_ID(__static_attributes__), \
INIT_ID(__str__), \
INIT_ID(__sub__), \
INIT_ID(__subclasscheck__), \

View file

@ -480,6 +480,9 @@ _PyUnicode_InitStaticStrings(PyInterpreterState *interp) {
string = &_Py_ID(__spec__);
assert(_PyUnicode_CheckConsistency(string, 1));
_PyUnicode_InternInPlace(interp, &string);
string = &_Py_ID(__static_attributes__);
assert(_PyUnicode_CheckConsistency(string, 1));
_PyUnicode_InternInPlace(interp, &string);
string = &_Py_ID(__str__);
assert(_PyUnicode_CheckConsistency(string, 1));
_PyUnicode_InternInPlace(interp, &string);