-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
datetime's C implementation verifies fromisoformat is ASCII, but the pure python implementation does not #89157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This line (which contains a non-ASCII digit):
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 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) |
I was able to reproduce this. A Related issue is https://bugs.python.org/issue39280 (on GH #83461), there is an extensive discussion on there. Based on the discussion in that issue, unicode characters were deemed fine by @pganssle . The main problem is the inconsistency between the C and python implementation. I could try making a PR so that the C implementation can accept unicode character, if @pganssle think that is a good idea. |
The dupe was closed without a real conclusion but I think @pganssle's suggestion is what we should do here.
I'll implement it for fromisoformat to close this issue. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs
datetime.date.fromisoformat
consistent. #131007The text was updated successfully, but these errors were encountered: