Skip to content

Commit 32f0c82

Browse files
authored
bpo-45459: Use type names in the internal C API (GH-31669)
Replace "struct xxx" with "xxx" types in the internal C API.
1 parent 0b63215 commit 32f0c82

File tree

5 files changed

+11
-14
lines changed

5 files changed

+11
-14
lines changed

Include/internal/pycore_interp.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ struct atexit_state {
7979
*/
8080
struct _is {
8181

82-
struct _is *next;
82+
PyInterpreterState *next;
8383

8484
struct pythreads {
8585
uint64_t next_unique_id;
8686
/* The linked list of threads, newest first. */
87-
struct _ts *head;
87+
PyThreadState *head;
8888
/* Used in Modules/_threadmodule.c. */
8989
long count;
9090
/* Support for runtime thread stack size tuning.
@@ -190,7 +190,7 @@ struct _is {
190190
*/
191191

192192
/* the initial PyInterpreterState.threads.head */
193-
struct _ts _initial_thread;
193+
PyThreadState _initial_thread;
194194
};
195195

196196

@@ -214,11 +214,11 @@ struct _xidregitem {
214214
struct _xidregitem *next;
215215
};
216216

217-
PyAPI_FUNC(struct _is*) _PyInterpreterState_LookUpID(int64_t);
217+
PyAPI_FUNC(PyInterpreterState*) _PyInterpreterState_LookUpID(int64_t);
218218

219-
PyAPI_FUNC(int) _PyInterpreterState_IDInitref(struct _is *);
220-
PyAPI_FUNC(int) _PyInterpreterState_IDIncref(struct _is *);
221-
PyAPI_FUNC(void) _PyInterpreterState_IDDecref(struct _is *);
219+
PyAPI_FUNC(int) _PyInterpreterState_IDInitref(PyInterpreterState *);
220+
PyAPI_FUNC(int) _PyInterpreterState_IDIncref(PyInterpreterState *);
221+
PyAPI_FUNC(void) _PyInterpreterState_IDDecref(PyInterpreterState *);
222222

223223
#ifdef __cplusplus
224224
}

Include/internal/pycore_moduleobject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ extern "C" {
1111
typedef struct {
1212
PyObject_HEAD
1313
PyObject *md_dict;
14-
struct PyModuleDef *md_def;
14+
PyModuleDef *md_def;
1515
void *md_state;
1616
PyObject *md_weaklist;
1717
// for logging purposes after md_dict is cleared

Include/internal/pycore_pystate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ extern void _PySignal_AfterFork(void);
172172
PyAPI_FUNC(int) _PyState_AddModule(
173173
PyThreadState *tstate,
174174
PyObject* module,
175-
struct PyModuleDef* def);
175+
PyModuleDef* def);
176176

177177

178178
PyAPI_FUNC(int) _PyOS_InterruptOccurred(PyThreadState *tstate);

Include/internal/pycore_runtime.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ extern "C" {
1111
#include "pycore_atomic.h" /* _Py_atomic_address */
1212
#include "pycore_gil.h" // struct _gil_runtime_state
1313
#include "pycore_global_objects.h" // struct _Py_global_objects
14-
#include "pycore_interp.h" // struct _is
14+
#include "pycore_interp.h" // PyInterpreterState
1515
#include "pycore_unicodeobject.h" // struct _Py_unicode_runtime_ids
1616

1717

Include/internal/pycore_traceback.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ extern "C" {
88
# error "this header requires Py_BUILD_CORE define"
99
#endif
1010

11-
/* Forward declaration */
12-
struct _is;
13-
1411
/* Write the Python traceback into the file 'fd'. For example:
1512
1613
Traceback (most recent call first):
@@ -57,7 +54,7 @@ PyAPI_FUNC(void) _Py_DumpTraceback(
5754

5855
PyAPI_FUNC(const char*) _Py_DumpTracebackThreads(
5956
int fd,
60-
struct _is *interp,
57+
PyInterpreterState *interp,
6158
PyThreadState *current_tstate);
6259

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

0 commit comments

Comments
 (0)