Skip to content

Conversation

@gpshead
Copy link
Member

@gpshead gpshead commented Mar 1, 2024

The presence of the values in the error message gives a stronger hint as to what went wrong.

>>> datetime.strptime("2.29", "%m.%d") Traceback (most recent call last): File "<stdin>", line 1, in <module> datetime.strptime("2.29", "%m.%d") ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File ".../Lib/_strptime.py", line 565, in _strptime_datetime return cls(*args) ~~~^^^^^^^ ValueError: day 29 is out of range for month 2 in year 1900
… month. The presence of the values in the error message gives a stronger hint as to what went wrong. ``` >>> datetime.strptime("2.29", "%m.%d") Traceback (most recent call last): File "<stdin>", line 1, in <module> datetime.strptime("2.29", "%m.%d") ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File ".../Lib/_strptime.py", line 565, in _strptime_datetime return cls(*args) ~~~^^^^^^^ ValueError: day 29 is out of range for month 2 in year 1900 ```
@pitrou
Copy link
Member

pitrou commented Mar 1, 2024

+1 on the principle, but ideally there would be a test for this.

@gpshead
Copy link
Member Author

gpshead commented Mar 21, 2025

closing in favor of #131335

@gpshead gpshead closed this Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants