fix: `ProcessingS3Output`'s `s3_uri` to be an optional field (5559) by aviruthen · Pull Request #5730 · aws/sagemaker-python-sdk

Bug: Missing continue statement after the else branch. When output.s3_output already exists but s3_uri is None (line 530: output.s3_output.s3_uri = s3_uri), execution falls through to the continue on line 541. However, when output.s3_output is None and a new _ProcessingS3Output is created (this branch), the continue on line 541 only covers this else block. But looking more carefully, the continue on line 541 is inside the if not output.s3_output or output.s3_output.s3_uri is None: block, so both sub-branches reach it.

Actually wait — the continue on line 541 is at the indentation level of the inner else (line 533). The if output.s3_output: branch on line 529 does NOT have a continue, so after setting output.s3_output.s3_uri = s3_uri on line 530, execution will fall through past line 541 to the urlparse call on line 543, which would then parse the just-assigned s3_uri. This is likely unintended — the auto-generated URI should not go through the parse_result.scheme != 's3' check again (especially if it's a Join object in pipeline mode, which would fail).

Fix: Move the continue to be at the same indentation level as the outer if not output.s3_output or output.s3_output.s3_uri is None: block, or add a continue after line 530:

if output.s3_output:
    output.s3_output.s3_uri = s3_uri
    normalized_outputs.append(output)
    continue
else:
    ...