Skip to content
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 hash function generation for frozen models with unusual MRO #7274

Merged
merged 2 commits into from Aug 29, 2023

Conversation

dmontagu
Copy link
Contributor

@dmontagu dmontagu commented Aug 29, 2023

Closes #7236

Also fixes a bug with the way attributes were read from nested typeddicts (mro was being iterated over in reverse order), and adds a related test.

Selected Reviewer: @hramezani

@cloudflare-pages
Copy link

cloudflare-pages bot commented Aug 29, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3f0374e
Status: ✅  Deploy successful!
Preview URL: https://ac06795b.pydantic-docs2.pages.dev
Branch Preview URL: https://dmontagu-generic-hashing.pydantic-docs2.pages.dev

View logs

class C(B):
pass

assert get_attribute_from_bases(C, 'x') == 2
Copy link
Contributor Author

@dmontagu dmontagu Aug 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently on the main branch, this returns 1 @adriangb

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wow I’m very glad you caught this 🙈

@dmontagu
Copy link
Contributor Author

please review

Copy link
Member

@adriangb adriangb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work @dmontagu !

@adriangb adriangb merged commit 2b8bea3 into main Aug 29, 2023
50 checks passed
@adriangb adriangb deleted the dmontagu/generic-hashing branch August 29, 2023 04:17
@davidhewitt davidhewitt added the relnotes-fix Used for bugfixes. label Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generic type annotation breakes hashing at runtime
4 participants