Bug 1724349
| Summary: | rh-python36 cannot unpickle datetime.date objects [rhscl-3.4.0] | |||
|---|---|---|---|---|
| Product: | Red Hat Software Collections | Reporter: | Lark Gordon <lagordon> | |
| Component: | python | Assignee: | Python Maintainers <python-maint> | |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | RHEL CS Apps Subsystem QE <rhel-cs-apps-subsystem-qe> | |
| Severity: | unspecified | Docs Contact: | ||
| Priority: | unspecified | |||
| Version: | rh-python36 | CC: | cstratak, hhorak, pviktori, torsava | |
| Target Milestone: | alpha | |||
| Target Release: | 3.4 | |||
| Hardware: | Unspecified | |||
| OS: | Unspecified | |||
| Whiteboard: | ||||
| Fixed In Version: | rh-python36-python-3.6.9-1.el6 rh-python36-python-3.6.9-1.el7 | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | ||
| Clone Of: | ||||
| : | 1749103 (view as bug list) | Environment: | ||
| Last Closed: | 2019-12-19 16:50:55 UTC | Type: | Bug | |
| Regression: | --- | Mount Type: | --- | |
| Documentation: | --- | CRM: | ||
| Verified Versions: | Category: | --- | ||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
| Cloudforms Team: | --- | Target Upstream Version: | ||
| Embargoed: | ||||
| Bug Depends On: | ||||
| Bug Blocks: | 1749103 | |||
This should be fixed with a rebase to 3.6.9. |
Description of problem: ====== rh-python36 has the following issue when unpickling date-objects stored in python 2: Pickle a date in python 2: import datetime; pickle.dumps(datetime.date(2019, 12, 31), 2) '\x80\x02cdatetime\ndate\nq\x00U\x04\x07\xe3\x0c\x1fq\x01\x85q\x02Rq\x03.' Unpickle in python3 fails: x = b'\x80\x02cdatetime\ndate\nq\x00U\x04\x07\xe3\x0c\x1fq\x01\x85q\x02Rq\x03.'; pickle.loads(x, encoding='latin1') (...) TypeError: an integer is required (got type str) Version-Release number of selected component (if applicable): ====== rh-python36 (Python 3.6.3) How reproducible: ====== We're able to reproduce this ourselves Steps to Reproduce: ====== 1. $ python Python 2.7.5 (default, Mar 26 2019, 22:13:06) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import datetime; import pickle; pickle.dumps(datetime.date(2019, 12, 31), 2) '\x80\x02cdatetime\ndate\nq\x00U\x04\x07\xe3\x0c\x1fq\x01\x85q\x02Rq\x03.' >>> 2. $ scl enable rh-python36 bash 3. $ python Python 3.6.3 (default, Apr 10 2019, 14:37:36) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import datetime; import pickle; x = b'\x80\x02cdatetime\ndate\nq\x00U\x04\x07\xe3\x0c\x1fq\x01\x85q\x02Rq\x03.'; pickle.loads(x, encoding='latin1') Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: an integer is required (got type str) >>> Actual results: ====== b'\x80\x02cdatetime\ndate\nq\x00U\x04\x07\xe3\x0c\x1fq\x01\x85q\x02Rq\x03.'; pickle.loads(x, encoding='latin1') Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: an integer is required (got type str) Expected results: ====== '\x80\x02cdatetime\ndate\nq\x00U\x04\x07\xe3\x0c\x1fq\x01\x85q\x02Rq\x03.' Additional info: ====== This has been fixed upstream: https://github.com/python/cpython/commit/19f6e83bf03b3ce22300638906bd90dd2dd5c463