mirror of
https://github.com/python/cpython.git
synced 2025-09-11 03:07:01 +00:00
Always close files in distutils code and tests (#10252).
This commit is contained in:
parent
afb078dd26
commit
bee5cef7db
24 changed files with 261 additions and 171 deletions
|
@ -88,8 +88,10 @@ class DirUtilTestCase(support.TempdirManager, unittest.TestCase):
|
|||
mkpath(self.target, verbose=0)
|
||||
a_file = os.path.join(self.target, 'ok.txt')
|
||||
f = open(a_file, 'w')
|
||||
f.write('some content')
|
||||
f.close()
|
||||
try:
|
||||
f.write('some content')
|
||||
finally:
|
||||
f.close()
|
||||
|
||||
wanted = ['copying %s -> %s' % (a_file, self.target2)]
|
||||
copy_tree(self.target, self.target2, verbose=1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue