@@ -747,7 +747,8 @@ free_threadstate(PyThreadState *tstate)
747
747
*/
748
748
749
749
static void
750
- init_threadstate (PyThreadState * tstate , PyInterpreterState * interp , uint64_t id ,
750
+ init_threadstate (PyThreadState * tstate ,
751
+ PyInterpreterState * interp , uint64_t id ,
751
752
PyThreadState * next )
752
753
{
753
754
if (tstate -> _initialized ) {
@@ -795,11 +796,6 @@ new_threadstate(PyInterpreterState *interp)
795
796
PyThreadState * tstate ;
796
797
_PyRuntimeState * runtime = interp -> runtime ;
797
798
798
- _PyStackChunk * datastack_chunk = allocate_chunk (DATA_STACK_CHUNK_SIZE , NULL );
799
- if (datastack_chunk == NULL ) {
800
- return NULL ;
801
- }
802
-
803
799
/* We serialize concurrent creation to protect global state. */
804
800
HEAD_LOCK (runtime );
805
801
@@ -836,7 +832,6 @@ new_threadstate(PyInterpreterState *interp)
836
832
837
833
error :
838
834
HEAD_UNLOCK (runtime );
839
- _PyObject_VirtualFree (datastack_chunk , datastack_chunk -> size );
840
835
return NULL ;
841
836
}
842
837
@@ -2196,9 +2191,9 @@ push_chunk(PyThreadState *tstate, int size)
2196
2191
}
2197
2192
tstate -> datastack_chunk = new ;
2198
2193
tstate -> datastack_limit = (PyObject * * )(((char * )new ) + allocate_size );
2199
- // When new is the "root" chunk (new->previous == NULL), we keep
2194
+ // When new is the "root" chunk (i.e. new->previous == NULL), we can keep
2200
2195
// _PyThreadState_PopFrame from freeing it later by "skipping" over the
2201
- // first element.
2196
+ // first element:
2202
2197
PyObject * * res = & new -> data [new -> previous == NULL ];
2203
2198
tstate -> datastack_top = res + size ;
2204
2199
return res ;
0 commit comments