Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Include/cpython/optimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ PyAPI_FUNC(_PyExecutorObject *) PyUnstable_GetExecutor(PyCodeObject *code, int o

void _Py_ExecutorInit(_PyExecutorObject *, const _PyBloomFilter *);
void _Py_ExecutorDetach(_PyExecutorObject *);
int _Py_ExecutorClear(_PyExecutorObject *);
void _Py_BloomFilter_Init(_PyBloomFilter *);
void _Py_BloomFilter_Add(_PyBloomFilter *bloom, void *obj);
PyAPI_FUNC(void) _Py_Executor_DependsOn(_PyExecutorObject *executor, void *obj);
Expand Down
2 changes: 1 addition & 1 deletion Objects/codeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1607,7 +1607,7 @@ clear_executors(PyCodeObject *co)
assert(co->co_executors);
for (int i = 0; i < co->co_executors->size; i++) {
if (co->co_executors->executors[i]) {
_Py_ExecutorDetach(co->co_executors->executors[i]);
_Py_ExecutorClear(co->co_executors->executors[i]);
assert(co->co_executors->executors[i] == NULL);
}
}
Expand Down
10 changes: 8 additions & 2 deletions Python/optimizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1617,8 +1617,9 @@ _Py_ExecutorDetach(_PyExecutorObject *executor)
Py_DECREF(executor);
}

static int
executor_clear(_PyExecutorObject *executor)

int
_Py_ExecutorClear(_PyExecutorObject *executor)
{
if (!executor->vm_data.valid) {
return 0;
Expand All @@ -1644,6 +1645,11 @@ executor_clear(_PyExecutorObject *executor)
Py_DECREF(executor);
return 0;
}
static int
executor_clear(_PyExecutorObject *executor)
{
return _Py_ExecutorClear(executor);
}

void
_Py_Executor_DependsOn(_PyExecutorObject *executor, void *obj)
Expand Down