Skip to content

Commit

Permalink
Issue python#104: global C variable slp_initial_tstate used before in…
Browse files Browse the repository at this point in the history
…itialisation

Initialise slp_initial_tstate early, as in Stackless 2.7.

https://bitbucket.org/stackless-dev/stackless/issues/104
  • Loading branch information
Anselm Kruis committed Nov 28, 2016
1 parent 6d66c20 commit 1f390cf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Stackless/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
6 changes: 3 additions & 3 deletions Stackless/module/stacklessmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1f390cf

Please sign in to comment.