--- a/eric6/DebugClients/Python/PyProfile.py Thu Apr 15 16:52:05 2021 +0200 +++ b/eric6/DebugClients/Python/PyProfile.py Thu Apr 15 18:11:24 2021 +0200 @@ -52,13 +52,11 @@ if not os.path.exists(self.timingCache): return - try: - with open(self.timingCache, 'rb') as cache: - timings = marshal.load(cache) # secok - if isinstance(timings, dict): - self.timings = timings - except (OSError, EOFError, ValueError, TypeError): - pass + with contextlib.suppress(OSError, EOFError, ValueError, TypeError), \ + open(self.timingCache, 'rb') as cache: + timings = marshal.load(cache) # secok + if isinstance(timings, dict): + self.timings = timings def save(self): """ @@ -79,11 +77,9 @@ @param file name of the file to write to (string) """ self.create_stats() - try: - with open(file, 'wb') as f: - pickle.dump(self.stats, f, 4) - except (OSError, pickle.PickleError): - pass + with contextlib.suppress(OSError, pickle.PickleError), \ + open(file, 'wb') as f: + pickle.dump(self.stats, f, 4) def erase(self): """