diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-06-30 23:25:47 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-06-30 23:25:47 +0200 |
commit | bf816223dfe8f1d36a020b4bc02060b8d1ce7d26 (patch) | |
tree | 3651ee82210cb2110b6808a2545471cac321a22f /Lib/test/test_os.py | |
parent | 61600cb0c357fcdca048cee586865a26417dbd70 (diff) | |
download | cpython-git-bf816223dfe8f1d36a020b4bc02060b8d1ce7d26.tar.gz |
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).
Diffstat (limited to 'Lib/test/test_os.py')
-rw-r--r-- | Lib/test/test_os.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 0f2aedfa9e..5f39f64340 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -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") |