Skip to content

Warn if registering virtual subclasses on Pydantic models #11669

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Viicos
Copy link
Member

@Viicos Viicos commented Apr 1, 2025

Change Summary

Fixes #11605.

I'll wait for the outcome of python/cpython#131914 as we might be able to conditionally have this logic depending on the Python version.

Related issue number

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

@github-actions github-actions bot added the relnotes-fix Used for bugfixes. label Apr 1, 2025
Copy link

codspeed-hq bot commented Apr 1, 2025

CodSpeed Performance Report

Merging #11669 will improve performances by ×4.2

Comparing abc-checks (dd1bee6) with main (6c38dc9)

Summary

⚡ 6 improvements
✅ 40 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
test_efficiency_with_highly_nested_examples 696.3 µs 649.2 µs +7.26%
test_isinstance_basemodel 26.7 ms 6.3 ms ×4.2
test_list_of_models_validation[__init__] 80.5 µs 76.4 µs +5.39%
test_list_of_models_validation[model_validate] 78.7 µs 74.3 µs +5.92%
test_simple_model_validation[model_validate] 40.8 µs 38.3 µs +6.76%
test_north_star_validate_python_strict 22.7 ms 21.6 ms +5.46%

Copy link
Contributor

github-actions bot commented Apr 1, 2025

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  pydantic/_internal
  _model_construction.py 284-289
Project Total  

This report was generated by python-coverage-comment-action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes-fix Used for bugfixes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pydantic using abc which can have memory and performance issues
1 participant