Skip to content

Commit bd15246

Browse files
guyzmosdispater
authored andcommitted
🐛 Fixes issue when running on python >3 but ≤3.2 (#44)
The `IOError` refactoring has been introduced by PEP-3151 which has been implemented in Python 3.3+. This patch fixes the bug by having `FileNotFoundError` assigned as `IOError` on ≤3.2 pythons. * fixes issue #41 Signed-off-by: Bernard `Guyzmo` Pratz <[email protected]>
1 parent 5c70beb commit bd15246

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pendulum/_compat.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,18 @@
88

99

1010
if PY2:
11-
1211
long = long
1312
unicode = unicode
1413
basestring = basestring
15-
FileNotFoundError = IOError
16-
1714
else:
18-
19-
FileNotFoundError = FileNotFoundError
2015
long = int
2116
unicode = str
2217
basestring = str
2318

19+
if PY33:
20+
FileNotFoundError = FileNotFoundError
21+
else:
22+
FileNotFoundError = IOError # cf PEP-3151
2423

2524
def decode(string, encodings=None):
2625
if not PY2 and not isinstance(string, bytes):

0 commit comments

Comments
 (0)