From 298483e9c4a3f0d98b971518793587e10ab1feae Mon Sep 17 00:00:00 2001 From: liferoad Date: Mon, 22 Sep 2025 20:29:23 -0400 Subject: [PATCH] fix(pipeline): Handle missing side_inputs in AppliedPTransform The AppliedPTransform initialization previously accessed `transform.side_inputs` directly. This could lead to an `AttributeError` if a transform object did not have a `side_inputs` attribute. This change uses `getattr` to safely access the attribute, providing an empty tuple as a default value. This makes the pipeline construction more robust by preventing crashes for transforms that do not define side inputs. --- sdks/python/apache_beam/pipeline.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sdks/python/apache_beam/pipeline.py b/sdks/python/apache_beam/pipeline.py index c57f74c51f72..caed03943e19 100644 --- a/sdks/python/apache_beam/pipeline.py +++ b/sdks/python/apache_beam/pipeline.py @@ -1230,7 +1230,9 @@ def __init__( self.full_label = full_label self.main_inputs = dict(main_inputs or {}) - self.side_inputs = tuple() if transform is None else transform.side_inputs + self.side_inputs = ( + tuple() if transform is None else getattr( + transform, 'side_inputs', tuple())) self.outputs = {} # type: Dict[Union[str, int, None], pvalue.PValue] self.parts = [] # type: List[AppliedPTransform] self.environment_id = environment_id if environment_id else None # type: Optional[str]