The Fix
pip install pydantic==2.9.2
Based on closed pydantic/pydantic issue #10384 · PR/commit linked
Production note: Most teams hit this during upgrades or environment changes. Roll out with a canary and smoke critical endpoints (health, OpenAPI/docs) before 100%.
@@ -690,7 +690,7 @@ def set_deprecated_descriptors(cls: type[BaseModel]) -> None:
class _DeprecatedFieldDescriptor:
- """Data descriptor used to emit a runtime deprecation warning before accessing a deprecated field.
+ """Read-only data descriptor used to emit a runtime deprecation warning before accessing a deprecated field.
from pydantic import BaseModel, computed_field
class A(BaseModel):
name: str
@computed_field(deprecated=True)
def resolved_name(self) -> str:
return self.name.upper()
class B(A): ...
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==2.9.2\nWhen NOT to use: This fix should not be applied if the model does not contain deprecated computed fields.\n\n
Why This Fix Works in Production
- Trigger: return getattr(tp, name)
- Mechanism: Subclassing models with deprecated computed fields caused an AttributeError during model construction
- Why the fix works: Fix class access of deprecated computed fields to allow subclassing models with deprecated computed fields. (first fixed release: 2.9.2).
- If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.
Why This Breaks in Prod
- Shows up under Python 3.11 in real deployments (not just unit tests).
- Subclassing models with deprecated computed fields caused an AttributeError during model construction
- Surfaces as: Traceback (most recent call last):
Proof / Evidence
- GitHub issue: #10384
- Fix PR: https://github.com/pydantic/pydantic/pull/10391
- First fixed release: 2.9.2
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.95
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.37
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Thanks for the bug report, I'll work on fix.”
Failure Signature (Search String)
- return getattr(tp, name)
Error Message
Stack trace
Error Message
-------------
Traceback (most recent call last):
File "~/.pyenv/versions/bikeshed/lib/python3.11/site-packages/pydantic/_internal/_decorators.py", line 382, in get_attribute_from_bases
return getattr(tp, name)
^^^^^^^^^^^^^^^^^
File "~/.pyenv/versions/bikeshed/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py", line 262, in __getattr__
raise AttributeError(item)
AttributeError: resolved_name
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "~/example.py", line 12, in <module>
class B(A): ...
File "~/.pyenv/versions/bikeshed/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py", line 154, in __new__
cls.__pydantic_decorators__ = DecoratorInfos.build(cls)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "~/.pyenv/versions/bikeshed/lib/python3.11/site-packages/pydantic/_internal/_decorators.py", line 450, in build
res.computed_fields.update({k: v.bind_to_cls(model_dc) for k, v in existing.computed_fields.items()})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "~/.pyenv/versions/bikeshed/lib/python3.11/site-packages/pydantic/_internal/_decorators.py", line 450, in <dictcomp>
res.computed_fields.update({k: v.bind_to_cls(model_dc) for k, v in existing.computed_fields.items()
... (truncated) ...
Minimal Reproduction
from pydantic import BaseModel, computed_field
class A(BaseModel):
name: str
@computed_field(deprecated=True)
def resolved_name(self) -> str:
return self.name.upper()
class B(A): ...
Environment
- Python: 3.11
- Pydantic: 2
What Broke
Attempting to subclass a model resulted in runtime errors, preventing proper model usage.
Why It Broke
Subclassing models with deprecated computed fields caused an AttributeError during model construction
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==2.9.2
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/10391
First fixed release: 2.9.2
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be applied if the model does not contain deprecated computed fields.
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 |
|---|---|
| 2.9.2 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.