Skip to content

Commit 8b626a4

Browse files
authored
gh-110079: Remove extern "C" { ...} in C code (#110080)
1 parent bfd94ab commit 8b626a4

18 files changed

+6
-168
lines changed

Modules/_scproxy.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -249,16 +249,8 @@ static struct PyModuleDef _scproxy_module = {
249249
.m_slots = _scproxy_slots,
250250
};
251251

252-
#ifdef __cplusplus
253-
extern "C" {
254-
#endif
255-
256252
PyMODINIT_FUNC
257253
PyInit__scproxy(void)
258254
{
259255
return PyModuleDef_Init(&_scproxy_module);
260256
}
261-
262-
#ifdef __cplusplus
263-
}
264-
#endif

Modules/_stat.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313

1414
#include "Python.h"
1515

16-
#ifdef __cplusplus
17-
extern "C" {
18-
#endif
19-
2016
#ifdef HAVE_SYS_TYPES_H
2117
#include <sys/types.h>
2218
#endif /* HAVE_SYS_TYPES_H */
@@ -631,7 +627,3 @@ PyInit__stat(void)
631627
{
632628
return PyModuleDef_Init(&statmodule);
633629
}
634-
635-
#ifdef __cplusplus
636-
}
637-
#endif

Modules/main.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@
2626
"Type \"help\", \"copyright\", \"credits\" or \"license\" " \
2727
"for more information."
2828

29-
#ifdef __cplusplus
30-
extern "C" {
31-
#endif
32-
3329
/* --- pymain_init() ---------------------------------------------- */
3430

3531
static PyStatus
@@ -742,7 +738,3 @@ Py_BytesMain(int argc, char **argv)
742738
.wchar_argv = NULL};
743739
return pymain_main(&args);
744740
}
745-
746-
#ifdef __cplusplus
747-
}
748-
#endif

Modules/posixmodule.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,6 @@
222222
#endif
223223

224224

225-
#ifdef __cplusplus
226-
extern "C" {
227-
#endif
228-
229225
PyDoc_STRVAR(posix__doc__,
230226
"This module provides access to operating system functionality that is\n\
231227
standardized by the C Standard and the POSIX standard (a thinly\n\
@@ -17002,7 +16998,3 @@ INITFUNC(void)
1700216998
{
1700316999
return PyModuleDef_Init(&posixmodule);
1700417000
}
17005-
17006-
#ifdef __cplusplus
17007-
}
17008-
#endif

Objects/fileobject.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@
2121
#define NEWLINE_LF 2 /* \n newline seen */
2222
#define NEWLINE_CRLF 4 /* \r\n newline seen */
2323

24-
#ifdef __cplusplus
25-
extern "C" {
26-
#endif
27-
2824
/* External C interface */
2925

3026
PyObject *
@@ -539,8 +535,3 @@ _PyFile_Flush(PyObject *file)
539535
Py_DECREF(tmp);
540536
return 0;
541537
}
542-
543-
544-
#ifdef __cplusplus
545-
}
546-
#endif

Objects/object.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@
2828
# error "Py_LIMITED_API macro must not be defined"
2929
#endif
3030

31-
#ifdef __cplusplus
32-
extern "C" {
33-
#endif
34-
3531
/* Defined in tracemalloc.c */
3632
extern void _PyMem_DumpTraceback(int fd, const void *ptr);
3733

@@ -2808,7 +2804,3 @@ int Py_IsFalse(PyObject *x)
28082804
{
28092805
return Py_Is(x, Py_False);
28102806
}
2811-
2812-
#ifdef __cplusplus
2813-
}
2814-
#endif

Objects/unicodeobject.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,6 @@ NOTE: In the interpreter's initialization phase, some globals are currently
100100
101101
*/
102102

103-
104-
#ifdef __cplusplus
105-
extern "C" {
106-
#endif
107-
108103
// Maximum code point of Unicode 6.0: 0x10ffff (1,114,111).
109104
// The value must be the same in fileutils.c.
110105
#define MAX_UNICODE 0x10ffff
@@ -15397,8 +15392,3 @@ PyInit__string(void)
1539715392
{
1539815393
return PyModuleDef_Init(&_string_module);
1539915394
}
15400-
15401-
15402-
#ifdef __cplusplus
15403-
}
15404-
#endif

Python/dtoa.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,6 @@ typedef uint64_t ULLong;
172172
#define Bug(x) {fprintf(stderr, "%s\n", x); exit(1);}
173173
#endif
174174

175-
#ifdef __cplusplus
176-
extern "C" {
177-
#endif
178-
179175
typedef union { double d; ULong L[2]; } U;
180176

181177
#ifdef IEEE_8087
@@ -2813,8 +2809,5 @@ _Py_dg_dtoa(double dd, int mode, int ndigits,
28132809
_Py_dg_freedtoa(s0);
28142810
return NULL;
28152811
}
2816-
#ifdef __cplusplus
2817-
}
2818-
#endif
28192812

28202813
#endif // _PY_SHORT_FLOAT_REPR == 1

Python/errors.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@
1616
# include <stdlib.h> // _sys_nerr
1717
#endif
1818

19-
20-
#ifdef __cplusplus
21-
extern "C" {
22-
#endif
23-
2419
/* Forward declarations */
2520
static PyObject *
2621
_PyErr_FormatV(PyThreadState *tstate, PyObject *exception,
@@ -1918,7 +1913,3 @@ PyErr_ProgramTextObject(PyObject *filename, int lineno)
19181913
{
19191914
return _PyErr_ProgramDecodedTextObject(filename, lineno, NULL);
19201915
}
1921-
1922-
#ifdef __cplusplus
1923-
}
1924-
#endif

Python/getargs.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
#include "pycore_pylifecycle.h" // _PyArg_Fini
88
#include "pycore_tuple.h" // _PyTuple_ITEMS()
99

10-
#ifdef __cplusplus
11-
extern "C" {
12-
#endif
13-
1410
/* Export Stable ABIs (abi only) */
1511
PyAPI_FUNC(int) _PyArg_Parse_SizeT(PyObject *, const char *, ...);
1612
PyAPI_FUNC(int) _PyArg_ParseTuple_SizeT(PyObject *, const char *, ...);
@@ -2867,7 +2863,3 @@ _PyArg_Fini(void)
28672863
}
28682864
_PyRuntime.getargs.static_parsers = NULL;
28692865
}
2870-
2871-
#ifdef __cplusplus
2872-
};
2873-
#endif

0 commit comments

Comments
 (0)