Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions Include/cpython/slp_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,6 @@ typedef struct _tasklet_flags {
unsigned int pending_irq: SLP_TASKLET_FLAGS_BITS_pending_irq;
} PyTaskletFlagStruc;

/* a partial copy of PyThreadState. Used to preserve
the state of a hard switched tasklet */
typedef struct _tasklet_tstate {
int tracing;
Py_tracefunc c_profilefunc;
Py_tracefunc c_tracefunc;
PyObject *c_profileobj;
PyObject *c_traceobj;
} PyTaskletTStateStruc;

typedef struct _tasklet {
PyObject_HEAD
struct _tasklet *next;
Expand All @@ -133,9 +123,20 @@ typedef struct _tasklet {
int recursion_depth;
PyObject *def_globals;
PyObject *tsk_weakreflist;
/* If the tasklet is current: NULL. (The context of a current tasklet is always in ts->tasklet.)
/* If the tasklet is current: NULL. (The context of a current tasklet is
* always in ts->context.)
* If the tasklet is not current: the context for the tasklet */
PyObject *context;

/* If the tasklet is current: NULL. (The profile and tracing state of a
* current tasklet is stored in the thread state.)
* If the tasklet is not current: the profile and tracing state for the tasklet.
*/
Py_tracefunc profilefunc;
Py_tracefunc tracefunc;
PyObject *profileobj;
PyObject *traceobj;
int tracing;
} PyTaskletObject;


Expand Down
3 changes: 0 additions & 3 deletions Include/internal/pycore_stackless.h
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,6 @@ PyAPI_FUNC(PyObject *) PyEval_EvalFrameEx_slp(struct _frame *, int, PyObject *);
/* eval_frame with stack overflow, triggered there with a macro */
PyObject * slp_eval_frame_newstack(struct _frame *f, int throwflag, PyObject *retval);

/* other eval_frame functions from module/scheduling.c */
PyObject * slp_restore_tracing(PyCFrameObject *cf, int exc, PyObject *retval);
/* other eval_frame functions from Objects/typeobject.c */
PyObject * slp_tp_init_callback(PyCFrameObject *cf, int exc, PyObject *retval);
/* functions related to pickling */
Expand Down Expand Up @@ -754,7 +752,6 @@ int slp_prepare_slots(PyTypeObject*);
Py_tracefunc slp_get_sys_profile_func(void);
Py_tracefunc slp_get_sys_trace_func(void);
int slp_encode_ctrace_functions(Py_tracefunc c_tracefunc, Py_tracefunc c_profilefunc);
PyTaskletTStateStruc * slp_get_saved_tstate(PyTaskletObject *task);

/*
* Channel related prototypes
Expand Down
2 changes: 1 addition & 1 deletion Lib/stackless.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def _tasklet_get_unpicklable_state(tasklet):

flags = pickle_flags(PICKLEFLAGS_PICKLE_CONTEXT, PICKLEFLAGS_PICKLE_CONTEXT)
try:
return {'context': tasklet.__reduce__()[2][8]}
return {'context': tasklet.__reduce__()[2][12]}
finally:
pickle_flags(flags, PICKLEFLAGS_PICKLE_CONTEXT)

Expand Down
5 changes: 5 additions & 0 deletions Stackless/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ What's New in Stackless 3.X.X?

*Release date: 20XX-XX-XX*

- https://github.com/stackless-dev/stackless/issues/281
Per tasklet profiling and tracing state information is now stored in the
tasklet itself. This increases the size of tasklet objects a bit, but saves a
lot of code.

- https://github.com/stackless-dev/stackless/issues/284
Stackless supports pickling functions. But previous versions of Stackless
only pickled the following attributes of a function-object: '__code__',
Expand Down
Loading