-
Notifications
You must be signed in to change notification settings - Fork 161
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
Ensure that underlying value of enum key is used by BaseCache._build_key() across Python versions #633
Comments
str
for 3.11 compatibility
Is there any issue with using |
The result of using str() with an enum is the name of the enum, rather than its value. Earlier versions of My impression was that str() is a workaround and that you were trying to get back to earlier functionality. One benefit should be that existing caches would not get invalidated due to key values changing. I might have misunderstood that though.
In resolving the ambiguity of Option 3, the current implementation of EDIT: Corrected typos in the code block |
I missed that it was the value, actually. Thought the difference was whether it was namespaced or not. Seems reasonable then. |
Key builders and tests currently cast key values (notably
Enum
values) tostr
to maintain compatibility with Python 3.11 and older versions.This requirement can be eliminated by using f-strings rather thanstr.__format__
.EDIT: Whoops, that erroneous statement was based on testing in the wrong python environment. Instead of using
str()
, perhaps we should use a simple guard that check for an enum key. Something like:The text was updated successfully, but these errors were encountered: