Skip to content

Commit 7207bda

Browse files
committed
fix: Apply backport only if needed
1 parent bc6981f commit 7207bda

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

flattentool/ODSReader.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
from odf.table import Table, TableCell, TableRow
2424

2525
# Backport for datetime.fromisoformat, which is new in Python 3.7
26-
backports.datetime_fromisoformat.MonkeyPatch.patch_fromisoformat()
26+
try:
27+
_ = datetime.fromisoformat
28+
except AttributeError:
29+
backports.datetime_fromisoformat.MonkeyPatch.patch_fromisoformat()
2730

2831

2932
# http://stackoverflow.com/a/4544699/1846474

0 commit comments

Comments
 (0)