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
Inconsistent behaviour in strftime #85868
Comments
Inconsistency in strftime between python 3.6 and 3.7 when parsing first-century dates. Python 3.6
>>> datetime.datetime.strptime(d, "%Y-%m-%d").strftime("%Y-%m-%d")
'0020-10-05'
Python 3.7
>>> datetime.datetime.strptime("0020-10-05", "%Y-%m-%d").strftime("%Y-%m-%d")
'20-10-05' This means that the following would work for 3.6 but raise a ValueError for 3.7:
|
3.8.2 (on Alpine Linux under WSL) produces '0020-10-05', just like your 3.6 example. Not seeing anything obvious in commit history that would break it for 3.7. That said, 3.7 is in security fix only mode at this point (see https://devguide.python.org/#status-of-python-branches ); as this works on the latest release, I'm thinking this won't be fixed for 3.7. |
The behavior you see with a Python 3.7 is not universal. For example, on macOS: Python 3.7.9 (v3.7.9:13c94747c7, Aug 15 2020, 01:31:08)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> datetime.datetime.strptime("0020-10-05", "%Y-%m-%d").strftime("%Y-%m-%d")
'0020-10-05' So there is apparently something different in the environments between the Python 3.6 and 3.7 you are using, rather than an issue in Python itself. Perhaps a comparison of the outputs between: python3.6 -m test.pythoninfo will suggest something. In any case, as Josh notes, Python 3.7 is in the security-fix-only phase of its life cycle so even if there were an issue in Python itself it would likely not meet the criteria to be fixed in 3.7. |
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:
The text was updated successfully, but these errors were encountered: