Skip to content

Commit

Permalink
pythongh-106560: Fix redundant declarations in Include/
Browse files Browse the repository at this point in the history
Don't declare PyBool_Type, PyLong_Type and PySys_Audit() twice, but
only once.

Compiler warnings seen by building Python with gcc -Wredundant-decls.
  • Loading branch information
vstinner committed Dec 2, 2023
1 parent 93dc779 commit 0e87b17
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Include/boolobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 0 additions & 4 deletions Include/cpython/sysmodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion Include/longobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 0e87b17

Please sign in to comment.