Skip to content

fix JITMixin pickling - #147

Merged
millerdev merged 2 commits into
dimagi:mainfrom
terencehonles:fix-JITMixin-pickling
Sep 25, 2026
Merged

millerdev merged 2 commits into
dimagi:mainfrom
terencehonles:fix-JITMixin-pickling

Conversation

@terencehonles

@terencehonles terencehonles commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

This change properly implements the __reduce__ method on the JITMixin class.

Comment thread django_cte/jitmixin.py
class JITMixin:
def __reduce__(self):
# make JITMixin classes pickleable
return (jit_mixin_type, (self._jit_mixin_base, *self._jit_mixins))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This converted all JITMixin instances into classes which will break when the instance was actually used.

@millerdev millerdev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@terencehonles, Thank you for fixing this!

@millerdev
millerdev merged commit a73956a into dimagi:main Sep 25, 2026
22 checks passed
@terencehonles
terencehonles deleted the fix-JITMixin-pickling branch September 27, 2026 08:19
@terencehonles

Copy link
Copy Markdown
Contributor Author

No prob, glad you were able to figure out that it was related to #119.

I remember seeing the title when looking at the issue list before, but didn't realize that issue would be related to pickling. The copy protocol uses similar lines so it may be using a deepcopy.

Any release notes may want to mention this fix includes pickling and deep copies. I didn't add a test with deep copy, but I know pickling uses the copy protocol and __reduce__ should be part of that. You can verify that if you'd like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants