diff --git a/Stackless/changelog.txt b/Stackless/changelog.txt index 1fb1da9ad91bb5..239ac2a39300cc 100644 --- a/Stackless/changelog.txt +++ b/Stackless/changelog.txt @@ -9,6 +9,9 @@ What's New in Stackless 3.X.X? *Release date: 20XX-XX-XX* +- https://bitbucket.org/stackless-dev/stackless/issues/104 + Initialise the global variable slp_initial_tstate early before it is used. + - https://bitbucket.org/stackless-dev/stackless/issues/103 Fix an invalid assertion during interpreter shutdown. diff --git a/Stackless/module/stacklessmodule.c b/Stackless/module/stacklessmodule.c index 88d8e77756a13e..62b3789c481a98 100644 --- a/Stackless/module/stacklessmodule.c +++ b/Stackless/module/stacklessmodule.c @@ -137,7 +137,7 @@ PyThreadState *slp_initial_tstate = NULL; static void *slp_error_handler = NULL; -int +int slp_pickle_with_tracing_state() { PyObject *flag, *slp_module; @@ -315,7 +315,7 @@ PyStackless_GetCurrentId(void) PyThreadState *ts = PyThreadState_GET(); #endif PyTaskletObject *t = NULL; - /* if there is threadstate, and there is a main tasklet, then the + /* if there is threadstate, and there is a main tasklet, then the * "current" is the actively running tasklet. * If there isn't a "main", then the tasklet in "current" is merely a * runnable one @@ -1144,7 +1144,7 @@ build_args(char *format, va_list va) return PyTuple_New(0); if (args == NULL) return NULL; - + if (!PyTuple_Check(args)) { PyObject *a; a = PyTuple_New(1); @@ -1674,6 +1674,9 @@ static int init_stackless_methods(void) int _PyStackless_InitTypes(void) { + /* record the thread state for thread support */ + slp_initial_tstate = PyThreadState_GET(); + if (0 || init_stackless_methods() || PyType_Ready(&PyTasklet_Type) /* need this early for the main tasklet */ @@ -1710,9 +1713,6 @@ PyInit__stackless(void) ) return NULL; - /* record the thread state for thread support */ - slp_initial_tstate = PyThreadState_GET(); - /* Create the module and add the functions */ slp_module = PyModule_Create(&stacklessmodule); if (slp_module == NULL)