gh-93741: Add private C API _PyImport_GetModuleAttrString() (GH-93742)

It combines PyImport_ImportModule() and PyObject_GetAttrString()
and saves 4-6 lines of code on every use.

Add also _PyImport_GetModuleAttr() which takes Python strings as arguments.
This commit is contained in:
Serhiy Storchaka 2022-06-14 07:15:26 +03:00 committed by GitHub
parent 7b2064b4b9
commit 6fd4c8ec77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 114 additions and 248 deletions

View file

@ -226,7 +226,6 @@ struct _Py_global_strings {
STRUCT_FOR_ID(_showwarnmsg)
STRUCT_FOR_ID(_shutdown)
STRUCT_FOR_ID(_slotnames)
STRUCT_FOR_ID(_strptime_time)
STRUCT_FOR_ID(_uninitialized_submodules)
STRUCT_FOR_ID(_warn_unawaited_coroutine)
STRUCT_FOR_ID(_xoptions)
@ -252,7 +251,6 @@ struct _Py_global_strings {
STRUCT_FOR_ID(difference_update)
STRUCT_FOR_ID(dispatch_table)
STRUCT_FOR_ID(displayhook)
STRUCT_FOR_ID(enable)
STRUCT_FOR_ID(encode)
STRUCT_FOR_ID(encoding)
STRUCT_FOR_ID(end_lineno)
@ -311,7 +309,6 @@ struct _Py_global_strings {
STRUCT_FOR_ID(opcode)
STRUCT_FOR_ID(open)
STRUCT_FOR_ID(parent)
STRUCT_FOR_ID(partial)
STRUCT_FOR_ID(path)
STRUCT_FOR_ID(peek)
STRUCT_FOR_ID(persistent_id)
@ -357,7 +354,6 @@ struct _Py_global_strings {
STRUCT_FOR_ID(warnoptions)
STRUCT_FOR_ID(writable)
STRUCT_FOR_ID(write)
STRUCT_FOR_ID(zipimporter)
} identifiers;
struct {
PyASCIIObject _ascii;