The Fix
pip install pydantic==1.10.19
Based on closed pydantic/pydantic issue #10711 · PR/commit linked
@@ -12,10 +12,10 @@
from pydantic_core import CoreSchema, core_schema
from pydantic_core import validate_core_schema as _validate_core_schema
-from typing_extensions import TypeAliasType, TypeGuard, get_args, get_origin
+from typing_extensions import TypeGuard, get_args, get_origin
# Cause
from typing_extensions import TypeAliasType
type Int = int # creates typing.TypeAliasType
assert isinstance(Int, TypeAliasType) # fails
# Failing tests:
# tests/test_forward_ref.py:1261 test_class_locals_are_kept_during_schema_generation
from pydantic import BaseModel
class Model(BaseModel):
type Test = int
a: 'Test | Forward'
# tests/test_edge_cases.py:2875 test_nested_type_statement
from pydantic import BaseModel
class A(BaseModel):
type Int = int
a: Int
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Upgrade to fixed release\npip install pydantic==1.10.19\nWhen NOT to use: Do not apply this fix if using versions of typing_extensions prior to the backport.\n\n
Why This Fix Works in Production
- Trigger: Recent `typing_extensions.TypeAliasType` backport causing tests to fail.
- Mechanism: Recent changes in typing_extensions introduced TypeAliasType, causing compatibility issues with Pydantic
- Why the fix works: Adds support for the recent `typing_extensions.TypeAliasType` that was causing tests to fail. (first fixed release: 1.10.19).
- If left unfixed, this can cause silent data inconsistencies that propagate (bad cache entries, incorrect downstream decisions).
Why This Breaks in Prod
- Shows up under Python 3.12 in real deployments (not just unit tests).
- Recent changes in typing_extensions introduced TypeAliasType, causing compatibility issues with Pydantic
- Production symptom (often without a traceback): Recent `typing_extensions.TypeAliasType` backport causing tests to fail.
Proof / Evidence
- GitHub issue: #10711
- Fix PR: https://github.com/pydantic/pydantic/pull/10713
- First fixed release: 1.10.19
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.56
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“### Initial Checks - [X] I confirm that I'm using Pydantic V2 ### Description See the related issue https://github.com/python/typing_extensions/issues/493#issuecomment-2437746930 and PR https://github.com/python/typing_extensions/pull/477 w”
Failure Signature (Search String)
- Recent `typing_extensions.TypeAliasType` backport causing tests to fail.
- assert isinstance(Int, TypeAliasType) # fails
Copy-friendly signature
Failure Signature
-----------------
Recent `typing_extensions.TypeAliasType` backport causing tests to fail.
assert isinstance(Int, TypeAliasType) # fails
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Recent `typing_extensions.TypeAliasType` backport causing tests to fail.
assert isinstance(Int, TypeAliasType) # fails
Minimal Reproduction
# Cause
from typing_extensions import TypeAliasType
type Int = int # creates typing.TypeAliasType
assert isinstance(Int, TypeAliasType) # fails
# Failing tests:
# tests/test_forward_ref.py:1261 test_class_locals_are_kept_during_schema_generation
from pydantic import BaseModel
class Model(BaseModel):
type Test = int
a: 'Test | Forward'
# tests/test_edge_cases.py:2875 test_nested_type_statement
from pydantic import BaseModel
class A(BaseModel):
type Int = int
a: Int
Environment
- Python: 3.12
- Pydantic: 2
What Broke
Tests fail for Pydantic models using TypeAliasType, impacting CI/CD pipelines.
Why It Broke
Recent changes in typing_extensions introduced TypeAliasType, causing compatibility issues with Pydantic
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==1.10.19
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Fix reference: https://github.com/pydantic/pydantic/pull/10713
First fixed release: 1.10.19
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- Do not apply this fix if using versions of typing_extensions prior to the backport.
Verify Fix
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Did This Fix Work in Your Case?
Quick signal helps us prioritize which fixes to verify and improve.
Prevention
- Add a CI check that diffs key outputs after upgrades (OpenAPI schema snapshots, JSON payload shapes, CLI output).
- Upgrade behind a canary and run integration tests against the canary before 100% rollout.
Version Compatibility Table
| Version | Status |
|---|---|
| 1.10.19 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.