Jump to solution
Verify

The Fix

pip install pydantic==1.10.19

Based on closed pydantic/pydantic issue #10497 · 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%.

Jump to Verify Open PR/Commit
@@ -1,4 +1,9 @@ @@ -1,4 +1,9 @@ +import warnings + +import pytest
repro.py
import pydantic, pydantic.v1, warnings class Foo(pydantic.BaseModel): bar: str foo = Foo(bar="txt") warnings.simplefilter("error") isinstance(foo, pydantic.v1.BaseModel)
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
Option A — Upgrade to fixed release\npip install pydantic==1.10.19\nWhen NOT to use: This fix is not suitable for applications that require strict adherence to warning suppression.\n\n

Why This Fix Works in Production

  • Trigger: isinstance(foo, pydantic.v1.BaseModel)
  • Mechanism: The isinstance check in Pydantic v1 raises a deprecation warning when checking instances of v2 models
  • Why the fix works: Adds a test for the deprecation warning in the V1 isinstance check, addressing the issue where Pydantic's v1 ModelMetaclass raises a DeprecationWarning when checking instances of v2 models. (first fixed release: 1.10.19).
Production impact:
  • 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.9 in real deployments (not just unit tests).
  • The isinstance check in Pydantic v1 raises a deprecation warning when checking instances of v2 models
  • Surfaces as: Traceback (most recent call last):

Proof / Evidence

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“Yep, we can definitely fix this. Would you be willing to submit a PR with a fix? Thanks for catching this!”
@sydney-runkle · 2024-09-27 · source
“Which of the three options for fixing it would you suggest I try?”
@alicederyn · 2024-09-27 · source
“> One option would be to wrap this hasattr call in a catch_warnings block and ignore this warning. Let's do this, and catch the deprecation…”
@sydney-runkle · 2024-09-27 · source
“The only downside is, I'm not sure how expensive that is, and I think the point of this callsite was to be fast.”
@alicederyn · 2024-09-27 · source

Failure Signature (Search String)

  • isinstance(foo, pydantic.v1.BaseModel)

Error Message

Stack trace
error.txt
Error Message ------------- Traceback (most recent call last): File "example.py", line 9, in <module> isinstance(foo, pydantic.v1.BaseModel) File "pydantic/v1/main.py", line 304, in __instancecheck__ return hasattr(instance, '__fields__') and super().__instancecheck__(instance) File "pydantic/main.py", line 1090, in __fields__ warnings.warn( pydantic.warnings.PydanticDeprecatedSince20: The `__fields__` attribute is deprecated, use `model_fields` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.10/migration/

Minimal Reproduction

repro.py
import pydantic, pydantic.v1, warnings class Foo(pydantic.BaseModel): bar: str foo = Foo(bar="txt") warnings.simplefilter("error") isinstance(foo, pydantic.v1.BaseModel)

Environment

  • Python: 3.9
  • Pydantic: 2

What Broke

Users encounter deprecation warnings during instance checks, disrupting test runs.

Why It Broke

The isinstance check in Pydantic v1 raises a deprecation warning when checking instances of v2 models

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

pip install pydantic==1.10.19

When NOT to use: This fix is not suitable for applications that require strict adherence to warning suppression.

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/10642

First fixed release: 1.10.19

Last verified: 2026-02-09. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • This fix is not suitable for applications that require strict adherence to warning suppression.

Verify Fix

verify
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

VersionStatus
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.