Skip to content

Commit 1f2a676

Browse files
authored
gh-106560: Fix redundant declarations in Include/ (#112611)
Don't declare PyBool_Type, PyLong_Type and PySys_Audit() twice, but only once. Compiler warnings seen by building Python with gcc -Wredundant-decls.
1 parent 29e6c7b commit 1f2a676

File tree

4 files changed

+4
-6
lines changed

4 files changed

+4
-6
lines changed

Include/boolobject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ extern "C" {
77
#endif
88

99

10-
PyAPI_DATA(PyTypeObject) PyBool_Type;
10+
// PyBool_Type is declared by object.h
1111

1212
#define PyBool_Check(x) Py_IS_TYPE((x), &PyBool_Type)
1313

Include/cpython/sysmodule.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44

55
typedef int(*Py_AuditHookFunction)(const char *, PyObject *, void *);
66

7-
PyAPI_FUNC(int) PySys_Audit(
8-
const char *event,
9-
const char *format,
10-
...);
117
PyAPI_FUNC(int) PySys_AddAuditHook(Py_AuditHookFunction, void*);
128

139
typedef struct {

Include/longobject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ extern "C" {
77

88
/* Long (arbitrary precision) integer object interface */
99

10-
PyAPI_DATA(PyTypeObject) PyLong_Type;
10+
// PyLong_Type is declared by object.h
1111

1212
#define PyLong_Check(op) \
1313
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix redundant declarations in the public C API. Declare PyBool_Type,
2+
PyLong_Type and PySys_Audit() only once. Patch by Victor Stinner.

0 commit comments

Comments
 (0)