Skip to content

Commit ce6bd79

Browse files
minor fixes
1 parent 2369941 commit ce6bd79

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

Modules/_testcapimodule.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,7 @@ pending_threadfunc(PyObject *self, PyObject *arg, PyObject *kwargs)
861861
unsigned int num_added = 0;
862862
for (; num_added < num; num_added++) {
863863
if (Py_AddPendingCall(&_pending_callback, callable) < 0) {
864+
// out of memory and freelist is empty
864865
break;
865866
}
866867
}

Python/ceval_gil.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,6 +1085,8 @@ Py_MakePendingCalls(void)
10851085
void
10861086
_PyEval_InitState(PyInterpreterState *interp)
10871087
{
1088+
// Fill the pending freelist so that signal handlers can safely
1089+
// add pending calls without needing to allocate memory.
10881090
struct _pending_calls *pending = &interp->ceval.pending;
10891091
PyMutex_Lock(&pending->mutex);
10901092
fill_pending_freelist(pending);

0 commit comments

Comments
 (0)