bpo-39583: Remove superfluous "extern C" bits from Include/cpython/*.h (GH-18413)

This commit is contained in:
Skip Montanaro 2020-06-01 13:35:56 -05:00 committed by GitHub
parent cbe1296922
commit b4d5a5cca2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 2 additions and 151 deletions

View File

@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* === Object Protocol ================================================== */
#ifdef PY_SSIZE_T_CLEAN
@ -380,8 +376,4 @@ PyAPI_FUNC(void) _Py_add_one_to_index_C(int nd, Py_ssize_t *index,
PyAPI_FUNC(int) _Py_convert_optional_to_ssize_t(PyObject *, void *);
/* Same as PyNumber_Index but can return an instance of a subclass of int. */
PyAPI_FUNC(PyObject *) _PyNumber_Index(PyObject *o);
#ifdef __cplusplus
}
#endif
PyAPI_FUNC(PyObject *) _PyNumber_Index(PyObject *o);

View File

@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
#ifdef __cplusplus
extern "C" {
#endif
PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *);
PyAPI_DATA(int) _PyEval_SetProfile(PyThreadState *tstate, Py_tracefunc func, PyObject *arg);
PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *);
@ -32,7 +28,3 @@ PyAPI_FUNC(Py_ssize_t) _PyEval_RequestCodeExtraIndex(freefunc);
PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *);
PyAPI_FUNC(int) _PyEval_SliceIndexNotNone(PyObject *, Py_ssize_t *);
#ifdef __cplusplus
}
#endif

View File

@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _dictkeysobject PyDictKeysObject;
/* The ma_values pointer is NULL for a combined table
@ -86,7 +82,3 @@ typedef struct {
PyAPI_FUNC(PyObject *) _PyDictView_New(PyObject *, PyTypeObject *);
PyAPI_FUNC(PyObject *) _PyDictView_Intersect(PyObject* self, PyObject *other);
#ifdef __cplusplus
}
#endif

View File

@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
#ifdef __cplusplus
extern "C" {
#endif
PyAPI_FUNC(char *) Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *);
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000
@ -26,7 +22,3 @@ typedef PyObject * (*Py_OpenCodeHookFunction)(PyObject *, void *);
PyAPI_FUNC(PyObject *) PyFile_OpenCode(const char *utf8path);
PyAPI_FUNC(PyObject *) PyFile_OpenCodeObject(PyObject *path);
PyAPI_FUNC(int) PyFile_SetOpenCodeHook(Py_OpenCodeHookFunction hook, void *userData);
#ifdef __cplusplus
}
#endif

View File

@ -4,10 +4,6 @@
# error "this header file must not be included directly"
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
int b_type; /* what kind of block this is */
int b_handler; /* where to jump to find handler */
@ -78,7 +74,3 @@ PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *);
PyAPI_FUNC(void) _PyFrame_DebugMallocStats(FILE *out);
PyAPI_FUNC(PyFrameObject *) PyFrame_GetBack(PyFrameObject *frame);
#ifdef __cplusplus
}
#endif

View File

@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
#ifdef __cplusplus
extern "C" {
#endif
PyMODINIT_FUNC PyInit__imp(void);
PyAPI_FUNC(int) _PyImport_IsInitialized(PyInterpreterState *);
@ -44,7 +40,3 @@ struct _frozen {
collection of frozen modules: */
PyAPI_DATA(const struct _frozen *) PyImport_FrozenModules;
#ifdef __cplusplus
}
#endif

View File

@ -1,9 +1,6 @@
#ifndef Py_PYCORECONFIG_H
#define Py_PYCORECONFIG_H
#ifndef Py_LIMITED_API
#ifdef __cplusplus
extern "C" {
#endif
/* --- PyStatus ----------------------------------------------- */
@ -438,8 +435,5 @@ PyAPI_FUNC(PyStatus) PyConfig_SetWideStringList(PyConfig *config,
PyWideStringList *list,
Py_ssize_t length, wchar_t **items);
#ifdef __cplusplus
}
#endif
#endif /* !Py_LIMITED_API */
#endif /* !Py_PYCORECONFIG_H */

View File

@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Interpreter ID Object */
PyAPI_DATA(PyTypeObject) _PyInterpreterID_Type;
@ -13,7 +9,3 @@ PyAPI_DATA(PyTypeObject) _PyInterpreterID_Type;
PyAPI_FUNC(PyObject *) _PyInterpreterID_New(int64_t);
PyAPI_FUNC(PyObject *) _PyInterpreterState_GetIDObject(PyInterpreterState *);
PyAPI_FUNC(PyInterpreterState *) _PyInterpreterID_LookUp(PyObject *);
#ifdef __cplusplus
}
#endif

View File

@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
PyObject_VAR_HEAD
/* Vector of pointers to list elements. list[0] is ob_item[0], etc. */
@ -37,7 +33,3 @@ PyAPI_FUNC(void) _PyList_DebugMallocStats(FILE *out);
#define PyList_SET_ITEM(op, i, v) (_PyList_CAST(op)->ob_item[i] = (v))
#define PyList_GET_SIZE(op) Py_SIZE(_PyList_CAST(op))
#define _PyList_ITEMS(op) (_PyList_CAST(op)->ob_item)
#ifdef __cplusplus
}
#endif

