]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-106560: Fix redundant declarations in Include/ (#112611) (#112650)
authorVictor Stinner <vstinner@python.org>
Sun, 3 Dec 2023 11:45:32 +0000 (12:45 +0100)
committerGitHub <noreply@github.com>
Sun, 3 Dec 2023 11:45:32 +0000 (11:45 +0000)
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
Include/longobject.h
Misc/NEWS.d/next/C API/2023-12-02-02-08-11.gh-issue-106560.THvuji.rst [new file with mode: 0644]

index 976fa35201d035d51bd6774de92d05390e97b6cc..19aef5b1b87c6ae75e103a1ced69fa958f50f740 100644 (file)
@@ -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)
 
index e559e238ae5a3555aa103a53a3c1262c616e3639..e090dd024a03e000ba75761feba7ad34e869d695 100644 (file)
@@ -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 (file)
index 0000000..636dbbd
--- /dev/null
@@ -0,0 +1,2 @@
+Fix redundant declarations in the public C API. Declare PyBool_Type and
+PyLong_Type only once. Patch by Victor Stinner.