opt_frozen_dataclass: more improvements - #274
Closed
matthiasdiener wants to merge 3 commits into
Closed
Conversation
Co-authored-by: Matthias Diener <mdiener@illinois.edu>
matthiasdiener
force-pushed
the
opt-frozen-improvements
branch
from
December 3, 2024 18:29
a11975b to
a24ad7c
Compare
Contributor
Author
|
What do you think @inducer? |
matthiasdiener
marked this pull request as ready for review
December 3, 2024 20:14
inducer
reviewed
Dec 4, 2024
Comment on lines
+3025
to
+3027
| # Make it possible to override 'frozen' in the class definition for testing. | ||
| # It would be nice to have something like https://discuss.python.org/t/allow-debug-to-be-set-at-runtime/64840 | ||
| loc_frozen = __debug__ if "_frozen_override" not in cls.__dict__ else False |
Contributor
Author
There was a problem hiding this comment.
It's just meant for testing so that we can "fake" setting __debug__ = False.
|
|
||
| # Make it possible to override 'frozen' in the class definition for testing. | ||
| # It would be nice to have something like https://discuss.python.org/t/allow-debug-to-be-set-at-runtime/64840 | ||
| loc_frozen = __debug__ if "_frozen_override" not in cls.__dict__ else False |
Owner
There was a problem hiding this comment.
frozen_override could be in kwargs maybe?
Contributor
Author
There was a problem hiding this comment.
Yeah, I think that's a good idea.
Owner
There was a problem hiding this comment.
I was thinking this needed tests. Thanks for adding them!
| slots: bool = False, | ||
| # Added in 3.11. | ||
| # weakref_slot: bool = False | ||
| **kwargs: Any, # Extra, version dependent arguments (weakref_slot in 3.11) |
Owner
There was a problem hiding this comment.
Is a kwargs-only ParamSpec a thing?
inducer
force-pushed
the
opt-frozen-hashable
branch
2 times, most recently
from
December 4, 2024 17:47
cb2683a to
d22dec6
Compare
Owner
|
Thanks! I've rolled most of this into #273, with attribution. We can tackle the override later on if it's still needed. |
inducer
force-pushed
the
opt-frozen-hashable
branch
from
December 4, 2024 17:52
d22dec6 to
7b4d68a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
frozenweakref_slottargets #273.