From 069a9a376f426b214a52cf7e0ae82ccfe4d27104 Mon Sep 17 00:00:00 2001 From: Suvrat1629 Date: Sun, 7 Sep 2025 21:03:14 +0530 Subject: [PATCH] type fix --- sdks/python/apache_beam/typehints/opcodes.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sdks/python/apache_beam/typehints/opcodes.py b/sdks/python/apache_beam/typehints/opcodes.py index d94221c7b868..696212520efc 100644 --- a/sdks/python/apache_beam/typehints/opcodes.py +++ b/sdks/python/apache_beam/typehints/opcodes.py @@ -547,7 +547,13 @@ def load_closure(state, arg): if (sys.version_info.major, sys.version_info.minor) >= (3, 11): arg -= len(state.co.co_varnames) state.stack.append(state.closure_type(arg)) + closure_idx = arg + inferred_type = state.closure_type[closure_idx] if hasattr(state, 'closure_types') else state.get_inferred_type_for_closure(closure_idx) + if inferred_type is None: + inferred_type = typehints.Any + + state.stack.append(inferred_type) def load_deref(state, arg): # The arg is no longer offset by len(covar_names) as of 3.11