Skip to content

Commit 757ffcd

Browse files
authored
fix(pipeline): Handle missing side_inputs in AppliedPTransform (#36238)
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.
1 parent 43c8285 commit 757ffcd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sdks/python/apache_beam/pipeline.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1230,7 +1230,9 @@ def __init__(
12301230
self.full_label = full_label
12311231
self.main_inputs = dict(main_inputs or {})
12321232

1233-
self.side_inputs = tuple() if transform is None else transform.side_inputs
1233+
self.side_inputs = (
1234+
tuple() if transform is None else getattr(
1235+
transform, 'side_inputs', tuple()))
12341236
self.outputs = {} # type: Dict[Union[str, int, None], pvalue.PValue]
12351237
self.parts = [] # type: List[AppliedPTransform]
12361238
self.environment_id = environment_id if environment_id else None # type: Optional[str]

0 commit comments

Comments
 (0)