Bug 1749103 - rh-python36 cannot unpickle datetime.date objects [rhscl-3.3.z]
Summary: rh-python36 cannot unpickle datetime.date objects [rhscl-3.3.z]
Keywords:
Status: CLOSED ERRATA
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: Lukáš Zachar
URL:
Whiteboard:
Depends On: 1724349
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-09-04 21:48 UTC by Charalampos Stratakis
Modified: 2019-11-06 09:45 UTC (History)
8 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: 1724349
Environment:
Last Closed: 2019-11-06 09:45:37 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2019:3725 None None None 2019-11-06 09:45:43 UTC

Description Charalampos Stratakis 2019-09-04 21:48:49 UTC
+++ This bug was initially created as a clone of Bug #1724349 +++

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

--- Additional comment from RHEL Product and Program Management on 2019-06-26 22:27:06 CEST ---

Since this bug report was entered in Red Hat Bugzilla, the release flag has been set to ? to ensure that it is properly evaluated for this release.

--- Additional comment from Petr Viktorin on 2019-07-30 15:58:24 CEST ---

This should be fixed with a rebase to 3.6.9.

Comment 3 Lukáš Zachar 2019-11-04 11:34:13 UTC
Verified by `test_compat_unpickle` in https://tcms.engineering.redhat.com/case/604054/?from_plan=26960#case_run

Comment 5 errata-xmlrpc 2019-11-06 09:45:37 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:3725


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