FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-22005: Fixed unpickling instances of datetime classes pickled by Python 2. by serhiy-storchaka · Pull Request #794 · python/cpython · GitHub

Repository navigation

bpo-22005: Fixed unpickling instances of datetime classes pickled by Python 2. - #794

Closed
serhiy-storchaka wants to merge 12 commits into
python:masterfrom
serhiy-storchaka:datetime-compat-unpickle
Closed

serhiy-storchaka wants to merge 12 commits into
python:masterfrom
serhiy-storchaka:datetime-compat-unpickle

Conversation

serhiy-storchaka commented Mar 23, 2017 •
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

errors='surrogateescape' should be used for successful decoding.

encoding='latin1' should be used for successful decoding.

https://bugs.python.org/issue22005

…Python 2.

errors='surrogateescape' should be used for successful decoding.

Copy link
Copy Markdown

@serhiy-storchaka, thanks for your PR! By analyzing the history of the files in this pull request, we identified @abalkin, @tim-one and @birkenfeld to be potential reviewers.

Comment thread Lib/datetime.py Outdated
1 <= year[2] <= 12:
if (month is None and
isinstance(year, (bytes, str)) and len(year) == 4 and
1 <= ord(year[2:3])&0xFF <= 12):

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I don't understand how the last condition works. Is it supposed to allow str year with year[2] outside of 8-bit range?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

If the third byte is in the range 0x00-0x7f, it is decoded to the character in the range U+0000-U+007f. If it is in the range 0x80-0xff, it is decoded to the character in the range U+dc80-U+dcff.

Hmm, but in the latter case ord(year[2:3])&0xFF >= 0x80, and that condition is false. &0xFF is not needed in this case. But '&0x7F' in other two cases are needed.

Copy link
Copy Markdown
Member Author

Tests on Travis CI are failed for unrelated cause.

Copy link
Copy Markdown
Member Author

The Travis CI build is failed due to some glitches. For a copy of this PR #11017 all tests are passed.

serhiy-storchaka deleted the datetime-compat-unpickle branch December 7, 2018 11:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants


Back | FazBrowse Home | New Git URL