View File

@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
#ifdef __cplusplus
extern "C" {
#endif
PyAPI_FUNC(void) _Py_NewReference(PyObject *op);
#ifdef Py_TRACE_REFS
@ -548,7 +544,3 @@ PyAPI_FUNC(void) _PyTrash_end(struct _ts *tstate);
* unconditionally */
#define Py_TRASHCAN_SAFE_BEGIN(op) Py_TRASHCAN_BEGIN_CONDITION(op, 1)
#define Py_TRASHCAN_SAFE_END(op) Py_TRASHCAN_END
#ifdef __cplusplus
}
#endif

View File

@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define _PyObject_SIZE(typeobj) ( (typeobj)->tp_basicsize )
/* _PyObject_VAR_SIZE returns the number of bytes (as size_t) allocated for a
@ -139,7 +135,3 @@ PyAPI_FUNC(PyObject *) _PyObject_GC_Calloc(size_t size);
#define PyType_SUPPORTS_WEAKREFS(t) ((t)->tp_weaklistoffset > 0)
PyAPI_FUNC(PyObject **) PyObject_GET_WEAKREFS_LISTPTR(PyObject *op);
#ifdef __cplusplus
}
#endif

View File

@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Error objects */
/* PyException_HEAD defines the initial segment of every exception class. */
@ -188,7 +184,3 @@ PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalErrorFormat(
...);
#define Py_FatalError(message) _Py_FatalErrorFunc(__func__, message)
#ifdef __cplusplus
}
#endif

View File

@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Only used by applications that embed the interpreter and need to
* override the standard encoding determination mechanism
*/
@ -66,7 +62,3 @@ PyAPI_FUNC(int) _Py_LegacyLocaleDetected(int warn);
PyAPI_FUNC(char *) _Py_SetLocaleFromEnv(int category);
PyAPI_FUNC(PyThreadState *) _Py_NewInterpreter(int isolated_subinterpreter);
#ifdef __cplusplus
}
#endif

View File

@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
#ifdef __cplusplus
extern "C" {
#endif
PyAPI_FUNC(void *) PyMem_RawMalloc(size_t size);
PyAPI_FUNC(void *) PyMem_RawCalloc(size_t nelem, size_t elsize);
PyAPI_FUNC(void *) PyMem_RawRealloc(void *ptr, size_t new_size);
@ -102,7 +98,3 @@ PyAPI_FUNC(void) PyMem_SetAllocator(PyMemAllocatorDomain domain,
The function does nothing if Python is not compiled is debug mode. */
PyAPI_FUNC(void) PyMem_SetupDebugHooks(void);
#ifdef __cplusplus
}
#endif

View File

@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#include "cpython/initconfig.h"
PyAPI_FUNC(int) _PyInterpreterState_RequiresIDRef(PyInterpreterState *);
@ -257,7 +253,3 @@ typedef int (*crossinterpdatafunc)(PyObject *, struct _xid *);
PyAPI_FUNC(int) _PyCrossInterpreterData_RegisterClass(PyTypeObject *, crossinterpdatafunc);
PyAPI_FUNC(crossinterpdatafunc) _PyCrossInterpreterData_Lookup(PyObject *);
#ifdef __cplusplus
}
#endif

View File

@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
#ifdef __cplusplus
extern "C" {
#endif
PyAPI_FUNC(PyObject *) _PySys_GetObjectId(_Py_Identifier *key);
PyAPI_FUNC(int) _PySys_SetObjectId(_Py_Identifier *key, PyObject *);
@ -18,7 +14,3 @@ PyAPI_FUNC(int) PySys_Audit(
const char *argFormat,
...);
PyAPI_FUNC(int) PySys_AddAuditHook(Py_AuditHookFunction, void*);
#ifdef __cplusplus
}
#endif

View File

@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _traceback {
PyObject_HEAD
struct _traceback *tb_next;
@ -16,7 +12,3 @@ typedef struct _traceback {
PyAPI_FUNC(int) _Py_DisplaySourceLine(PyObject *, PyObject *, int, int);
PyAPI_FUNC(void) _PyTraceback_Add(const char *, const char *, int);
#ifdef __cplusplus
}
#endif

View File

@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
PyObject_VAR_HEAD
/* ob_item contains space for 'ob_size' elements.
@ -30,7 +26,3 @@ PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *);
#define PyTuple_SET_ITEM(op, i, v) (_PyTuple_CAST(op)->ob_item[i] = v)
PyAPI_FUNC(void) _PyTuple_DebugMallocStats(FILE *out);
#ifdef __cplusplus
}
#endif

View File

@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Py_UNICODE was the native Unicode storage format (code unit) used by
Python and represents a single Unicode element in the Unicode type.
With PEP 393, Py_UNICODE is deprecated and replaced with a
@ -1221,7 +1217,3 @@ PyAPI_FUNC(PyObject*) _PyUnicode_FromId(_Py_Identifier*);
PyAPI_FUNC(int) _PyUnicode_EQ(PyObject *, PyObject *);
PyAPI_FUNC(Py_ssize_t) _PyUnicode_ScanIdentifier(PyObject *);
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1 @@
Remove superfluous "extern C" declarations from ``Include/cpython/*.h``.