eric6/DebugClients/Python/PyProfile.py

changeset 8240
93b8a353c4bf
parent 8217
385f60c94548
child 8243
cc717c2ae956
--- 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)

eric ide

mercurial