bpo-43760: Rename _PyThreadState_DisableTracing() (GH-29032)

* Rename _PyThreadState_DisableTracing()
  to _PyThreadState_PauseTracing()
* Rename _PyThreadState_ResetTracing()
  to _PyThreadState_ResumeTracing()
This commit is contained in:
Victor Stinner 2021-10-18 18:40:43 +02:00 committed by GitHub
parent 70945d57e7
commit 034f607906
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 11 deletions

View file

@ -134,13 +134,13 @@ PyAPI_FUNC(void) _PyThreadState_DeleteExcept(
PyThreadState *tstate); PyThreadState *tstate);
static inline void static inline void
_PyThreadState_DisableTracing(PyThreadState *tstate) _PyThreadState_PauseTracing(PyThreadState *tstate)
{ {
tstate->cframe->use_tracing = 0; tstate->cframe->use_tracing = 0;
} }
static inline void static inline void
_PyThreadState_ResetTracing(PyThreadState *tstate) _PyThreadState_ResumeTracing(PyThreadState *tstate)
{ {
int use_tracing = (tstate->c_tracefunc != NULL int use_tracing = (tstate->c_tracefunc != NULL
|| tstate->c_profilefunc != NULL); || tstate->c_profilefunc != NULL);

View file

@ -6165,7 +6165,7 @@ call_trace(Py_tracefunc func, PyObject *obj,
if (tstate->tracing) if (tstate->tracing)
return 0; return 0;
tstate->tracing++; tstate->tracing++;
_PyThreadState_DisableTracing(tstate); _PyThreadState_PauseTracing(tstate);
PyFrameObject *f = _PyFrame_GetFrameObject(frame); PyFrameObject *f = _PyFrame_GetFrameObject(frame);
if (f == NULL) { if (f == NULL) {
return -1; return -1;
@ -6179,7 +6179,7 @@ call_trace(Py_tracefunc func, PyObject *obj,
} }
result = func(obj, f, what, arg); result = func(obj, f, what, arg);
f->f_lineno = 0; f->f_lineno = 0;
_PyThreadState_ResetTracing(tstate); _PyThreadState_ResumeTracing(tstate);
tstate->tracing--; tstate->tracing--;
return result; return result;
} }
@ -6193,7 +6193,7 @@ _PyEval_CallTracing(PyObject *func, PyObject *args)
PyObject *result; PyObject *result;
tstate->tracing = 0; tstate->tracing = 0;
_PyThreadState_ResetTracing(tstate); _PyThreadState_ResumeTracing(tstate);
result = PyObject_Call(func, args, NULL); result = PyObject_Call(func, args, NULL);
tstate->tracing = save_tracing; tstate->tracing = save_tracing;
tstate->cframe->use_tracing = save_use_tracing; tstate->cframe->use_tracing = save_use_tracing;
@ -6250,7 +6250,7 @@ _PyEval_SetProfile(PyThreadState *tstate, Py_tracefunc func, PyObject *arg)
tstate->c_profilefunc = NULL; tstate->c_profilefunc = NULL;
tstate->c_profileobj = NULL; tstate->c_profileobj = NULL;
/* Must make sure that tracing is not ignored if 'profileobj' is freed */ /* Must make sure that tracing is not ignored if 'profileobj' is freed */
_PyThreadState_ResetTracing(tstate); _PyThreadState_ResumeTracing(tstate);
Py_XDECREF(profileobj); Py_XDECREF(profileobj);
Py_XINCREF(arg); Py_XINCREF(arg);
@ -6258,7 +6258,7 @@ _PyEval_SetProfile(PyThreadState *tstate, Py_tracefunc func, PyObject *arg)
tstate->c_profilefunc = func; tstate->c_profilefunc = func;
/* Flag that tracing or profiling is turned on */ /* Flag that tracing or profiling is turned on */
_PyThreadState_ResetTracing(tstate); _PyThreadState_ResumeTracing(tstate);
return 0; return 0;
} }
@ -6291,7 +6291,7 @@ _PyEval_SetTrace(PyThreadState *tstate, Py_tracefunc func, PyObject *arg)
tstate->c_tracefunc = NULL; tstate->c_tracefunc = NULL;
tstate->c_traceobj = NULL; tstate->c_traceobj = NULL;
/* Must make sure that profiling is not ignored if 'traceobj' is freed */ /* Must make sure that profiling is not ignored if 'traceobj' is freed */
_PyThreadState_ResetTracing(tstate); _PyThreadState_ResumeTracing(tstate);
Py_XDECREF(traceobj); Py_XDECREF(traceobj);
Py_XINCREF(arg); Py_XINCREF(arg);
@ -6299,7 +6299,7 @@ _PyEval_SetTrace(PyThreadState *tstate, Py_tracefunc func, PyObject *arg)
tstate->c_tracefunc = func; tstate->c_tracefunc = func;
/* Flag that tracing or profiling is turned on */ /* Flag that tracing or profiling is turned on */
_PyThreadState_ResetTracing(tstate); _PyThreadState_ResumeTracing(tstate);
return 0; return 0;
} }

View file

@ -1205,14 +1205,14 @@ void
PyThreadState_EnterTracing(PyThreadState *tstate) PyThreadState_EnterTracing(PyThreadState *tstate)
{ {
tstate->tracing++; tstate->tracing++;
_PyThreadState_DisableTracing(tstate); _PyThreadState_PauseTracing(tstate);
} }
void void
PyThreadState_LeaveTracing(PyThreadState *tstate) PyThreadState_LeaveTracing(PyThreadState *tstate)
{ {
tstate->tracing--; tstate->tracing--;
_PyThreadState_ResetTracing(tstate); _PyThreadState_ResumeTracing(tstate);
} }