This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: datetime's C implementation verifies fromisoformat is ASCII, but the pure python implementation does not
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9, Python 3.8, Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Julian, p-ganssle
Priority: normal Keywords:

Created on 2021-08-24 20:32 by Julian, last changed 2022-04-11 14:59 by admin.

Messages (1)
msg400235 - (view) Author: Julian Berman (Julian) * Date: 2021-08-24 20:32
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)
History
Date User Action Args
2022-04-11 14:59:49adminsetgithub: 89157
2021-08-24 20:32:18Juliancreate