Question Details

No question body available.

Tags

python python-typing pep-695

Answers (1)

Accepted Answer Available
Accepted Answer
May 16, 2026 Score: 5 Rep: 124,188 Quality: High Completeness: 70%

It's a known bug; as Alex Waygood explains in python/cpython#114053:

I suppose the problem is probably that gettypehints looks things up in the global scope but doesn't look things up in the new annotation scopes introduced by PEP-695. The old way of defining TypeVars doesn't suffer from this because TypeVars were defined in the global scope; now they aren't.

It was fixed in version 3.12.5.