Opened 3 years ago

Closed 19 months 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 Changed 3 years ago by claudep

  • Component changed from Uncategorized to Core (Other)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

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 Changed 19 months ago by anonymous

  • Owner changed from nobody to anonymous
  • Status changed from new to assigned

comment:3 Changed 19 months ago by MattBlack

  • Owner changed from anonymous to MattBlack

comment:4 Changed 19 months ago by MattBlack85 <promat85@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

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