Bug 1724349 - rh-python36 cannot unpickle datetime.date objects [rhscl-3.4.0]
Summary: rh-python36 cannot unpickle datetime.date objects [rhscl-3.4.0]
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Software Collections
Classification: Red Hat
Component: python
Version: rh-python36
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: alpha
: 3.4
Assignee: Python Maintainers
QA Contact: RHEL CS Apps Subsystem QE
URL:
Whiteboard:
Depends On:
Blocks: 1749103
TreeView+ depends on / blocked
 
Reported: 2019-06-26 20:27 UTC by Lark Gordon
Modified: 2023-03-24 14:59 UTC (History)
4 users (show)

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:
Clone Of:
: 1749103 (view as bug list)
Environment:
Last Closed: 2019-12-19 16:50:55 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github bpo-22005 0 None None None 2019-12-10 14:11:24 UTC

Description Lark Gordon 2019-06-26 20:27:04 UTC
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

Comment 2 Petr Viktorin (pviktori) 2019-07-30 13:58:24 UTC
This should be fixed with a rebase to 3.6.9.


Note You need to log in before you can comment on or make changes to this bug.