From e4f44e30bda20fc776532b3df8abf9f4f03257f0 Mon Sep 17 00:00:00 2001 From: oittaa <8972248+oittaa@users.noreply.github.com> Date: Wed, 8 Dec 2021 22:13:55 +0100 Subject: [PATCH] Allow lower case "t" and "z" in datetimes (#149) * Allow lower case "t" and "z" in datetimes https://datatracker.ietf.org/doc/html/rfc3339#section-5.6 * Add changelog entry Co-authored-by: Taneli Hukkinen <3275109+hukkin@users.noreply.github.com> --- CHANGELOG.md | 2 ++ tomli/_re.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 69598c1..3327b19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ - Python 3.6 support - Support for text file objects as `load` input. Use binary file objects instead. - First argument of `load` and `loads` can no longer be passed by keyword. +- Fixed + - Allow lower case "t" and "z" in datetimes - Improved - Raise an error when dotted keys define values outside the "current table". Technically speaking TOML v1.0.0 does allow such assignments diff --git a/tomli/_re.py b/tomli/_re.py index fa599d7..c13269d 100644 --- a/tomli/_re.py +++ b/tomli/_re.py @@ -36,9 +36,9 @@ fr""" ([0-9]{{4}})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01]) # date, e.g. 1988-10-27 (?: - [T ] + [Tt ] {_TIME_RE_STR} - (?:(Z)|([+-])([01][0-9]|2[0-3]):([0-5][0-9]))? # optional time offset + (?:([Zz])|([+-])([01][0-9]|2[0-3]):([0-5][0-9]))? # optional time offset )? """, flags=re.VERBOSE,