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.
This commit is contained in:
Victor Stinner 2023-12-03 12:16:31 +01:00 committed by GitHub
parent 29e6c7b68a
commit 1f2a676785
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 6 deletions

View File

@ -7,7 +7,7 @@ extern "C" {
#endif #endif
PyAPI_DATA(PyTypeObject) PyBool_Type; // PyBool_Type is declared by object.h
#define PyBool_Check(x) Py_IS_TYPE((x), &PyBool_Type) #define PyBool_Check(x) Py_IS_TYPE((x), &PyBool_Type)

View File

@ -4,10 +4,6 @@
typedef int(*Py_AuditHookFunction)(const char *, PyObject *, void *); 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*); PyAPI_FUNC(int) PySys_AddAuditHook(Py_AuditHookFunction, void*);
typedef struct { typedef struct {

View File

@ -7,7 +7,7 @@ extern "C" {
/* Long (arbitrary precision) integer object interface */ /* Long (arbitrary precision) integer object interface */
PyAPI_DATA(PyTypeObject) PyLong_Type; // PyLong_Type is declared by object.h
#define PyLong_Check(op) \ #define PyLong_Check(op) \
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS) PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS)

View File

@ -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.