Skip to content
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

Add django.db.models.base.model_unpickle #1209

Merged
merged 1 commit into from Oct 27, 2022

Conversation

adamchainz
Copy link
Contributor

I have made things!

This is an internal Django function for pickling, but easy to add the types for.

To doublecheck the arg types, I added a breakpoint and ran Django’s test suite:

diff --git a/django/db/models/base.py b/django/db/models/base.py
index 584db319da..7450e2fe7d 100644
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -2468,6 +2468,7 @@ def model_unpickle(model_id):
     else:
         # Backwards compat - the model was cached directly in earlier versions.
         model = model_id
+    breakpoint()
     return model.__new__(model)

Related issues

Fixes #1207.

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I trust you on this one, thank you!

@sobolevn sobolevn merged commit 85ae4bb into typeddjango:master Oct 27, 2022
@adamchainz adamchainz deleted the model_unpickle branch October 27, 2022 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

django.db.models.base.model_unpickle missing
2 participants