Skip to content

Commit 1f390cf

Browse files
author
Anselm Kruis
committed
Issue python#104: global C variable slp_initial_tstate used before initialisation
Initialise slp_initial_tstate early, as in Stackless 2.7. https://bitbucket.org/stackless-dev/stackless/issues/104
1 parent 6d66c20 commit 1f390cf

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Stackless/changelog.txt

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

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

12+
- https://bitbucket.org/stackless-dev/stackless/issues/104
13+
Initialise the global variable slp_initial_tstate early before it is used.
14+
1215
- https://bitbucket.org/stackless-dev/stackless/issues/103
1316
Fix an invalid assertion during interpreter shutdown.
1417

Stackless/module/stacklessmodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,6 +1674,9 @@ static int init_stackless_methods(void)
16741674
int
16751675
_PyStackless_InitTypes(void)
16761676
{
1677+
/* record the thread state for thread support */
1678+
slp_initial_tstate = PyThreadState_GET();
1679+
16771680
if (0
16781681
|| init_stackless_methods()
16791682
|| PyType_Ready(&PyTasklet_Type) /* need this early for the main tasklet */
@@ -1710,9 +1713,6 @@ PyInit__stackless(void)
17101713
)
17111714
return NULL;
17121715

1713-
/* record the thread state for thread support */
1714-
slp_initial_tstate = PyThreadState_GET();
1715-
17161716
/* Create the module and add the functions */
17171717
slp_module = PyModule_Create(&stacklessmodule);
17181718
if (slp_module == NULL)

0 commit comments

Comments
 (0)