From 279b887f5d4690f5b0d4831b0cb3b3da309ac621 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 29 Aug 2023 02:38:50 +0200 Subject: [PATCH 1/2] gh-106320: Remove _PyAnextAwaitable_Type from the public C API It's not needed to declare it in Include/iterobject.h: just use "extern" where it's used (only in object.c). --- Include/iterobject.h | 3 --- Objects/object.c | 7 ++++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Include/iterobject.h b/Include/iterobject.h index fff30f7176fdeb..e69d09719bb4d1 100644 --- a/Include/iterobject.h +++ b/Include/iterobject.h @@ -7,9 +7,6 @@ extern "C" { PyAPI_DATA(PyTypeObject) PySeqIter_Type; PyAPI_DATA(PyTypeObject) PyCallIter_Type; -#ifdef Py_BUILD_CORE -extern PyTypeObject _PyAnextAwaitable_Type; -#endif #define PySeqIter_Check(op) Py_IS_TYPE((op), &PySeqIter_Type) diff --git a/Objects/object.c b/Objects/object.c index 02e2611020983d..0d88421bf0fdc9 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -2049,11 +2049,12 @@ _PyObject_InitState(PyInterpreterState *interp) } -extern PyTypeObject _Py_GenericAliasIterType; -extern PyTypeObject _PyMemoryIter_Type; +extern PyTypeObject _PyAnextAwaitable_Type; +extern PyTypeObject _PyLegacyEventHandler_Type; extern PyTypeObject _PyLineIterator; +extern PyTypeObject _PyMemoryIter_Type; extern PyTypeObject _PyPositionsIterator; -extern PyTypeObject _PyLegacyEventHandler_Type; +extern PyTypeObject _Py_GenericAliasIterType; static PyTypeObject* static_types[] = { // The two most important base types: must be initialized first and From 65b2caab7b993e091220b37521e28f37ef85c023 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 29 Aug 2023 03:12:27 +0200 Subject: [PATCH 2/2] Fix make check-c-globals Remove also debug print() from Tools/c-analyzer/c_parser/preprocessor/gcc.py added by mistake by commit 3200ec6be572897c5da2b1edc28e5c7682914bc4. --- Tools/c-analyzer/c_parser/preprocessor/gcc.py | 1 - Tools/c-analyzer/cpython/globals-to-fix.tsv | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Tools/c-analyzer/c_parser/preprocessor/gcc.py b/Tools/c-analyzer/c_parser/preprocessor/gcc.py index 55cc2d37e1ebc7..18d1b1a5d0a37f 100644 --- a/Tools/c-analyzer/c_parser/preprocessor/gcc.py +++ b/Tools/c-analyzer/c_parser/preprocessor/gcc.py @@ -69,7 +69,6 @@ def preprocess(filename, cwd = os.path.abspath(cwd or '.') filename = _normpath(filename, cwd) - print(filename) postargs = POST_ARGS if os.path.basename(filename) not in USE_LIMITED_C_API: postargs += ('-DPy_BUILD_CORE=1',) diff --git a/Tools/c-analyzer/cpython/globals-to-fix.tsv b/Tools/c-analyzer/cpython/globals-to-fix.tsv index 58f9c8e8a3e9a5..bb85fba895bc25 100644 --- a/Tools/c-analyzer/cpython/globals-to-fix.tsv +++ b/Tools/c-analyzer/cpython/globals-to-fix.tsv @@ -57,6 +57,7 @@ Objects/genobject.c - _PyCoroWrapper_Type - Objects/interpreteridobject.c - PyInterpreterID_Type - Objects/iterobject.c - PyCallIter_Type - Objects/iterobject.c - PySeqIter_Type - +Objects/iterobject.c - _PyAnextAwaitable_Type - Objects/listobject.c - PyListIter_Type - Objects/listobject.c - PyListRevIter_Type - Objects/listobject.c - PyList_Type - @@ -70,6 +71,7 @@ Objects/moduleobject.c - PyModule_Type - Objects/namespaceobject.c - _PyNamespace_Type - Objects/object.c - _PyNone_Type - Objects/object.c - _PyNotImplemented_Type - +Objects/object.c - _PyAnextAwaitable_Type - Objects/odictobject.c - PyODictItems_Type - Objects/odictobject.c - PyODictIter_Type - Objects/odictobject.c - PyODictKeys_Type - @@ -113,8 +115,6 @@ Objects/codeobject.c - _PyLineIterator - Objects/codeobject.c - _PyPositionsIterator - Objects/genericaliasobject.c - _Py_GenericAliasIterType - # Not in a .h file: -Objects/iterobject.c - _PyAnextAwaitable_Type - -# Not in a .h file: Objects/memoryobject.c - _PyMemoryIter_Type - Objects/unicodeobject.c - _PyUnicodeASCIIIter_Type - Objects/unionobject.c - _PyUnion_Type -