Skip to content

Commit e982d8b

Browse files
authored
bpo-38353: Fix compiler warning in internal headers (GH-16573)
Replace "_PyRuntimeState" with "struct pyruntimestate" to avoid a warning on typedef re-definition.
1 parent c515b57 commit e982d8b

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

Include/internal/pycore_ceval.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ extern "C" {
99
#endif
1010

1111
/* Forward declarations */
12-
typedef struct pyruntimestate _PyRuntimeState;
12+
struct pyruntimestate;
1313
struct _ceval_runtime_state;
1414

15-
PyAPI_FUNC(void) _Py_FinishPendingCalls(_PyRuntimeState *runtime);
15+
PyAPI_FUNC(void) _Py_FinishPendingCalls(struct pyruntimestate *runtime);
1616
PyAPI_FUNC(void) _PyEval_Initialize(struct _ceval_runtime_state *);
1717
PyAPI_FUNC(void) _PyEval_FiniThreads(
1818
struct _ceval_runtime_state *ceval);
@@ -26,7 +26,7 @@ PyAPI_FUNC(int) _PyEval_AddPendingCall(
2626
PyAPI_FUNC(void) _PyEval_SignalAsyncExc(
2727
struct _ceval_runtime_state *ceval);
2828
PyAPI_FUNC(void) _PyEval_ReInitThreads(
29-
_PyRuntimeState *runtime);
29+
struct pyruntimestate *runtime);
3030
PyAPI_FUNC(void) _PyEval_SetCoroutineOriginTrackingDepth(
3131
PyThreadState *tstate,
3232
int new_depth);

Include/internal/pycore_pylifecycle.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ extern "C" {
99
#endif
1010

1111
/* Forward declarations */
12-
typedef struct _PyArgv _PyArgv;
13-
typedef struct pyruntimestate _PyRuntimeState;
12+
struct _PyArgv;
13+
struct pyruntimestate;
1414

1515
/* True if the main interpreter thread exited due to an unhandled
1616
* KeyboardInterrupt exception, suggesting the user pressed ^C. */
@@ -38,14 +38,14 @@ extern PyStatus _PyFaulthandler_Init(int enable);
3838
extern int _PyTraceMalloc_Init(int enable);
3939
extern PyObject * _PyBuiltin_Init(PyThreadState *tstate);
4040
extern PyStatus _PySys_Create(
41-
_PyRuntimeState *runtime,
41+
struct pyruntimestate *runtime,
4242
PyThreadState *tstate,
4343
PyObject **sysmod_p);
4444
extern PyStatus _PySys_SetPreliminaryStderr(PyObject *sysdict);
4545
extern PyStatus _PySys_ReadPreinitWarnOptions(PyWideStringList *options);
4646
extern PyStatus _PySys_ReadPreinitXOptions(PyConfig *config);
4747
extern int _PySys_InitMain(
48-
_PyRuntimeState *runtime,
48+
struct pyruntimestate *runtime,
4949
PyThreadState *tstate);
5050
extern PyStatus _PyImport_Init(PyThreadState *tstate);
5151
extern PyStatus _PyExc_Init(void);
@@ -78,7 +78,7 @@ extern void PyOS_FiniInterrupts(void);
7878
extern void _PyExc_Fini(void);
7979
extern void _PyImport_Fini(void);
8080
extern void _PyImport_Fini2(void);
81-
extern void _PyGC_Fini(_PyRuntimeState *runtime);
81+
extern void _PyGC_Fini(struct pyruntimestate *runtime);
8282
extern void _PyType_Fini(void);
8383
extern void _Py_HashRandomization_Fini(void);
8484
extern void _PyUnicode_Fini(void);
@@ -89,18 +89,18 @@ extern void _PyTraceMalloc_Fini(void);
8989
extern void _PyWarnings_Fini(PyInterpreterState *interp);
9090

9191
extern void _PyGILState_Init(
92-
_PyRuntimeState *runtime,
92+
struct pyruntimestate *runtime,
9393
PyThreadState *tstate);
94-
extern void _PyGILState_Fini(_PyRuntimeState *runtime);
94+
extern void _PyGILState_Fini(struct pyruntimestate *runtime);
9595

96-
PyAPI_FUNC(void) _PyGC_DumpShutdownStats(_PyRuntimeState *runtime);
96+
PyAPI_FUNC(void) _PyGC_DumpShutdownStats(struct pyruntimestate *runtime);
9797

9898
PyAPI_FUNC(PyStatus) _Py_PreInitializeFromPyArgv(
9999
const PyPreConfig *src_config,
100-
const _PyArgv *args);
100+
const struct _PyArgv *args);
101101
PyAPI_FUNC(PyStatus) _Py_PreInitializeFromConfig(
102102
const PyConfig *config,
103-
const _PyArgv *args);
103+
const struct _PyArgv *args);
104104

105105

106106
PyAPI_FUNC(int) _Py_HandleSystemExit(int *exitcode_p);
@@ -111,7 +111,7 @@ PyAPI_FUNC(void) _PyErr_Print(PyThreadState *tstate);
111111
PyAPI_FUNC(void) _PyErr_Display(PyObject *file, PyObject *exception,
112112
PyObject *value, PyObject *tb);
113113

114-
PyAPI_FUNC(void) _PyThreadState_DeleteCurrent(_PyRuntimeState *runtime);
114+
PyAPI_FUNC(void) _PyThreadState_DeleteCurrent(struct pyruntimestate *runtime);
115115

116116
#ifdef __cplusplus
117117
}

Include/internal/pycore_traceback.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ extern "C" {
99
#endif
1010

1111
/* Forward declaration */
12-
typedef struct _is PyInterpreterState;
12+
struct _is;
1313

1414
/* Write the Python traceback into the file 'fd'. For example:
1515
@@ -57,7 +57,7 @@ PyAPI_FUNC(void) _Py_DumpTraceback(
5757

5858
PyAPI_FUNC(const char*) _Py_DumpTracebackThreads(
5959
int fd,
60-
PyInterpreterState *interp,
60+
struct _is *interp,
6161
PyThreadState *current_tstate);
6262

6363
/* Write a Unicode object into the file descriptor fd. Encode the string to

0 commit comments

Comments
 (0)