Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bpo-32267: Fix parsing tz offsets microseconds shorter than 6#4781

Merged
abalkin merged 1 commit into
python:masterpython/cpython:masterfrom
mariocj89:fix_strptime_us_isoparsemariocj89/cpython:fix_strptime_us_isoparseCopy head branch name to clipboard
Jan 9, 2018
Merged

bpo-32267: Fix parsing tz offsets microseconds shorter than 6#4781
abalkin merged 1 commit into
python:masterpython/cpython:masterfrom
mariocj89:fix_strptime_us_isoparsemariocj89/cpython:fix_strptime_us_isoparseCopy head branch name to clipboard

Conversation

@mariocj89

@mariocj89 mariocj89 commented Dec 10, 2017

Copy link
Copy Markdown
Contributor

As the remainder is directly parsed as an int, strings like .600 will be parsed as 600 microsecond rather than milliseconds.

I've added no news entries as it was included in #4015 and I think it has not been released yet. Please let me know if one should be added.

https://bugs.python.org/issue32267

As the remainder is directly parsed as an int, strings like
.600 will be parsed as 600 microsecond rather than miliseconds.
@mariocj89 mariocj89 changed the title Fix when parsing tz offsets microseconds shorter than 6 bpo-32267: Fix when parsing tz offsets microseconds shorter than 6 Dec 10, 2017
@mariocj89 mariocj89 changed the title bpo-32267: Fix when parsing tz offsets microseconds shorter than 6 bpo-32267: Fix parsing tz offsets microseconds shorter than 6 Dec 10, 2017
Comment thread Lib/_strptime.py
gmtoff_fraction = int(z[8:] or 0)
gmtoff_remainder = z[8:]
# Pad to always return microseconds.
gmtoff_remainder_padding = "0" * (6 - len(gmtoff_remainder))

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.

I did a microbenchmark for this vs. multiplying by 10**(6-len(gmtoff_remainder)) and it seems like your version is either faster or the same speed. Maybe that's why you chose this method, but I thought I'd chime in since I went through the trouble to check it.

@mariocj89

Copy link
Copy Markdown
Contributor Author

@abalkin sorry to mention you but without this change the previous PR change is buggy.
Mentioning as probably as the commit status is failed it will fall off the radar. If you want I can create a news entry but I think it makes no sense

@pganssle

pganssle commented Jan 4, 2018

Copy link
Copy Markdown
Member

FWIW this patch looks good to me.

@abalkin abalkin self-assigned this Jan 9, 2018
@abalkin abalkin merged commit f80c0ca into python:master Jan 9, 2018
@mariocj89

Copy link
Copy Markdown
Contributor Author

Thanks!

@mariocj89 mariocj89 deleted the fix_strptime_us_isoparse branch September 14, 2019 11:30
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.

5 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.