bpo-47067: Optimize calling GenericAlias objects (GH-31996)

Use vectorcall, and replace `PyObject_SetAttrString` with `PyObject_SetAttr` and a global string.
This commit is contained in:
penguin_wwy 2022-03-22 04:33:02 +08:00 committed by GitHub
parent 5c3201e146
commit 1ea055bd53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 7 deletions

View file

@ -156,6 +156,7 @@ struct _Py_global_strings {
STRUCT_FOR_ID(__next__)
STRUCT_FOR_ID(__note__)
STRUCT_FOR_ID(__or__)
STRUCT_FOR_ID(__orig_class__)
STRUCT_FOR_ID(__origin__)
STRUCT_FOR_ID(__package__)
STRUCT_FOR_ID(__parameters__)

View file

@ -779,6 +779,7 @@ extern "C" {
INIT_ID(__next__), \
INIT_ID(__note__), \
INIT_ID(__or__), \
INIT_ID(__orig_class__), \
INIT_ID(__origin__), \
INIT_ID(__package__), \
INIT_ID(__parameters__), \