mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #12451: Add support.create_empty_file()
We don't need to create a temporary buffered binary or text file object just to create an empty file. Replace also os.fdopen(handle).close() by os.close(handle).
This commit is contained in:
parent
61600cb0c3
commit
bf816223df
17 changed files with 50 additions and 53 deletions
|
@ -1028,8 +1028,7 @@ if sys.platform != 'win32':
|
|||
os.mkdir(self.dir)
|
||||
try:
|
||||
for fn in bytesfn:
|
||||
f = open(os.path.join(self.bdir, fn), "w")
|
||||
f.close()
|
||||
support.create_empty_file(os.path.join(self.bdir, fn))
|
||||
fn = os.fsdecode(fn)
|
||||
if fn in self.unicodefn:
|
||||
raise ValueError("duplicate filename")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue