gh-119180: PEP 649: Add __annotate__ attributes (#119209)

This commit is contained in:
Jelle Zijlstra 2024-05-21 22:38:12 -04:00 committed by GitHub
parent 73ab83b27f
commit e9875ecb5d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 324 additions and 18 deletions

View file

@ -590,6 +590,7 @@ _PyStaticObjects_CheckRefcnt(PyInterpreterState *interp) {
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(__all__));
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(__and__));
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(__anext__));
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(__annotate__));
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(__annotations__));
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(__args__));
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(__asyncio_running_event_loop__));

View file

@ -79,6 +79,7 @@ struct _Py_global_strings {
STRUCT_FOR_ID(__all__)
STRUCT_FOR_ID(__and__)
STRUCT_FOR_ID(__anext__)
STRUCT_FOR_ID(__annotate__)
STRUCT_FOR_ID(__annotations__)
STRUCT_FOR_ID(__args__)
STRUCT_FOR_ID(__asyncio_running_event_loop__)

View file

@ -588,6 +588,7 @@ extern "C" {
INIT_ID(__all__), \
INIT_ID(__and__), \
INIT_ID(__anext__), \
INIT_ID(__annotate__), \
INIT_ID(__annotations__), \
INIT_ID(__args__), \
INIT_ID(__asyncio_running_event_loop__), \

View file

@ -78,6 +78,9 @@ _PyUnicode_InitStaticStrings(PyInterpreterState *interp) {
string = &_Py_ID(__anext__);
assert(_PyUnicode_CheckConsistency(string, 1));
_PyUnicode_InternInPlace(interp, &string);
string = &_Py_ID(__annotate__);
assert(_PyUnicode_CheckConsistency(string, 1));
_PyUnicode_InternInPlace(interp, &string);
string = &_Py_ID(__annotations__);
assert(_PyUnicode_CheckConsistency(string, 1));
_PyUnicode_InternInPlace(interp, &string);