Opened 12 years ago

Closed 11 years ago

#18745 closed Bug (fixed)

When passing a tuple to signing.dumps, I get a list back after calling signing.loads

Reported by: lee@… Owned by: MattBlack
Component: Core (Other) Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

>>> from django.core import signing
>>> a = signing.dumps(('a','b','c'))
>>> signing.loads(a)
['a', 'b', 'c']

I'd have expected it to behave the same as pickle:

>>> a = pickle.dumps(('a','b','c'))
>>> pickle.loads(a)
('a', 'b', 'c')

Change History (4)

comment:1 by Claude Paroz, 12 years ago

Component: UncategorizedCore (Other)
Triage Stage: UnreviewedAccepted

Signing uses JSON to dump and load content, and there is no native distinction in JSON between lists and tuples. I don't know if we can/should do something to fix this, but accepting because it should at least be documented (https://docs.djangoproject.com/en/dev/topics/signing/#protecting-complex-data-structures).

comment:2 by anonymous, 11 years ago

Owner: changed from nobody to anonymous
Status: newassigned

comment:3 by MattBlack, 11 years ago

Owner: changed from anonymous to MattBlack

comment:4 by MattBlack85 <promat85@…>, 11 years ago

Resolution: fixed
Status: assignedclosed

In 653527de40115ddab04a7dcc69134ee4be45fa01:

Fixed #18745 - Documentation change explaining tuple to list with signing.

Thanks to lee for the report.

Note: See TracTickets for help on using tickets.
Back to Top