-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Implement __hash__ on all extensions we've implemented __eq__ on #2578
Comments
Refs #2578 -- implement __hash__ on CRLNumber
Refs #2578 -- implement __hash__ on SubjectKeyIdentifier
Refs #2578 -- implement __hash__ on CRLReason
Many of the remaining extensions use a list of items as their internal storage. Do we want to do something like hash(tuple(list))...? This could potentially be pretty expensive. |
bleh. let's take some time and think for those, I don't think we have On Sun, Dec 27, 2015 at 5:00 PM, Paul Kehrer [email protected]
"I disapprove of what you say, but I will defend to the death your right to |
Refs #2578 -- implement __hash__ on AccessDescription
Refs #2578 -- implement __hash__ on InhibitAnyPolicy
I'm going to preemptively apologize for an unintentionally long question, but: for those classes using lists for internal storage, is it a big deal if This would have the consequence that if, for example, two I'm thinking about chipping away at a few of these (at what could only be described as a glacial pace, but hey, anything helps, and if I ended up blocking anyone I'd speed up), but I'm concerned about not violating the edict of "thou shalt not have changing hashes". If the internal storage iterables are ever mutated, it seems to me that the only safe option would be either to use I suppose there are some other strategies that could be used, too, but they all seem fairly dangerous. At a certain point, if two equivalent objects really, really should be put in the same hash bucket, it seems to me like it'd be better off to convert the internal list (ex Thoughts? |
Individual PRs please, it makes them much easier to review and get merged quickly! Thanks for looking into contributing! |
@alex I have been thinking about the comment from @Badg regarding
My thoughts: since the data members of the AuthorityKeyIdentifier class (for example) are read-only, why don't we just construct the problematic members as tuples instead of lists? In the AuthorityKeyIdentifier example; instead of: if authority_cert_issuer is not None:
authority_cert_issuer = list(authority_cert_issuer) We could just do: if authority_cert_issuer is not None:
authority_cert_issuer = tuple(authority_cert_issuer) This way, we wouldn't have to convert the list to a tuple every time |
The attribute really shouldn't be a |
Completing this is now blocked on finishing #3461 |
We've fixed this haphazardly in the past, but we should probably consistently implement
__hash__
so extensions don't have odd behaviors like not being able to be inserted into hashable collections.The text was updated successfully, but these errors were encountered: