summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-12-03 11:45:32 (GMT)
committerGitHub <noreply@github.com>2023-12-03 11:45:32 (GMT)
commit05f5d416de88353d4f4568d0e30a22a7f23ba487 (patch)
treeaeec78159710360bfbfd8c6e5cbb828fc9caf801
parent73cda994a39292c43402cb0914304c82b92b9f43 (diff)
downloadcpython-05f5d416de88353d4f4568d0e30a22a7f23ba487.zip
cpython-05f5d416de88353d4f4568d0e30a22a7f23ba487.tar.gz
cpython-05f5d416de88353d4f4568d0e30a22a7f23ba487.tar.bz2
[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.
-rw-r--r--Include/boolobject.h2
-rw-r--r--Include/longobject.h2
-rw-r--r--Misc/NEWS.d/next/C API/2023-12-02-02-08-11.gh-issue-106560.THvuji.rst2
3 files changed, 4 insertions, 2 deletions
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.