Skip to content

Remove support for eval_type_backport() - #13133

Merged
Viicos merged 2 commits into
mainfrom
vp/remove-eval-type-backport
May 12, 2026
Merged

Viicos merged 2 commits into
mainfrom
vp/remove-eval-type-backport

Conversation

@Viicos

@Viicos Viicos commented Apr 30, 2026 •

Copy link
Copy Markdown
Member

Change Summary

Fixes #10565 along the way, and clean up all the eval_type logic.

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

@Viicos Viicos added the relnotes-change Used for changes to existing functionality which don't have a better categorization. label Apr 30, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Apr 30, 2026 •

Copy link
Copy Markdown

Deploying pydantic-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 643b3f6
Status: ✅  Deploy successful!
Preview URL: https://8673f31a.pydantic-docs.pages.dev
Branch Preview URL: https://vp-remove-eval-type-backport.pydantic-docs.pages.dev

View logs

@Viicos
Viicos force-pushed the vp/remove-eval-type-backport branch from 8bfea5a to 6af17bd Compare April 30, 2026 21:12
@codspeed

codspeed Bot commented Apr 30, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 22.03%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 2 improved benchmarks
✅ 213 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ test_tagged_union_with_callable_discriminator_schema_generation 1.1 ms 1.1 ms +8.36%
⚡ test_simple_recursive_model_schema_generation 771.2 µs 632 µs +22.03%

Comparing vp/remove-eval-type-backport (643b3f6) with main (5c63f86)

Open in CodSpeed

@github-actions

github-actions Bot commented Apr 30, 2026 •

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  pydantic/_internal
  _generate_schema.py
  _model_construction.py
  _typing_extra.py 436
Project Total  

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

@Viicos
Viicos force-pushed the vp/remove-eval-type-backport branch from 6af17bd to 3e37517 Compare May 1, 2026 06:50
@Viicos
Viicos force-pushed the vp/remove-eval-type-backport branch from 3e37517 to 9a56d43 Compare May 3, 2026 12:25
@Viicos
Viicos requested a review from davidhewitt May 4, 2026 14:08
@Viicos
Viicos force-pushed the vp/remove-eval-type-backport branch from d6e4386 to 9a56d43 Compare May 5, 2026 10:29
Comment thread pydantic/_internal/_typing_extra.py Outdated
) -> Any:
"""Evaluate the annotation using the provided namespaces.

This function relies on our own backport of `typing._eval_type()`, and provide better error messages

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is our _eval_type below really a "backport"? Looks like it just makes sure we call _eval_type with the right arguments on each Python version, rather than bringing new features to older versions.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think I meant vendored, I updated it.

Comment thread pydantic/_internal/_typing_extra.py Outdated
Comment thread pydantic/_internal/_typing_extra.py Outdated
@Viicos
Viicos merged commit 8a1a222 into main May 12, 2026
79 checks passed
@Viicos
Viicos deleted the vp/remove-eval-type-backport branch May 12, 2026 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

relnotes-change Used for changes to existing functionality which don't have a better categorization.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unhelpful AssertionError when encountering a TypeError when evaluating a forward annotation since 2.9

2 participants