diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index 0a3e57d34c6..3372312c6d8 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -6707,7 +6707,6 @@ def test_get_type_hints_modules_forwardref(self): 'default_b': Optional[mod_generics_cache.B]} self.assertEqual(gth(mod_generics_cache), mgc_hints) - @unittest.expectedFailure # TODO: RUSTPYTHON; + {'x': } def test_get_type_hints_classes(self): self.assertEqual(gth(ann_module.C), # gth will find the right globalns {'y': Optional[ann_module.C]}) diff --git a/crates/codegen/src/symboltable.rs b/crates/codegen/src/symboltable.rs index b175e40d487..4862c25b8b6 100644 --- a/crates/codegen/src/symboltable.rs +++ b/crates/codegen/src/symboltable.rs @@ -1136,7 +1136,10 @@ impl SymbolTableBuilder { let parent_scope_typ = self.tables.last().map(|t| t.typ); let should_save_annotation_block = matches!( parent_scope_typ, - Some(CompilerScope::Class) | Some(CompilerScope::Module) + Some(CompilerScope::Class) + | Some(CompilerScope::Module) + | Some(CompilerScope::Function) + | Some(CompilerScope::AsyncFunction) ); let saved_annotation_block = if should_save_annotation_block { self.tables.last_mut().unwrap().annotation_block.take()