--- a/eric6/DebugClients/Python/PyProfile.py Sun May 31 17:26:46 2020 +0200 +++ b/eric6/DebugClients/Python/PyProfile.py Sat Jul 04 11:45:34 2020 +0200 @@ -11,7 +11,6 @@ import profile import atexit import pickle -import sys class PyProfile(profile.Profile): @@ -54,10 +53,10 @@ try: cache = open(self.timingCache, 'rb') - timings = marshal.load(cache) + timings = marshal.load(cache) # secok if isinstance(timings, dict): self.timings = timings - except Exception: + except (EnvironmentError, EOFError, ValueError, TypeError): pass finally: cache.close() @@ -70,7 +69,7 @@ try: cache = open(self.timingCache, 'wb') marshal.dump(self.timings, cache) - except Exception: + except EnvironmentError: pass finally: cache.close() @@ -87,7 +86,7 @@ try: f = open(file, 'wb') self.create_stats() - pickle.dump(self.stats, f, 2) + pickle.dump(self.stats, f, 4) except (EnvironmentError, pickle.PickleError): pass finally: @@ -119,10 +118,7 @@ @param frame the frame object @return fixed up file name (string) """ - if sys.version_info[0] == 2: - versionExt = '.py2' - else: - versionExt = '.py3' + versionExt = '.py3' # get module name from __file__ if (not isinstance(frame, profile.Profile.fake_frame) and @@ -154,10 +150,11 @@ rpt, rit, ret, rfn, rframe, rcur = self.cur if not isinstance(rframe, profile.Profile.fake_frame): assert rframe.f_back is frame.f_back, ("Bad call", rfn, + # secok rframe, rframe.f_back, frame, frame.f_back) self.trace_dispatch_return(rframe, 0) - assert (self.cur is None or + assert (self.cur is None or # secok frame.f_back is self.cur[-2]), ("Bad call", self.cur[-3]) fcode = frame.f_code @@ -181,6 +178,3 @@ # the C function returned "c_return": profile.Profile.trace_dispatch_return, } - -# -# eflag: noqa = M702