diff -r 59a9a658618c -r 93b8a353c4bf eric6/DebugClients/Python/PyProfile.py --- a/eric6/DebugClients/Python/PyProfile.py Wed Apr 14 19:38:19 2021 +0200 +++ b/eric6/DebugClients/Python/PyProfile.py Wed Apr 14 19:59:16 2021 +0200 @@ -11,6 +11,7 @@ import profile import atexit import pickle # secok +import contextlib class PyProfile(profile.Profile): @@ -64,11 +65,9 @@ Public method to store the collected profile data. """ # dump the raw timing data - try: - with open(self.timingCache, 'wb') as cache: - marshal.dump(self.timings, cache) - except OSError: - pass + with contextlib.suppress(OSError), \ + open(self.timingCache, 'wb') as cache: + marshal.dump(self.timings, cache) # dump the profile data self.dump_stats(self.profileCache)