Pydantic v2.14.2

v2.14.2

v2.14.2 2026-10-29

Added 1
  • Publish pydantic-core wheels for PyPy 8.0 (pp80 ABI)
Changed 6
  • Bump PyO3 to 0.30.1, jiter to 0.18.0, and use PyFrozenDict
  • Bump speedate to v0.18.0
  • Avoid Python tuple allocation during model fields validation
  • Lazily call repr of values during nested union serialization
  • Skip decorator field checks when no field decorators exist
  • Avoid heap allocation for small JSON model field buffers
Fixed 12
  • Fix unpickling of generic classes defined in separate module
  • Support explicit by_alias overriding validate_by_alias in validation JSON schemas
  • Fix mypy plugin crash on deferred empty model
  • Fix infinite recursion when validating an invalid default with PydanticUseDefault
  • Implement recursion guard for validate_strings()
  • Support named tuples in Sequence serialization
Security 2
  • JSON validation by iteration now handles field lookup and extra data consistently with Python validation, so keys matching only an unused alias or field name are treated as extra data instead of being silently dropped
  • Extra data matching a field name is ignored in TypedDict and dataclasses with extra=allow

1 change to check, marked in the notes below

From Pydantic

v2.14.2 (2026-10-29)

This release addresses 2 security issues, https://github.com/pydantic/pydantic/security/advisories/GHSA-qpmf-fgh3-ff25 and https://github.com/pydantic/pydantic/security/advisories/GHSA-3r8g-cqwr-jr29.

Packaging
  • Bump PyO3 to 0.30.1, jiter to 0.18.0, use PyFrozenDict by @Viicos in #14003
  • Bump speedate to v0.18.0 by @Viicos in #14007
  • Publish pydantic-core wheels for PyPy 8.0 (pp80 ABI) by @Viicos in #14083
Performance
  • Avoid Python tuple allocation during model fields validation by @Viicos in #13955
  • Lazily call repr of values during nested union serialization by @Viicos in #14082
  • Skip decorator field checks when no field decorators exist by @alexmojaki in #14111
  • Avoid heap allocation for small JSON model field buffers by @alexmojaki in #14113
Fixes
  • Make JSON validation by iteration consistent with Python approach by @davidhewitt in #13275.

    JSON validation now handles field lookup and extra data the same way as Python validation. In particular, keys that only match an unused alias or field name are now treated as extra data, instead of being silently dropped: behavior changed · inferred

    from pydantic import BaseModel, ConfigDict
    from pydantic.alias_generators import to_camel
    
    
    class Page(BaseModel):
        model_config = ConfigDict(extra='forbid', alias_generator=to_camel)
    
        page_size: int = 10
    
    
    Page.model_validate_json('{"page_size": 50}')
    # Before: Page(page_size=10)
    # After: ValidationError (extra_forbidden)
    

    See the pull request for the full list of behavior changes. This change addresses https://github.com/pydantic/pydantic/security/advisories/GHSA-qpmf-fgh3-ff25.

  • Ignore extra data matching a field name in TypedDict and dataclasses with extra=allow by @Viicos in #14090. Addresses https://github.com/pydantic/pydantic/security/advisories/GHSA-3r8g-cqwr-jr29.

  • Fix unpickling of generic classes defined in separate module by @Viicos in #13994

  • Support explicit by_alias overriding validate_by_alias in validation JSON schemas by @Viicos in #13997

  • Fix mypy plugin crash on deferred empty model by @ilevkivskyi in #14027

  • Fix infinite recursion when validating an invalid default with PydanticUseDefault by @Viicos in #14028

  • Implement recursion guard for validate_strings() by @Viicos in #14029

  • Support named tuples in Sequence serialization by @Viicos in #14033

  • Take preserve_empty_path into account in URL types equality by @Viicos in #14035

  • Fix pickling of PydanticCustomError and ValidationErrors containing custom errors by @Viicos in #14051

  • Do not extract attribute docstrings from nested classes and functions by @Viicos in #14052

  • Fix forward annotations evaluation and type variables substitution when rebuilding parametrized generic models by @Viicos in #14054

  • Fix Self resolution in parametrized generics by @Viicos in #14065

  • Check mapping max_length constraint during validation by @Viicos in #14092

  • Fix deep copy of self-referential models by @Viicos in #14116

Full Changelog: https://github.com/pydantic/pydantic/compare/v2.14.1...v2.14.2

View original

Upgraded? How did it go?

Discussion