Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b4d5a5c

Browse files
authored
bpo-39583: Remove superfluous "extern C" bits from Include/cpython/*.h (GH-18413)
1 parent cbe1296 commit b4d5a5c

20 files changed

Lines changed: 2 additions & 151 deletions

Include/cpython/abstract.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
# error "this header file must not be included directly"
33
#endif
44

5-
#ifdef __cplusplus
6-
extern "C" {
7-
#endif
8-
95
/* === Object Protocol ================================================== */
106

117
#ifdef PY_SSIZE_T_CLEAN
@@ -380,8 +376,4 @@ PyAPI_FUNC(void) _Py_add_one_to_index_C(int nd, Py_ssize_t *index,
380376
PyAPI_FUNC(int) _Py_convert_optional_to_ssize_t(PyObject *, void *);
381377

382378
/* Same as PyNumber_Index but can return an instance of a subclass of int. */
383-
PyAPI_FUNC(PyObject *) _PyNumber_Index(PyObject *o);
384-
385-
#ifdef __cplusplus
386-
}
387-
#endif
379+
PyAPI_FUNC(PyObject *) _PyNumber_Index(PyObject *o);

Include/cpython/ceval.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
# error "this header file must not be included directly"
33
#endif
44

5-
#ifdef __cplusplus
6-
extern "C" {
7-
#endif
8-
95
PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *);
106
PyAPI_DATA(int) _PyEval_SetProfile(PyThreadState *tstate, Py_tracefunc func, PyObject *arg);
117
PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *);
@@ -32,7 +28,3 @@ PyAPI_FUNC(Py_ssize_t) _PyEval_RequestCodeExtraIndex(freefunc);
3228

3329
PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *);
3430
PyAPI_FUNC(int) _PyEval_SliceIndexNotNone(PyObject *, Py_ssize_t *);
35-
36-
#ifdef __cplusplus
37-
}
38-
#endif

Include/cpython/dictobject.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
# error "this header file must not be included directly"
33
#endif
44

5-
#ifdef __cplusplus
6-
extern "C" {
7-
#endif
8-
95
typedef struct _dictkeysobject PyDictKeysObject;
106

117
/* The ma_values pointer is NULL for a combined table
@@ -86,7 +82,3 @@ typedef struct {
8682

8783
PyAPI_FUNC(PyObject *) _PyDictView_New(PyObject *, PyTypeObject *);
8884
PyAPI_FUNC(PyObject *) _PyDictView_Intersect(PyObject* self, PyObject *other);
89-
90-
#ifdef __cplusplus
91-
}
92-
#endif

Include/cpython/fileobject.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
# error "this header file must not be included directly"
33
#endif
44

5-
#ifdef __cplusplus
6-
extern "C" {
7-
#endif
8-
95
PyAPI_FUNC(char *) Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *);
106

117
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000
@@ -26,7 +22,3 @@ typedef PyObject * (*Py_OpenCodeHookFunction)(PyObject *, void *);
2622
PyAPI_FUNC(PyObject *) PyFile_OpenCode(const char *utf8path);
2723
PyAPI_FUNC(PyObject *) PyFile_OpenCodeObject(PyObject *path);
2824
PyAPI_FUNC(int) PyFile_SetOpenCodeHook(Py_OpenCodeHookFunction hook, void *userData);
29-
30-
#ifdef __cplusplus
31-
}
32-
#endif

Include/cpython/frameobject.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
# error "this header file must not be included directly"
55
#endif
66

7-
#ifdef __cplusplus
8-
extern "C" {
9-
#endif
10-
117
typedef struct {
128
int b_type; /* what kind of block this is */
139
int b_handler; /* where to jump to find handler */
@@ -78,7 +74,3 @@ PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *);
7874
PyAPI_FUNC(void) _PyFrame_DebugMallocStats(FILE *out);
7975

