Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Bug report
Bug description:
This works:
classcustomdict(dict):def__missing__(self,key):returnkeycode=compile("type Alias = undefined","test","exec")ns=customdict()exec(code,ns)Alias=ns["Alias"]assertAlias.__value__=="undefined"
But this does not:
code=compile("class A: type Alias = undefined","test","exec")ns=customdict()exec(code,ns)Alias=ns["A"].AliasassertAlias.__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
- gh-119821: Support non-dict globals in LOAD_FROM_DICT_OR_GLOBALS #119822
- [3.13] gh-119821: Support non-dict globals in LOAD_FROM_DICT_OR_GLOBALS (#119822) #119889
- [3.12] gh-119821: Support non-dict globals in LOAD_FROM_DICT_OR_GLOBALS (#119822) #119890
- [3.12] gh-119821: Fix refleak in LOAD_FROM_DICT_OR_GLOBALS #119975