diff options
author | Olivier Grisel <olivier.grisel@ensta.org> | 2017-09-04 14:22:19 +0200 |
---|---|---|
committer | Olivier Grisel <olivier.grisel@ensta.org> | 2017-09-04 14:22:19 +0200 |
commit | a829cf02cc65287727784e5390088ec820b8ba1f (patch) | |
tree | 96e1b15168ffc1b20bda21e197d1246f931d093e /coverage/ctracer/tracer.c | |
parent | 76e9f91fc2ab4c05806eb5f918002364c5d11cc1 (diff) | |
download | python-coveragepy-fix-thread-safety.tar.gz |
FIX always remove the callback from the callback itselffix-thread-safety
Diffstat (limited to 'coverage/ctracer/tracer.c')
-rw-r--r-- | coverage/ctracer/tracer.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/coverage/ctracer/tracer.c b/coverage/ctracer/tracer.c index 236fbbf..0ade741 100644 --- a/coverage/ctracer/tracer.c +++ b/coverage/ctracer/tracer.c @@ -1035,7 +1035,10 @@ static PyObject * CTracer_stop(CTracer *self, PyObject *args_unused) { if (self->started) { - PyEval_SetTrace(NULL, NULL); + /* Set the started flag only. The actual call to + PyEval_SetTrace(NULL, NULL) is delegated to the callback + itself to ensure that it called from the right thread. + */ self->started = FALSE; } |