Jump to solution
Verify

The Fix

pip install pydantic==1.10.17

Based on closed pydantic/pydantic issue #9663 · PR/commit linked

Production note: This usually shows up under retries/timeouts. Treat it as a side-effect risk until you can verify behavior with a canary + real traffic.

Jump to Verify Open PR/Commit
@@ -1,130 +0,0 @@ @@ -1,130 +0,0 @@ -# NOTE This file aliases the pydantic namespace as pydantic.v1 for smoother v1 -> v2 transition -# flake8: noqa -import importlib
repro.py
FAILED tests/test_validators.py::test_make_generic_validator[fields0-_v_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields1-_v_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields2-_v_,_field_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields3-_v_,_config_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields4-_v_,_values_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields5-_v_,_field_,_config_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields6-_v_,_field_,_values_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields7-_v_,_config_,_values_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields8-_v_,_field_,_values_,_config_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields9-_cls_,_v_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields10-_cls_,_v_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields11-_cls_,_v_,_field_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields12-_cls_,_v_,_config_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields13-_cls_,_v_,_values_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields14-_cls_,_v_,_field_,_config_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields15-_cls_,_v_,_field_,_values_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields16-_cls_,_v_,_config_,_values_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields17-_cls_,_v_,_field_,_values_,_config_] - KeyError: 'testing_function' tests/test_validators.py ⨯ 96% █████████▋ ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― test_make_generic_validator[fields17-_cls_,_v_,_field_,_values_,_config_] ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― fields = ['cls', 'val', 'field', 'values', 'config'], result = '_cls_,_v_,_field_,_values_,_config_' @pytest.mark.parametrize( 'fields,result', [ (['val'], '_v_'), (['foobar'], '_v_'), (['val', 'field'], '_v_,_field_'), (['val', 'config'], '_v_,_config_'), (['val', 'values'], '_v_,_values_'), (['val', 'field', 'config'], '_v_,_field_,_config_'), (['val', 'field', 'values'], '_v_,_field_,_values_'), (['val', 'config', 'values'], '_v_,_config_,_values_'), (['val', 'field', 'values', 'config'], '_v_,_field_,_values_,_config_'), (['cls', 'val'], '_cls_,_v_'), (['cls', 'foobar'], '_cls_,_v_'), (['cls', 'val', 'field'], '_cls_,_v_,_field_'), (['cls', 'val', 'config'], '_cls_,_v_,_config_'), (['cls', 'val', 'values'], '_cls_,_v_,_value ... (truncated) ...
verify
Re-run the failing test: pytest tests/test_private_attributes.py::test_private_attribute_annotation
fix.md
Option A — Upgrade to fixed release\npip install pydantic==1.10.17\nWhen NOT to use: Do not use if it changes public behavior or if the failure cannot be reproduced.\n\n

Why This Fix Works in Production

  • Trigger: FAILED tests/test_private_attributes.py::test_private_attribute_annotation - AssertionError: assert {'__firstline...attributes__'} == {'__foo__'}
  • Mechanism: Mirrors modules in the `v1` namespace to fix typing and object resolution issues in Python versions greater than 3.11.
  • Why the fix works: Mirrors modules in the `v1` namespace to fix typing and object resolution issues in Python versions greater than 3.11. (first fixed release: 1.10.17).
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

  • Triggered by an upgrade/regression window: 1.10.16–3.13 breaks; 1.10.17 is the first fixed release.
  • Shows up under Python 3.13 in real deployments (not just unit tests).
  • Surfaces as: FAILED tests/test_private_attributes.py::test_private_attribute_annotation - AssertionError: assert {'__firstline...attributes__'} == {'__foo__'}

Proof / Evidence

  • GitHub issue: #9663
  • Fix PR: https://github.com/pydantic/pydantic/pull/9660
  • First fixed release: 1.10.17
  • Affected versions: 1.10.16–3.13
  • 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.27

Discussion

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

“Home Assistant is on v1 because only some integrations have been updated (see https://github.com/home-assistant/core/issues/99218)”
@bdraco · 2024-06-17 · confirmation · source
“@vfazio, Thanks for organizing discussion around this issue”
@sydney-runkle · 2024-06-17 · source
“A decision should probably be made prior to a new tag. https://github.com/pydantic/pydantic/pull/9660 may be important enough to drive that to allow v1 users to adopt…”
@vfazio · 2024-06-17 · source
“For the Cython error: https://github.com/cython/cython/pull/6084”
@vfazio · 2024-06-17 · source

Failure Signature (Search String)

  • FAILED tests/test_private_attributes.py::test_private_attribute_annotation - AssertionError: assert {'__firstline...attributes__'} == {'__foo__'}

Error Message

Stack trace
error.txt
Error Message ------------- FAILED tests/test_private_attributes.py::test_private_attribute_annotation - AssertionError: assert {'__firstline...attributes__'} == {'__foo__'} FAILED tests/test_private_attributes.py::test_underscore_attrs_are_private - AssertionError: assert {'__firstline...attributes__'} == {'__foo__'} def test_private_attribute_annotation(): class Model(BaseModel): """The best model""" __foo__: str class Config: underscore_attrs_are_private = True assert Model.__slots__ == {'__foo__'} E AssertionError: assert {'__firstline...attributes__'} == {'__foo__'} E Extra items in the left set: E '__static_attributes__' E '__firstlineno__' E Use -v to get more diff tests/test_private_attributes.py:66: AssertionError tests/test_private_attributes.py ⨯ 55% █████▌ ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― test_underscore_attrs_are_private ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― def test_underscore_attrs_are_private(): cla ... (truncated) ...

Minimal Reproduction

repro.py
FAILED tests/test_validators.py::test_make_generic_validator[fields0-_v_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields1-_v_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields2-_v_,_field_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields3-_v_,_config_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields4-_v_,_values_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields5-_v_,_field_,_config_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields6-_v_,_field_,_values_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields7-_v_,_config_,_values_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields8-_v_,_field_,_values_,_config_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields9-_cls_,_v_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields10-_cls_,_v_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields11-_cls_,_v_,_field_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields12-_cls_,_v_,_config_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields13-_cls_,_v_,_values_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields14-_cls_,_v_,_field_,_config_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields15-_cls_,_v_,_field_,_values_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields16-_cls_,_v_,_config_,_values_] - KeyError: 'testing_function' FAILED tests/test_validators.py::test_make_generic_validator[fields17-_cls_,_v_,_field_,_values_,_config_] - KeyError: 'testing_function' tests/test_validators.py ⨯ 96% █████████▋ ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― test_make_generic_validator[fields17-_cls_,_v_,_field_,_values_,_config_] ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― fields = ['cls', 'val', 'field', 'values', 'config'], result = '_cls_,_v_,_field_,_values_,_config_' @pytest.mark.parametrize( 'fields,result', [ (['val'], '_v_'), (['foobar'], '_v_'), (['val', 'field'], '_v_,_field_'), (['val', 'config'], '_v_,_config_'), (['val', 'values'], '_v_,_values_'), (['val', 'field', 'config'], '_v_,_field_,_config_'), (['val', 'field', 'values'], '_v_,_field_,_values_'), (['val', 'config', 'values'], '_v_,_config_,_values_'), (['val', 'field', 'values', 'config'], '_v_,_field_,_values_,_config_'), (['cls', 'val'], '_cls_,_v_'), (['cls', 'foobar'], '_cls_,_v_'), (['cls', 'val', 'field'], '_cls_,_v_,_field_'), (['cls', 'val', 'config'], '_cls_,_v_,_config_'), (['cls', 'val', 'values'], '_cls_,_v_,_value ... (truncated) ...

Environment

  • Python: 3.13
  • Pydantic: 1

Fix Options (Details)

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

pip install pydantic==1.10.17

When NOT to use: Do not use if it changes public behavior or if the failure cannot be reproduced.

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

First fixed release: 1.10.17

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

  • Do not use if it changes public behavior or if the failure cannot be reproduced.

Verify Fix

verify
Re-run the failing test: pytest tests/test_private_attributes.py::test_private_attribute_annotation

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.16 Broken
3.13 Broken
1.10.17 Fixed

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.