fix: support Python 3.10 on Windows

This commit is contained in:
Fedoroff
2026-10-27 20:51:32 +03:00
parent 35ae6f722e
commit 982a3a5a38
2 changed files with 16 additions and 3 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
PYTHON ?= python3
PYTHON ?= py -3
BASE_URL ?= http://localhost:8080
CA_FILE ?=
ACTION_SCRIPT ?=
+15 -2
View File
@@ -29,8 +29,21 @@ def timestamp(value):
'timestamp must be UTC ending in Z'
)
try:
return dt.datetime.fromisoformat(value[:-1] + '+00:00')
except ValueError as exc:
normalized = value[:-1] + '+00:00'
if '.' in normalized:
prefix, fraction = normalized.split('.', 1)
digits, timezone = fraction.split('+', 1)
if not digits.isdigit() or len(digits) > 9:
raise ValueError('invalid fractional seconds')
digits = digits[:6].ljust(6, '0')
normalized = f'{prefix}.{digits}+{timezone}'
return dt.datetime.fromisoformat(normalized)
except (ValueError, TypeError) as exc:
raise Failure(f'invalid RFC3339 timestamp: {value!r}') from exc
def validate(value, schema, where='response'):