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

Commit ab037cb

Browse files
author
Anselm Kruis
committed
Stackless issue #152: Cleanups, no functional change
Preparations: - use meaningful variable names - remove dead code - move the stackless addition to PyThreadState to the end of the struct - remove redundant declarations from stackless_structs.h
1 parent 245a802 commit ab037cb

File tree

5 files changed

+9
-20
lines changed

5 files changed

+9
-20
lines changed

Include/pystate.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,6 @@ typedef struct _ts {
189189
int trash_delete_nesting;
190190
PyObject *trash_delete_later;
191191

192-
#ifdef STACKLESS
193-
PyStacklessState st;
194-
#endif
195-
196192
/* Called when a thread state is deleted normally, but not when it
197193
* is destroyed after fork().
198194
* Pain: to prevent rare but fatal shutdown errors (issue 18808),
@@ -227,6 +223,9 @@ PyStacklessState st;
227223

228224
/* XXX signal handlers should also be here */
229225

226+
#ifdef STACKLESS
227+
PyStacklessState st;
228+
#endif
230229
} PyThreadState;
231230
#endif
232231

Objects/typeobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3641,7 +3641,7 @@ excess_args(PyObject *args, PyObject *kwds)
36413641
}
36423642

36433643
#ifdef STACKLESS
3644-
int generic_init(PyObject *ob, PyObject *args, PyObject *kwds);
3644+
int slp_generic_init(PyObject *ob, PyObject *args, PyObject *kwds);
36453645
#endif
36463646

36473647
static int
@@ -3650,7 +3650,7 @@ object_init(PyObject *self, PyObject *args, PyObject *kwds)
36503650
PyTypeObject *type = Py_TYPE(self);
36513651
#ifdef STACKLESS
36523652
/* The following checking clashes with Stackless unpickling. */
3653-
if (type->tp_init == generic_init)
3653+
if (type->tp_init == slp_generic_init)
36543654
type = type->tp_base;
36553655
#endif
36563656
if (excess_args(args, kwds)) {

Stackless/core/slp_transfer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ extern int slp_switch(void);
8181
#endif
8282

8383
/* a write only variable used to prevent overly optimisation */
84-
intptr_t *global_goobledigoobs;
84+
intptr_t *_dont_optimise_away_goobledigoobs;
8585
static int
8686
climb_stack_and_transfer(PyCStackObject **cstprev, PyCStackObject *cst,
8787
PyTaskletObject *prev)
@@ -104,7 +104,7 @@ climb_stack_and_transfer(PyCStackObject **cstprev, PyCStackObject *cst,
104104
/* hinder the compiler to optimise away
105105
goobledigoobs and the alloca call.
106106
This happens with gcc 4.7.x and -O2 */
107-
global_goobledigoobs = goobledigoobs;
107+
_dont_optimise_away_goobledigoobs = goobledigoobs;
108108
}
109109
return slp_transfer(cstprev, cst, prev);
110110
}

Stackless/core/stackless_structs.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -256,16 +256,6 @@ PyAPI_DATA(PyTypeObject) PyChannel_Type;
256256
#define PyChannel_Check(op) PyObject_TypeCheck(op, &PyChannel_Type)
257257
#define PyChannel_CheckExact(op) (Py_TYPE(op) == PyChannel_TypePtr)
258258

259-
/*** these are in other bits of C-Python(r) ***/
260-
PyAPI_DATA(PyTypeObject) PyDictIterKey_Type;
261-
PyAPI_DATA(PyTypeObject) PyDictIterValue_Type;
262-
PyAPI_DATA(PyTypeObject) PyDictIterItem_Type;
263-
PyAPI_DATA(PyTypeObject) PyListIter_Type;
264-
PyAPI_DATA(PyTypeObject) PySetIter_Type;
265-
PyAPI_DATA(PyTypeObject) PyRangeIter_Type;
266-
PyAPI_DATA(PyTypeObject) PyTupleIter_Type;
267-
PyAPI_DATA(PyTypeObject) PyEnum_Type;
268-
269259
#ifdef __cplusplus
270260
}
271261
#endif

Stackless/pickling/prickelpit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ generic_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
6161
}
6262

6363
int
64-
generic_init(PyObject *ob, PyObject *args, PyObject *kwds)
64+
slp_generic_init(PyObject *ob, PyObject *args, PyObject *kwds)
6565
{
6666

6767
initproc init = Py_TYPE(ob)->tp_base->tp_init;
@@ -185,7 +185,7 @@ static struct _typeobject wrap_##type = { \
185185
0, /* tp_descr_get */ \
186186
0, /* tp_descr_set */ \
187187
0, /* tp_dictoffset */ \
188-
generic_init, /* tp_init */ \
188+
slp_generic_init, /* tp_init */ \
189189
0, /* tp_alloc */ \
190190
newfunc, /* tp_new */ \
191191
0, /* tp_free */ \

0 commit comments

Comments
 (0)