diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-08-25 07:27:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-25 07:27:55 (GMT) |
commit | c406d5cd74002964a64c3eb7d9e2445a7fd3a03f (patch) | |
tree | d762f8be37e446fecb49d58c4148f81d225c2457 /Lib/trace.py | |
parent | 8fdd331bbf7e60dd81c02c7077f44c7939e2a05d (diff) | |
download | cpython-c406d5cd74002964a64c3eb7d9e2445a7fd3a03f.zip cpython-c406d5cd74002964a64c3eb7d9e2445a7fd3a03f.tar.gz cpython-c406d5cd74002964a64c3eb7d9e2445a7fd3a03f.tar.bz2 |
bpo-34171: Prevent creating Lib/trace.cover when run the trace module. (GH-8841)
Diffstat (limited to 'Lib/trace.py')
-rwxr-xr-x | Lib/trace.py | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/Lib/trace.py b/Lib/trace.py index 16c3494..86b2101 100755 --- a/Lib/trace.py +++ b/Lib/trace.py @@ -63,14 +63,6 @@ from time import monotonic as _time import threading -def _settrace(func): - threading.settrace(func) - sys.settrace(func) - -def _unsettrace(): - sys.settrace(None) - threading.settrace(None) - PRAGMA_NOCOVER = "#pragma NO COVER" class _Ignore: @@ -451,12 +443,14 @@ class Trace: if globals is None: globals = {} if locals is None: locals = {} if not self.donothing: - _settrace(self.globaltrace) + threading.settrace(self.globaltrace) + sys.settrace(self.globaltrace) try: exec(cmd, globals, locals) finally: if not self.donothing: - _unsettrace() + sys.settrace(None) + threading.settrace(None) def runfunc(self, func, *args, **kw): result = None |