-
-
Notifications
You must be signed in to change notification settings - Fork 474
fix: 🐛 Fix ValueError
when using Flag
#2759
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
base: master
Are you sure you want to change the base?
fix: 🐛 Fix ValueError
when using Flag
#2759
Conversation
Signed-off-by: Paillat <[email protected]>
MissingField = field(default_factory=lambda: MISSING) | ||
|
||
|
||
def missing_field_factory() -> field: | ||
return field(default_factory=lambda: 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.
maybe I'm stupid but how is this different
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.
Because the other one was referencing the same object every time, whereas here it creates a new object. I have no knowledge of the python interpreter internals that make this work, but yeah
Summary
See also my comment on #2443 .
The issue was that a
dataclasses.field
object could not be reused and caused unhelpfulTypeError
s.This, or something fixing this issue should ideally be merged before #2443 is merged, and then master merged into #2443 .
Information
fixes:
TypeError
when usingFlag
with python 3.11+ #2758examples, ...).
Checklist
type: ignore
comments were used, a comment is also left explaining why.