diff options
Diffstat (limited to 'Lib/profile.py')
-rwxr-xr-x | Lib/profile.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/profile.py b/Lib/profile.py index 743e77d..553f210 100755 --- a/Lib/profile.py +++ b/Lib/profile.py @@ -373,10 +373,9 @@ class Profile: print_stats() def dump_stats(self, file): - f = open(file, 'wb') - self.create_stats() - marshal.dump(self.stats, f) - f.close() + with open(file, 'wb') as f: + self.create_stats() + marshal.dump(self.stats, f) def create_stats(self): self.simulate_cmd_complete() |