]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-106560: Fix redundant declarations in Include/ (#112611)
authorVictor Stinner <vstinner@python.org>
Sun, 3 Dec 2023 11:16:31 +0000 (12:16 +0100)
committerGitHub <noreply@github.com>
Sun, 3 Dec 2023 11:16:31 +0000 (12:16 +0100)
Don't declare PyBool_Type, PyLong_Type and PySys_Audit() twice, but
only once.

Compiler warnings seen by building Python with gcc -Wredundant-decls.

Include/boolobject.h
Include/cpython/sysmodule.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 9fd7cc0cb43931150e197a1929e6f3591854031b..a3ac07f538a94f32892d8d98872b8cbced812063 100644 (file)
@@ -4,10 +4,6 @@
 
 typedef int(*Py_AuditHookFunction)(const char *, PyObject *, void *);
 
-PyAPI_FUNC(int) PySys_Audit(
-    const char *event,
-    const char *format,
-    ...);
 PyAPI_FUNC(int) PySys_AddAuditHook(Py_AuditHookFunction, void*);
 
 typedef struct {
index 7393254cd24a9bf5feee46b66c005ebb6e57f21d..51005efff636fac7b938ff356431749faba92ebb 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..59b461e
--- /dev/null
@@ -0,0 +1,2 @@
+Fix redundant declarations in the public C API. Declare PyBool_Type,
+PyLong_Type and PySys_Audit() only once. Patch by Victor Stinner.