-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix pickle/copy support for the missing
singleton
#2029
base: main
Are you sure you want to change the base?
Conversation
* Fix pickle support for the `missing` singleton. * Add unit test for pickling the `missing` singleton. * Add unit test for copying the `missing` singleton.
Returning
|
src/jinja2/utils.py
Outdated
"MissingType", | ||
(), | ||
{"__repr__": lambda x: "missing", "__reduce__": lambda x: "missing"}, | ||
)() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used this form to minimize changes, but it could be replaced with an actual class
definition if desired.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that makes more sense. I don't see a reason a "singleton" was done this way, it's enough to call the class _MissingType
to indicate it's not public.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always the challenge when interacting with unfamiliar projects/maintainers around finding the balance of "minimize changes" vs "if you were building this today, it would look very different" 😆
Fix pickle/copy support for the
missing
singleton:missing
singleton.missing
singleton.missing
singleton.Fixes #2027