The Wire · Showcase
PYDANTIC PATCHES GARBAGE COLLECTION LEAKS IN CORE STRUCTS
By RepoJournal · Filed · About FastAPI & Pydantic
Pydantic shipped fixes for missing GC traversal on pydantic-core struct fields that could cause memory leaks in long-running applications.
The core issue surfaces in two places: missing GC traversal on some pydantic-core struct fields [1] and a separate traversal gap in GeneralFieldsSerializer [2]. Both fixes are shipping in the same window, so upgrade together. On the FastAPI side, Yurii Motov corrected a workflow configuration error where the zizmor.yml file referenced the wrong default branch [4], a small fix but the kind that breaks CI silently if missed. Pydantic also landed a JSON schema fix for bool discriminators [3] that normalizes mapping keys to proper JSON representation (lowercase true/false instead of Python-style True/False), ensuring OpenAPI compatibility. The Pydantic fixes address both memory safety and spec compliance in a single push.
One email a day. Unsubscribe in one click.
Keep up with FastAPI & Pydantic in about 3 minutes a day: what actually shipped — the commits, pull requests, releases, and security advisories that matter.
One email a day. Unsubscribe in one click. Read a past issue →
Action items
- → Check if your Pydantic models use discriminated unions with bool fields and regenerate JSON schemas pydantic/pydantic [plan]
- → Monitor for GC traversal fixes in next Pydantic release and test with long-running services pydantic/pydantic [monitor]
- → Verify FastAPI workflows use correct default branch name if you've forked the repo fastapi/fastapi [plan]
References
- [1] Fix missing GC traversal on some `pydantic-core` struct fields ↗ pydantic/pydantic
- [2] Fix missing GC traversal in `pydantic-core` for `GeneralFieldsSerializer` (#13629) pydantic/pydantic
- [3] Fix JSON schema discriminator mapping keys for `bool` discriminators ↗ pydantic/pydantic
- [4] 👷 Fix branch name in `zizmor.yml` workflow (`main` -> `master`) (#16178) fastapi/fastapi