Skip to content

gh-141540: Improve strptime error message for unconverted data - #157832

Open
vasiliyk wants to merge 1 commit into
python:mainfrom
vasiliyk:gh-141540-strptime
Open

vasiliyk wants to merge 1 commit into
python:mainfrom
vasiliyk:gh-141540-strptime

Conversation

@vasiliyk

@vasiliyk vasiliyk commented Sep 20, 2026

Copy link
Copy Markdown

The "unconverted data remains" error message used %s, so a trailing newline in the input was not visible.
Use !r instead, and format the neighbouring messages in _strptime() the same way.

Comment thread Lib/_strptime.py
@@ -584,7 +584,7 @@ def _strptime(data_string, format="%a %b %d %H:%M:%S %Y"):
raise ValueError(
f"Missing colon in %:z before '{rest}', got '{data_string}'"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can fix this one as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants