[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.
This commit is contained in:
Victor Stinner 2023-12-03 12:45:32 +01:00 committed by GitHub
parent 73cda994a3
commit 05f5d416de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

View file

@ -7,7 +7,7 @@ extern "C" {
#endif #endif
PyAPI_DATA(PyTypeObject) PyBool_Type; // PyBool_Type is declared by object.h
#define PyBool_Check(x) Py_IS_TYPE((x), &PyBool_Type) #define PyBool_Check(x) Py_IS_TYPE((x), &PyBool_Type)

View file

@ -7,7 +7,7 @@ extern "C" {
/* Long (arbitrary precision) integer object interface */ /* Long (arbitrary precision) integer object interface */
PyAPI_DATA(PyTypeObject) PyLong_Type; // PyLong_Type is declared by object.h
#define PyLong_Check(op) \ #define PyLong_Check(op) \
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS) PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS)

View file

@ -0,0 +1,2 @@
Fix redundant declarations in the public C API. Declare PyBool_Type and
PyLong_Type only once. Patch by Victor Stinner.