Skip to content

Make sure None is converted as NoneType in Python 3.14#12370

Merged
Viicos merged 1 commit intomainfrom
none-type-conversion
Oct 13, 2025
Merged

Make sure None is converted as NoneType in Python 3.14#12370
Viicos merged 1 commit intomainfrom
none-type-conversion

Conversation

@Viicos
Copy link
Copy Markdown
Member

@Viicos Viicos commented Oct 9, 2025

Change Summary

Fixes #12368.

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 relnotes-fix Used for bugfixes. backport-2.13 Needs backport to 2.13 labels Oct 9, 2025
@github-actions github-actions Bot added the relnotes-packaging Used for dependency changes. label Oct 9, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Oct 9, 2025

Coverage report

Click to see where and how coverage changed

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

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

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Oct 9, 2025

CodSpeed Performance Report

Merging #12370 will not alter performance

Comparing none-type-conversion (1e45c28) with main (024e292)

Summary

✅ 46 untouched

) -> Any:
if sys.version_info >= (3, 13):
if sys.version_info >= (3, 14):
# Starting in 3.14, `_eval_type()` does *not* apply `_type_convert()`
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Did _type_convert() do anything else, do those cases also matter?

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.

It converts str values to forward refs, but this is already handled by _eval_type() so after calling it we are guaranteed to not have to deal with forward refs anymore.

@Viicos Viicos removed the relnotes-packaging Used for dependency changes. label Oct 11, 2025
@Viicos Viicos merged commit d441b13 into main Oct 13, 2025
66 checks passed
@Viicos Viicos deleted the none-type-conversion branch October 13, 2025 09:44
@o-santi
Copy link
Copy Markdown

o-santi commented Oct 13, 2025

Thank you for fixing it so quickly. Is there any timeline on when this will get released into a new pydantic version?

@Viicos
Copy link
Copy Markdown
Member Author

Viicos commented Oct 13, 2025

We are aiming for a first patch release today.

Viicos added a commit that referenced this pull request Oct 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-2.13 Needs backport to 2.13 relnotes-fix Used for bugfixes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2.12.0: None: None throws an error

3 participants