#28575: Model.DoesNotExist classes are not pickleable
-------------------------------------+-------------------------------------
Reporter: Rachel Tobin | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):
* stage: Unreviewed => Accepted
Old description:
> Example:
> {{{
> >>> import django
> >>> import pickle
> >>> pickle.dumps(django.contrib.auth.models.User.DoesNotExist)
> >>> PicklingError: Can't pickle <class
> 'django.contrib.auth.models.DoesNotExist'>: it's not found as
> django.contrib.auth.models.DoesNotExist
> }}}
>
> Note that *instances* of `Model.DoesNotExist` are pickleable as fixed
> here: https://code.djangoproject.com/ticket/17776. However the class
> itself is not. This is particularly problematic when using the Django
> test runner with the `--parallel` option enabled when a
> `Model.DoesNotExist` exception is raised. The result of this is the test
> runner bailing with a `pickle.PicklingError`, making it exceptionally
> difficult to debug the cause of the `Model.DoesNotExist`.
New description:
Example:
{{{
>>> import django
>>> import pickle
>>> pickle.dumps(django.contrib.auth.models.User.DoesNotExist)
>>> PicklingError: Can't pickle <class
'django.contrib.auth.models.DoesNotExist'>: it's not found as
django.contrib.auth.models.DoesNotExist
}}}
*Instances* of `Model.DoesNotExist` are pickleable as fixed in #17776,
however, the class itself is not. This is particularly problematic when
using the Django test runner with the `--parallel` option enabled when a
`Model.DoesNotExist` exception is raised. The result of this is the test
runner bailing with a `pickle.PicklingError`, making it exceptionally
difficult to debug the cause of the `Model.DoesNotExist`.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/28575#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.8a9a86edc405d98473f2dae5ccc9fe1f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.