[Django] #28389: pickling LazyObject works incorrectly on Python 2

3 views
Skip to first unread message

Django

unread,
Jul 12, 2017, 6:04:50 AM7/12/17
to django-...@googlegroups.com
#28389: pickling LazyObject works incorrectly on Python 2
-------------------------------------------+------------------------
Reporter: Sergey Fedoseev | Owner: nobody
Type: Bug | Status: new
Component: Utilities | Version: 1.11
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+------------------------
{{{
In [126]: import pickle
In [127]: from django.utils.functional import LazyObject
In [128]: class A(object):
...: pass
...:
In [129]: lazy_obj = LazyObject()
In [130]: a = A()
In [131]: a.foo = 'bar'
In [132]: lazy_obj._wrapped = a
In [133]: pickle.loads(pickle.dumps(lazy_obj)).foo
---------------------------------------------------------------------------
AttributeError Traceback (most recent call
last)
<ipython-input-133-a85d49df8170> in <module>()
----> 1 pickle.loads(pickle.dumps(lazy_obj)).foo

AttributeError: 'A' object has no attribute 'foo'
}}}

Introduced in 35355a4ffedb2aeed52d5fe3034380ffc6a438db.

--
Ticket URL: <https://code.djangoproject.com/ticket/28389>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 12, 2017, 6:05:02 AM7/12/17
to django-...@googlegroups.com
#28389: pickling LazyObject works incorrectly on Python 2
-------------------------------------+-------------------------------------
Reporter: Sergey Fedoseev | Owner: Sergey
| Fedoseev
Type: Bug | Status: assigned
Component: Utilities | Version: 1.11
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sergey Fedoseev):

* status: new => assigned
* owner: nobody => Sergey Fedoseev


--
Ticket URL: <https://code.djangoproject.com/ticket/28389#comment:1>

Django

unread,
Jul 12, 2017, 6:29:35 AM7/12/17
to django-...@googlegroups.com
#28389: pickling LazyObject works incorrectly on Python 2
-------------------------------------+-------------------------------------
Reporter: Sergey Fedoseev | Owner: Sergey
| Fedoseev
Type: Bug | Status: assigned
Component: Utilities | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sergey Fedoseev):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/8742 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/28389#comment:2>

Django

unread,
Jul 12, 2017, 9:30:34 AM7/12/17
to django-...@googlegroups.com
#28389: pickling LazyObject works incorrectly on Python 2
-------------------------------------+-------------------------------------
Reporter: Sergey Fedoseev | Owner: Sergey
| Fedoseev
Type: Bug | Status: closed
Component: Utilities | Version: 1.11
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"30f334cc58e939c7d9bd8455c80bd066fbde9f2b" 30f334c]:
{{{
#!CommitTicketReference repository=""
revision="30f334cc58e939c7d9bd8455c80bd066fbde9f2b"
[1.11.x] Fixed #28389 -- Fixed pickling of LazyObject on Python 2 when
wrapped object doesn't have __reduce__().

Partial revert of 35355a4ffedb2aeed52d5fe3034380ffc6a438db.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28389#comment:3>

Django

unread,
Jul 12, 2017, 9:32:02 AM7/12/17
to django-...@googlegroups.com
#28389: Regression in pickling LazyObject on Python 2 if wrapped object doesn't
have __reduce__()

-------------------------------------+-------------------------------------
Reporter: Sergey Fedoseev | Owner: Sergey
| Fedoseev
Type: Bug | Status: closed
Component: Utilities | Version: 1.11
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* stage: Unreviewed => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/28389#comment:4>

Django

unread,
Jul 12, 2017, 9:34:05 AM7/12/17
to django-...@googlegroups.com
#28389: Regression in pickling LazyObject on Python 2 if wrapped object doesn't
have __reduce__()
-------------------------------------+-------------------------------------
Reporter: Sergey Fedoseev | Owner: Sergey
| Fedoseev
Type: Bug | Status: closed
Component: Utilities | Version: 1.11

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"83440a1258ab2e0c29ce2c5d3586456ece20b633" 83440a1]:
{{{
#!CommitTicketReference repository=""
revision="83440a1258ab2e0c29ce2c5d3586456ece20b633"
Refs #28389 -- Added release note and test for pickling of LazyObject when
wrapped object doesn't have __reduce__().

Forwardport of 30f334cc58e939c7d9bd8455c80bd066fbde9f2b from stable/1.11.x
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28389#comment:5>

Reply all
Reply to author
Forward
0 new messages