From 56942019309645781d330312f5944db2d4cb5cd7 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 24 Oct 2016 12:59:20 +1100 Subject: extmod/vfs_fat_file: Make file.close() a no-op if file already closed. As per CPython semantics. In particular, file.__del__() should not raise an exception if the file is already closed. --- tests/extmod/vfs_fat_fileio.py | 6 +----- tests/extmod/vfs_fat_fileio.py.exp | 1 - 2 files changed, 1 insertion(+), 6 deletions(-) (limited to 'tests/extmod') diff --git a/tests/extmod/vfs_fat_fileio.py b/tests/extmod/vfs_fat_fileio.py index 26fec7828..de8d4953c 100644 --- a/tests/extmod/vfs_fat_fileio.py +++ b/tests/extmod/vfs_fat_fileio.py @@ -48,6 +48,7 @@ print(str(f)[:17], str(f)[-1:]) f.write("hello!") f.flush() f.close() +f.close() # allowed try: f.write("world!") except OSError as e: @@ -63,11 +64,6 @@ try: except OSError as e: print(e.args[0] == uerrno.EINVAL) -try: - f.close() -except OSError as e: - print(e.args[0] == uerrno.EINVAL) - try: vfs.open("foo_file.txt", "x") except OSError as e: diff --git a/tests/extmod/vfs_fat_fileio.py.exp b/tests/extmod/vfs_fat_fileio.py.exp index 9f0edb31e..c438bc850 100644 --- a/tests/extmod/vfs_fat_fileio.py.exp +++ b/tests/extmod/vfs_fat_fileio.py.exp @@ -3,7 +3,6 @@ True True True True -True hello!world! 12 h -- cgit v1.2.3