Bug report
Bug description:
This works:
class customdict(dict):
def __missing__(self, key):
return key
code = compile("type Alias = undefined", "test", "exec")
ns = customdict()
exec(code, ns)
Alias = ns["Alias"]
assert Alias.__value__ == "undefined"
But this does not:
code = compile("class A: type Alias = undefined", "test", "exec")
ns = customdict()
exec(code, ns)
Alias = ns["A"].Alias
assert Alias.__value__ == "undefined"
This is a problem for PEP 649 because we're going to rely on a non-dict globals namespace.
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs