mirror of
https://github.com/python/cpython.git
synced 2025-11-25 12:44:13 +00:00
modernize some modules' code by using with statement around open()
This commit is contained in:
parent
fd6e6cfa29
commit
2f50aaf2ff
14 changed files with 50 additions and 89 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue