mirror of
https://github.com/python/cpython.git
synced 2025-11-24 12:20:42 +00:00
[3.14] gh-137400: Fix a crash when disabling profiling across all threads (gh-137471) (#137648)
Some checks are pending
Tests / (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if the ABI has changed (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Sanitizers (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
Some checks are pending
Tests / (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if the ABI has changed (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Sanitizers (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
Co-authored-by: Sam Gross <colesbury@gmail.com>
This commit is contained in:
parent
4dda1768be
commit
4ebd928b00
3 changed files with 46 additions and 2 deletions
|
|
@ -484,13 +484,16 @@ setup_profile(PyThreadState *tstate, Py_tracefunc func, PyObject *arg, PyObject
|
|||
}
|
||||
}
|
||||
|
||||
_PyEval_StopTheWorld(tstate->interp);
|
||||
int delta = (func != NULL) - (tstate->c_profilefunc != NULL);
|
||||
tstate->c_profilefunc = func;
|
||||
*old_profileobj = tstate->c_profileobj;
|
||||
tstate->c_profileobj = Py_XNewRef(arg);
|
||||
tstate->interp->sys_profiling_threads += delta;
|
||||
assert(tstate->interp->sys_profiling_threads >= 0);
|
||||
return tstate->interp->sys_profiling_threads;
|
||||
Py_ssize_t profiling_threads = tstate->interp->sys_profiling_threads;
|
||||
_PyEval_StartTheWorld(tstate->interp);
|
||||
return profiling_threads;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
@ -581,13 +584,16 @@ setup_tracing(PyThreadState *tstate, Py_tracefunc func, PyObject *arg, PyObject
|
|||
}
|
||||
}
|
||||
|
||||
_PyEval_StopTheWorld(tstate->interp);
|
||||
int delta = (func != NULL) - (tstate->c_tracefunc != NULL);
|
||||
tstate->c_tracefunc = func;
|
||||
*old_traceobj = tstate->c_traceobj;
|
||||
tstate->c_traceobj = Py_XNewRef(arg);
|
||||
tstate->interp->sys_tracing_threads += delta;
|
||||
assert(tstate->interp->sys_tracing_threads >= 0);
|
||||
return tstate->interp->sys_tracing_threads;
|
||||
Py_ssize_t tracing_threads = tstate->interp->sys_tracing_threads;
|
||||
_PyEval_StartTheWorld(tstate->interp);
|
||||
return tracing_threads;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue