Skip to content

Commit a395121

Browse files
committed
refactor(Lib/_pyio): use explicit exception for open function
1 parent d7b9ea5 commit a395121

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/_pyio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def open(file, mode="r", buffering=-1, encoding=None, errors=None,
266266
result = text
267267
text.mode = mode
268268
return result
269-
except:
269+
except (ValueError, OSError, TypeError, ImportError, LookupError):
270270
result.close()
271271
raise
272272

0 commit comments

Comments
 (0)