Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#27187 closed Bug (needsinfo)

Django 1.10 is unable to unpickle models pickled in Django pre-1.10

Reported by: Claude Paroz Owned by: nobody
Component: Database layer (models, ORM) Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Commit [7f51876f99851fdc3fef63aecdfbcffa199c26b9] changed the unpickle strategy for models. Now when I have old pickled models (for example in a queue) that I'm trying to unpickle with Django 1.10, I'm getting those errors:

UnpickleError at /django-rq/queues/1/
(u'Could not unpickle', AttributeError("'module' object has no attribute 'simple_class_factory'",))

And if I manually re-introduce simple_class_factory, I'm then getting:

UnpickleError at /django-rq/queues/1/
(u'Could not unpickle', TypeError('model_unpickle() takes exactly 1 argument (3 given)', <function model_unpickle at 0x7f921ddc8578>, (('accounts', 'BDNUser'), [], <function simple_class_factory at 0x7f921ddc8500>)))

Which could be solved by adding *args to model_unpickle.
What about adding some compatibility shims during one or two releases?

Change History (3)

comment:1 by Tim Graham, 8 years ago

The consensus from #21430 seemed to be that cross-version pickling support wasn't something we wanted to try to do. I guess you could ask on the mailing list whether we should revisit that.

comment:2 by Tim Graham, 8 years ago

Resolution: needsinfo
Status: newclosed

Closing pending discussion.

comment:3 by Claude Paroz, 8 years ago

Sorry, I missed your first comment.
I still think that if we can take simple measures to ensure the compatibility with only the next Django version, it would be worth it. However my motivation is not strong enough to push this forward now.

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