8076
PyAPI_FUNC(PyFrameObject *) PyFrame_GetBack(PyFrameObject *frame);
81-
82-
#ifdef __cplusplus
83-
}
84-
#endif

Include/cpython/import.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
# error "this header file must not be included directly"
33
#endif
44

5-
#ifdef __cplusplus
6-
extern "C" {
7-
#endif
8-
95
PyMODINIT_FUNC PyInit__imp(void);
106

117
PyAPI_FUNC(int) _PyImport_IsInitialized(PyInterpreterState *);
@@ -44,7 +40,3 @@ struct _frozen {
4440
collection of frozen modules: */
4541

4642
PyAPI_DATA(const struct _frozen *) PyImport_FrozenModules;
47-
48-
#ifdef __cplusplus
49-
}
50-
#endif

Include/cpython/initconfig.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
#ifndef Py_PYCORECONFIG_H
22
#define Py_PYCORECONFIG_H
33
#ifndef Py_LIMITED_API
4-
#ifdef __cplusplus
5-
extern "C" {
6-
#endif
74

85
/* --- PyStatus ----------------------------------------------- */
96

@@ -438,8 +435,5 @@ PyAPI_FUNC(PyStatus) PyConfig_SetWideStringList(PyConfig *config,
438435
PyWideStringList *list,
439436
Py_ssize_t length, wchar_t **items);
440437

441-
#ifdef __cplusplus
442-
}
443-
#endif
444438
#endif /* !Py_LIMITED_API */
445439
#endif /* !Py_PYCORECONFIG_H */

Include/cpython/interpreteridobject.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,10 @@
22
# error "this header file must not be included directly"
33
#endif
44

5-
#ifdef __cplusplus
6-
extern "C" {
7-
#endif
8-
95
/* Interpreter ID Object */
106

117
PyAPI_DATA(PyTypeObject) _PyInterpreterID_Type;
128

139
PyAPI_FUNC(PyObject *) _PyInterpreterID_New(int64_t);
1410
PyAPI_FUNC(PyObject *) _PyInterpreterState_GetIDObject(PyInterpreterState *);
1511
PyAPI_FUNC(PyInterpreterState *) _PyInterpreterID_LookUp(PyObject *);
16-
17-
#ifdef __cplusplus
18-
}
19-
#endif

Include/cpython/listobject.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
# error "this header file must not be included directly"
33
#endif
44

5-
#ifdef __cplusplus
6-
extern "C" {
7-
#endif
8-
95
typedef struct {
106
PyObject_VAR_HEAD
117
/* Vector of pointers to list elements. list[0] is ob_item[0], etc. */
@@ -37,7 +33,3 @@ PyAPI_FUNC(void) _PyList_DebugMallocStats(FILE *out);
3733
#define PyList_SET_ITEM(op, i, v) (_PyList_CAST(op)->ob_item[i] = (v))
3834
#define PyList_GET_SIZE(op) Py_SIZE(_PyList_CAST(op))
3935
#define _PyList_ITEMS(op) (_PyList_CAST(op)->ob_item)
40-
41-
#ifdef __cplusplus
42-
}
43-
#endif

Include/cpython/object.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
# error "this header file must not be included directly"
33
#endif
44

5-
#ifdef __cplusplus
6-
extern "C" {
7-
#endif
8-
95
PyAPI_FUNC(void) _Py_NewReference(PyObject *op);
106

117
#ifdef Py_TRACE_REFS
@@ -548,7 +544,3 @@ PyAPI_FUNC(void) _PyTrash_end(struct _ts *tstate);
548544
* unconditionally */
549545
#define Py_TRASHCAN_SAFE_BEGIN(op) Py_TRASHCAN_BEGIN_CONDITION(op, 1)
550546
#define Py_TRASHCAN_SAFE_END(op) Py_TRASHCAN_END
551-
552-
#ifdef __cplusplus
553-
}
554-
#endif

0 commit comments

Comments
 (0)