gh-138425: Correctly partially evaluate global generics with undefined params in ref.evaluate(format=Format.FORWARDREF) (#138430)

Co-authored-by: sobolevn <mail@sobolevn.me>
This commit is contained in:
dr-carlos 2025-11-03 09:45:47 +10:30 committed by GitHub
parent 31de83d5e2
commit e66f87ca73
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 32 additions and 1 deletions

View file

@ -187,8 +187,11 @@ def evaluate(
except Exception:
if not is_forwardref_format:
raise
# All variables, in scoping order, should be checked before
# triggering __missing__ to create a _Stringifier.
new_locals = _StringifierDict(
{**builtins.__dict__, **locals},
{**builtins.__dict__, **globals, **locals},
globals=globals,
owner=owner,
is_class=self.__forward_is_class__,