-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValidationError can be pickled, but cannot be unpickled #959
Comments
Indeed I don't think that |
Facing the same issue when retrieving exception from a Celery task that failed due to pydantic model validation. |
Is there any update on this issue?
|
Fixed in #1119 |
Initial Checks
Description
It seems that instances of
ValidationError
can be pickled with thepickle
module, but unpickling fails with a "No constructor defined" error – see example code below.I ran into this while using Pydantic inside a Django project, and running Django tests in parallel (
manage.py test --parallel
). In parallel mode, tests are run in multiple processes. If a test fails, the failure is pickled and reported back to the parent process. If test fails by throwing an uncaughtValidationError
, in the console output I do not see the Validation error itself, instead I see a less helpful error about the the failed unpickling.A workaround is to run Django tests sequentially, but it would be nice to be able to use the parallel mode.
Example Code
Python, Pydantic & OS Version
The text was updated successfully, but these errors were encountered: