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).
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 0f2aedf..5f39f64 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -1028,8 +1028,7 @@
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")