New submission from Julian Berman <julian+python....@grayvines.com>:

This line (which contains a non-ASCII digit):

    python3.9 -c "import datetime; datetime.date.fromisoformat('1963-06-1৪')"

raises:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ValueError: Invalid isoformat string: '1963-06-1৪'

under the C implementation of the datetime module, but when the pure Python 
implementation is the one imported, succeeds (and produces `datetime.date(1963, 
6, 14)`)

The pure Python implementation should instead explicitly check and raise when 
encountering a non-ASCII string.

(On PyPy, which always uses the pure-Python implementation, this contributes to 
a behavioral difference)

----------
components: Library (Lib)
messages: 400235
nosy: Julian, p-ganssle
priority: normal
severity: normal
status: open
title: datetime's C implementation verifies fromisoformat is ASCII, but the 
pure python implementation does not
type: behavior
versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44994>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to