From 05f5d416de88353d4f4568d0e30a22a7f23ba487 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sun, 3 Dec 2023 12:45:32 +0100 Subject: [3.12] gh-106560: Fix redundant declarations in Include/ (#112611) (#112650) gh-106560: Fix redundant declarations in Include/ (#112611) Don't declare PyBool_Type and PyLong_Type twice, but only once. Compiler warnings seen by building Python with gcc -Wredundant-decls. --- Include/boolobject.h | 2 +- Include/longobject.h | 2 +- Misc/NEWS.d/next/C API/2023-12-02-02-08-11.gh-issue-106560.THvuji.rst | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/C API/2023-12-02-02-08-11.gh-issue-106560.THvuji.rst diff --git a/Include/boolobject.h b/Include/boolobject.h index 976fa35..19aef5b 100644 --- a/Include/boolobject.h +++ b/Include/boolobject.h @@ -7,7 +7,7 @@ extern "C" { #endif -PyAPI_DATA(PyTypeObject) PyBool_Type; +// PyBool_Type is declared by object.h #define PyBool_Check(x) Py_IS_TYPE((x), &PyBool_Type) diff --git a/Include/longobject.h b/Include/longobject.h index e559e23..e090dd0 100644 --- a/Include/longobject.h +++ b/Include/longobject.h @@ -7,7 +7,7 @@ extern "C" { /* Long (arbitrary precision) integer object interface */ -PyAPI_DATA(PyTypeObject) PyLong_Type; +// PyLong_Type is declared by object.h #define PyLong_Check(op) \ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS) diff --git a/Misc/NEWS.d/next/C API/2023-12-02-02-08-11.gh-issue-106560.THvuji.rst b/Misc/NEWS.d/next/C API/2023-12-02-02-08-11.gh-issue-106560.THvuji.rst new file mode 100644 index 0000000..636dbbd --- /dev/null +++ b/Misc/NEWS.d/next/C API/2023-12-02-02-08-11.gh-issue-106560.THvuji.rst @@ -0,0 +1,2 @@ +Fix redundant declarations in the public C API. Declare PyBool_Type and +PyLong_Type only once. Patch by Victor Stinner. -- cgit v0.12