The Fix
pip install pydantic==1.10.18
Based on closed pydantic/pydantic issue #8652 · PR/commit linked
@@ -89,6 +89,7 @@ class ConfigWrapper:
use_attribute_docstrings: bool
cache_strings: bool | Literal['all', 'keys', 'none']
+ experimental_fast_build: bool
def __init__(self, config: ConfigDict | dict[str, Any] | type[Any] | None, *, check: bool = True):
from pydantic import BaseModel
class Model(BaseModel):
name: str
surname: str
age: int
m = Model(
name="Antonis",
surname="Agapiou",
age=27
)
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.18\nWhen NOT to use: This fix may not be suitable for applications relying on specific memory behaviors.\n\n
Why This Fix Works in Production
- Trigger: schema = cls.model_json_schema()["properties"]
- Mechanism: Pydantic V2 has higher memory allocation due to changes in model building logic
- Why the fix works: Introduced an experimental feature to opt-in for faster model builds, addressing memory allocation issues reported in Pydantic V2. (first fixed release: 1.10.18).
Why This Breaks in Prod
- Shows up under Python 3.11 in real deployments (not just unit tests).
- Pydantic V2 has higher memory allocation due to changes in model building logic
- Production symptom (often without a traceback): schema = cls.model_json_schema()["properties"]
Proof / Evidence
- GitHub issue: #8652
- Fix PR: https://github.com/pydantic/pydantic/pull/10064
- First fixed release: 1.10.18
- 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.72
Verified Execution
We executed the runnable minimal repro in a temporary environment and captured exit codes + logs.
- Status: PASS
- Ran: 2026-02-11T16:52:29Z
- Package: pydantic
- Fixed: 1.10.18
- Mode: fixed_only
- Outcome: ok
Logs
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“@matejkloska the problem is that we need a beta release of PyO3 to build from so that pydantic-core can be packaged by linux distros that…”
“Memory usage will probably be significantly reduced by https://github.com/pydantic/pydantic-core/pull/1085. More detail to come.”
“@samuelcolvin thanks for the info! Please, is there any ETA for release? We notice the same issue while upgrading our codebase 🙏”
“This is amazing 🤩, I'm really looking forward to 2.7.”
Failure Signature (Search String)
- schema = cls.model_json_schema()["properties"]
- for field, attributes in schema.items():
Copy-friendly signature
Failure Signature
-----------------
schema = cls.model_json_schema()["properties"]
for field, attributes in schema.items():
Error Message
Signature-only (no traceback captured)
Error Message
-------------
schema = cls.model_json_schema()["properties"]
for field, attributes in schema.items():
Minimal Reproduction
from pydantic import BaseModel
class Model(BaseModel):
name: str
surname: str
age: int
m = Model(
name="Antonis",
surname="Agapiou",
age=27
)
Environment
- Python: 3.11
- Pydantic: 2
What Broke
Increased memory usage leading to potential application slowdowns or crashes.
Why It Broke
Pydantic V2 has higher memory allocation due to changes in model building logic
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==1.10.18
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/10064
First fixed release: 1.10.18
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix may not be suitable for applications relying on specific memory behaviors.
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.
- Track RSS + object counts after deployments; alert on monotonic growth and GC pressure.
- Add a long-running test that repeats the failing call path and asserts stable memory.
Version Compatibility Table
| Version | Status |
|---|---|
| 1.10.18 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.