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

Add a check on the existence of __qualname__ #8642

Merged
merged 2 commits into from Jan 26, 2024

Conversation

anci3ntr0ck
Copy link
Contributor

@anci3ntr0ck anci3ntr0ck commented Jan 26, 2024

Change Summary

Add a check on the existence of __qualname__ in the namespace in function inspect_namespace, to avoid unexpected KeyError when setting a type-type default value in create_model, which type is defined in the same module.

Related issue number

Fix #8633

Checklist

  • The pull request title is a good summary of the changes - it will be used in the changelog
  • Unit tests for the changes exist
  • Tests pass on CI
  • Documentation reflects the changes where applicable
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

Selected Reviewer: @sydney-runkle

Selected Reviewer: @Kludex

@anci3ntr0ck
Copy link
Contributor Author

please review

Copy link

codspeed-hq bot commented Jan 26, 2024

CodSpeed Performance Report

Merging #8642 will not alter performance

Comparing anci3ntr0ck:fix-qualname-existence-check (e73cccb) with main (2792775)

Summary

✅ 10 untouched benchmarks

@anci3ntr0ck
Copy link
Contributor Author

anci3ntr0ck commented Jan 26, 2024

sry, just forget to add labels🙃 or labels should be added by maintainers🤔?

@sydney-runkle sydney-runkle added the relnotes-fix Used for bugfixes. label Jan 26, 2024
Copy link
Member

@sydney-runkle sydney-runkle left a comment

Choose a reason for hiding this comment

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

Looks great overall - just added one slight modification to the test to verify that the default is assigned as expected :).

Thanks for your contribution - we're super excited to have you as a contributor to the pydantic repo! 🚀

tests/test_create_model.py Outdated Show resolved Hide resolved
@sydney-runkle sydney-runkle merged commit 57922ba into pydantic:main Jan 26, 2024
53 checks passed
@anci3ntr0ck anci3ntr0ck deleted the fix-qualname-existence-check branch January 26, 2024 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants