bpo-37330: open() no longer accept 'U' in file mode (GH-16959)
open(), io.open(), codecs.open() and fileinput.FileInput no longer
accept "U" ("universal newline") in the file mode. This flag was
deprecated since Python 3.3.
diff --git a/Lib/imp.py b/Lib/imp.py
index 31f8c76..a6f6fc8 100644
--- a/Lib/imp.py
+++ b/Lib/imp.py
@@ -225,7 +225,7 @@
"""
suffix, mode, type_ = details
- if mode and (not mode.startswith(('r', 'U')) or '+' in mode):
+ if mode and (not mode.startswith('r') or '+' in mode):
raise ValueError('invalid file open mode {!r}'.format(mode))
elif file is None and type_ in {PY_SOURCE, PY_COMPILED}:
msg = 'file object required for import (type code {})'.format(type_)