Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit 9f4e976

Browse files
Anselm KruisAnselm Kruis
Anselm Kruis
authored and
Anselm Kruis
committed
Stackless issue #295: add prefix "_slp" to structure names
Add prefix "_slp" to structure names without a prefix. The following structs were renamed: _channel, _cframe, _tasklet, _unwindobject and _bomb. This fixes a build failure on Windows.
1 parent 2ef4ac4 commit 9f4e976

File tree

4 files changed

+42
-38
lines changed

4 files changed

+42
-38
lines changed

Include/cpython/slp_structs.h

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ extern "C" {
9191
#define SLP_TASKLET_FLAGS_OFFSET_pending_irq \
9292
(SLP_TASKLET_FLAGS_OFFSET_is_zombie + SLP_TASKLET_FLAGS_BITS_is_zombie)
9393

94-
typedef struct _tasklet_flags {
94+
typedef struct _slp_tasklet_flags {
9595
signed int blocked: SLP_TASKLET_FLAGS_BITS_blocked;
9696
unsigned int atomic: SLP_TASKLET_FLAGS_BITS_atomic;
9797
unsigned int ignore_nesting: SLP_TASKLET_FLAGS_BITS_ignore_nesting;
@@ -101,16 +101,16 @@ typedef struct _tasklet_flags {
101101
unsigned int pending_irq: SLP_TASKLET_FLAGS_BITS_pending_irq;
102102
} PyTaskletFlagStruc;
103103

104-
typedef struct _tasklet {
104+
typedef struct _slp_tasklet {
105105
PyObject_HEAD
106-
struct _tasklet *next;
107-
struct _tasklet *prev;
106+
struct _slp_tasklet *next;
107+
struct _slp_tasklet *prev;
108108
union {
109109
struct _frame *frame;
110110
struct _cframe *cframe;
111111
} f;
112112
PyObject *tempval;
113-
struct _cstack *cstate;
113+
struct _slp_cstack *cstate;
114114
/* Pointer to the top of the stack of the exceptions currently
115115
* being handled */
116116
_PyErr_StackItem *exc_info;
@@ -119,7 +119,7 @@ typedef struct _tasklet {
119119
*/
120120
_PyErr_StackItem exc_state;
121121
/* bits stuff */
122-
struct _tasklet_flags flags;
122+
struct _slp_tasklet_flags flags;
123123
int recursion_depth;
124124
PyObject *def_globals;
125125
PyObject *tsk_weakreflist;
@@ -142,15 +142,15 @@ typedef struct _tasklet {
142142

143143
/*** important structures: cstack ***/
144144

145-
typedef struct _cstack {
145+
typedef struct _slp_cstack {
146146
PyObject_VAR_HEAD
147-
struct _cstack *next;
148-
struct _cstack *prev;
147+
struct _slp_cstack *next;
148+
struct _slp_cstack *prev;
149149
PY_LONG_LONG serial;
150150
/* A borrowed reference to the tasklet, that owns this cstack. NULL after
151151
* the stack has been restored. Always NULL for an initial stub.
152152
*/
153-
struct _tasklet *task;
153+
struct _slp_tasklet *task;
154154
int nesting_level;
155155
PyThreadState *tstate;
156156
#ifdef SLP_SEH32
@@ -179,7 +179,7 @@ typedef struct _cstack {
179179

180180
/*** important structures: bomb ***/
181181

182-
typedef struct _bomb {
182+
typedef struct _slp_bomb {
183183
PyObject_HEAD
184184
PyObject *curexc_type;
185185
PyObject *curexc_value;
@@ -221,24 +221,24 @@ typedef struct _bomb {
221221
#define SLP_CHANNEL_FLAGS_OFFSET_schedule_all \
222222
(SLP_CHANNEL_FLAGS_OFFSET_preference + SLP_CHANNEL_FLAGS_BITS_preference)
223223

224-
typedef struct _channel_flags {
224+
typedef struct _slp_channel_flags {
225225
unsigned int closing: SLP_CHANNEL_FLAGS_BITS_closing;
226226
signed int preference: SLP_CHANNEL_FLAGS_BITS_preference;
227227
unsigned int schedule_all: SLP_CHANNEL_FLAGS_BITS_schedule_all;
228228
} PyChannelFlagStruc;
229229

230-
typedef struct _channel {
230+
typedef struct _slp_channel {
231231
PyObject_HEAD
232232
/* make sure that these fit tasklet's next/prev */
233-
struct _tasklet *head;
234-
struct _tasklet *tail;
233+
struct _slp_tasklet *head;
234+
struct _slp_tasklet *tail;
235235
int balance;
236-
struct _channel_flags flags;
236+
struct _slp_channel_flags flags;
237237
PyObject *chan_weakreflist;
238238
} PyChannelObject;
239239

240-
struct _cframe;
241-
typedef PyObject *(PyFrame_ExecFunc) (struct _cframe *, int, PyObject *);
240+
struct _slp_cframe;
241+
typedef PyObject *(PyFrame_ExecFunc) (struct _slp_cframe *, int, PyObject *);
242242
/*
243243
* How to write frame execution functions:
244244
*
@@ -259,7 +259,7 @@ typedef PyObject *(PyFrame_ExecFunc) (struct _cframe *, int, PyObject *);
259259

260260
/*** important stuctures: cframe ***/
261261

262-
typedef struct _cframe {
262+
typedef struct _slp_cframe {
263263
PyObject_VAR_HEAD
264264
struct _frame *f_back; /* previous frame, or NULL */
265265

@@ -278,18 +278,18 @@ typedef struct _cframe {
278278
void *any2;
279279
} PyCFrameObject;
280280

281-
typedef struct _unwindobject {
281+
typedef struct _slp_unwindobject {
282282
PyObject_HEAD
283283
} PyUnwindObject;
284284

285285

286286
#else /* #ifdef SLP_BUILD_CORE */
287287

288-
typedef struct _channel PyChannelObject;
289-
typedef struct _cframe PyCFrameObject;
290-
typedef struct _tasklet PyTaskletObject;
291-
typedef struct _unwindobject PyUnwindObject;
292-
typedef struct _bomb PyBombObject;
288+
typedef struct _slp_channel PyChannelObject;
289+
typedef struct _slp_cframe PyCFrameObject;
290+
typedef struct _slp_tasklet PyTaskletObject;
291+
typedef struct _slp_unwindobject PyUnwindObject;
292+
typedef struct _slp_bomb PyBombObject;
293293

294294
#endif /* #ifdef SLP_BUILD_CORE */
295295

Include/cpython/slp_tstate.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
#ifndef Py_LIMITED_API
44

55
/* forward declarations */
6-
struct _cstack;
7-
struct _bomb;
8-
struct _tasklet;
6+
struct _slp_cstack;
7+
struct _slp_bomb;
8+
struct _slp_tasklet;
99
struct _ts;
1010

11-
typedef int (slp_schedule_hook_func) (struct _tasklet *from, struct _tasklet *to);
11+
typedef int (slp_schedule_hook_func) (struct _slp_tasklet *from, struct _slp_tasklet *to);
1212

1313
struct _frame; /* Avoid including frameobject.h */
1414

@@ -22,15 +22,15 @@ typedef struct _sts {
2222
PY_LONG_LONG serial;
2323
PY_LONG_LONG serial_last_jump;
2424
/* the blueprint for new stacks */
25-
struct _cstack *initial_stub;
25+
struct _slp_cstack *initial_stub;
2626
/* the base address for hijacking stacks. XXX deprecating */
2727
intptr_t *cstack_base;
2828
/* stack overflow check and init flag */
2929
intptr_t *cstack_root;
3030
/* main tasklet */
31-
struct _tasklet *main;
31+
struct _slp_tasklet *main;
3232
/* runnable tasklets */
33-
struct _tasklet *current;
33+
struct _slp_tasklet *current;
3434

3535
/* scheduling */
3636
long tick_counter;

Include/internal/pycore_slp_pystate.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
#endif
2828

2929
typedef struct {
30-
struct _cstack * cstack_chain; /* the chain of all C-stacks of this interpreter. This is an uncounted/borrowed ref. */
30+
struct _slp_cstack * cstack_chain; /* the chain of all C-stacks of this interpreter. This is an uncounted/borrowed ref. */
3131
PyObject * reduce_frame_func; /* a function used to pickle frames */
3232
PyObject * error_handler; /* the Stackless error handler */
3333
PyObject * channel_hook; /* the channel callback function */
34-
struct _bomb * mem_bomb; /* a permanent bomb to use for memory errors */
34+
struct _slp_bomb * mem_bomb; /* a permanent bomb to use for memory errors */
3535
PyObject * schedule_hook; /* the schedule callback function */
3636
slp_schedule_hook_func * schedule_fasthook; /* the fast C-only schedule_hook */
3737
struct _ts * initial_tstate; /* recording the main thread state */
@@ -83,15 +83,15 @@ struct _stackless_runtime_state {
8383

8484
/* Used to manage free C-stack objects, see stacklesseval.c */
8585
int cstack_cachecount;
86-
struct _cstack *cstack_cache[SLP_CSTACK_SLOTS];
86+
struct _slp_cstack *cstack_cache[SLP_CSTACK_SLOTS];
8787

8888
/*
8989
* Used during a hard switch.
9090
*/
9191
struct {
92-
struct _cstack **cstprev;
93-
struct _cstack *cst;
94-
struct _tasklet *prev;
92+
struct _slp_cstack **cstprev;
93+
struct _slp_cstack *cst;
94+
struct _slp_tasklet *prev;
9595
} transfer;
9696
};
9797

Stackless/changelog.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ What's New in Stackless 3.X.X?
99

1010
*Release date: 20XX-XX-XX*
1111

12+
- https://github.com/stackless-dev/stackless/issues/295
13+
Add prefix "_slp" to structure names without a prefix. The following structs
14+
were renamed: _channel, _cframe, _tasklet, _unwindobject and _bomb.
15+
1216
- https://github.com/stackless-dev/stackless/issues/290
1317
The newly added PEP-590 Vectorcall protocol (bpo-36974) requires changes to
1418
the Stackless protocol. The new mcros STACKLESS_VECTORCALL_xxx() must be used

0 commit comments

Comments
 (0)