Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0b1ec19

Browse files
committed
Don't potentially leak executor
1 parent 773e016 commit 0b1ec19

File tree

5 files changed

+17
-7
lines changed

5 files changed

+17
-7
lines changed

Include/cpython/pyatomic_msc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ _Py_atomic_load_uintptr_acquire(const uintptr_t *obj)
922922
#elif defined(_M_ARM64)
923923
return (uintptr_t)__ldar64((unsigned __int64 volatile *)obj);
924924
#else
925-
# error "no implementation of _Py_atomic_load_ptr_acquire"
925+
# error "no implementation of _Py_atomic_load_uintptr_acquire"
926926
#endif
927927
}
928928

@@ -947,7 +947,7 @@ _Py_atomic_store_uintptr_release(uintptr_t *obj, uintptr_t value)
947947
_Py_atomic_ASSERT_ARG_TYPE(unsigned __int64);
948948
__stlr64((unsigned __int64 volatile *)obj, (unsigned __int64)value);
949949
#else
950-
# error "no implementation of _Py_atomic_store_int_release"
950+
# error "no implementation of _Py_atomic_store_uintptr_release"
951951
#endif
952952
}
953953

Python/bytecodes.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2391,6 +2391,12 @@ dummy_func(
23912391
};
23922392

23932393
tier1 inst(ENTER_EXECUTOR, (--)) {
2394+
CHECK_EVAL_BREAKER();
2395+
if (this_instr->op.code != ENTER_EXECUTOR) {
2396+
next_instr = this_instr;
2397+
DISPATCH();
2398+
}
2399+
23942400
PyCodeObject *code = _PyFrame_GetCode(frame);
23952401
_PyExecutorObject *executor = code->co_executors->executors[oparg & 255];
23962402
assert(executor->vm_data.index == INSTR_OFFSET() - 1);
@@ -2399,7 +2405,6 @@ dummy_func(
23992405
assert(tstate->previous_executor == NULL);
24002406
tstate->previous_executor = Py_None;
24012407
Py_INCREF(executor);
2402-
CHECK_EVAL_BREAKER();
24032408
GOTO_TIER_TWO(executor);
24042409
}
24052410

Python/generated_cases.c.h

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/instrumentation.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
assert(!_PyInterpreterState_GET()->stoptheworld.world_stopped); \
4343
Py_BEGIN_CRITICAL_SECTION(code)
4444

45-
#define UNLOCK_CODE(code) Py_END_CRITICAL_SECTION()
45+
#define UNLOCK_CODE() Py_END_CRITICAL_SECTION()
4646

4747
#else
4848

Python/legacy_tracing.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ _PyEval_SetTrace(PyThreadState *tstate, Py_tracefunc func, PyObject *arg)
586586
// needs to be decref'd outside of the lock
587587
PyObject *old_traceobj;
588588
LOCK_SETUP();
589-
int tracing_threads = setup_tracing(tstate, func, arg, &old_traceobj);
589+
Py_ssize_t tracing_threads = setup_tracing(tstate, func, arg, &old_traceobj);
590590
UNLOCK_SETUP();
591591
Py_XDECREF(old_traceobj);
592592
if (tracing_threads < 0) {

0 commit comments

Comments
 (0)