Bug report
The following code paths should probably returns some sort of exception status (possibly _PyStatus_NO_MEMORY()).
| PyInterpreterState*interp=PyInterpreterState_New(); |
| if (interp==NULL) { |
| *tstate_p=NULL; |
| return_PyStatus_OK(); |
| } |
| PyThreadState*tstate=_PyThreadState_New(interp, |
| _PyThreadState_WHENCE_INTERP); |
| if (tstate==NULL) { |
| PyInterpreterState_Delete(interp); |
| *tstate_p=NULL; |
| return_PyStatus_OK(); |
| } |
Note that PyInterpreterState_New() currently never returns NULL -- it calls Py_FatalError() instead -- but we should probably still handle that case as well.
_PyThreadState_New can return NULL when out of memory.
cc @ericsnowcurrently
Linked PRs
Bug report
The following code paths should probably returns some sort of exception status (possibly
_PyStatus_NO_MEMORY()).cpython/Python/pylifecycle.c
Lines 2084 to 2088 in a1551b4
cpython/Python/pylifecycle.c
Lines 2090 to 2096 in a1551b4
Note that
PyInterpreterState_New()currently never returns NULL -- it callsPy_FatalError()instead -- but we should probably still handle that case as well._PyThreadState_Newcan return NULL when out of memory.cc @ericsnowcurrently
Linked PRs