Conversation
…o list Using Sou (aws#5518)
aviruthen
commented
Mar 20, 2026
Owner
Author
There was a problem hiding this comment.
Can you add a comment explaining why dependencies should default to [] if it is None? Leave all other source code changes the same!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix TypeError when Pipeline upsert with SourceCode without requirements
Fixes aws#5518
Problem
When using
SourceCodewithout specifyingrequirements(which defaults toNone), callingpipeline.upsert()raises aTypeError: can only concatenate list (not 'NoneType') to listinget_processing_code_hash.This occurs because
get_processing_code_hashdirectly concatenates thedependenciesparameter with a list (e.g.,[code, source_dir] + dependencies) without checking ifdependenciesisNone.Solution
Added a defensive
dependencies = dependencies or []guard at the start ofget_processing_code_hash()to handleNonedependencies gracefully, converting them to an empty list before any list concatenation occurs.Note:
get_training_code_hashalready handlesNonedependencies correctly withif dependencies:guards.Testing
Added test cases to verify:
get_processing_code_hashwithNonedependencies does not raise TypeErrorget_processing_code_hashwithNonedependencies works correctly with source_dir, code only, and bothget_training_code_hashwithNonedependencies works correctly with source_dir and entry_point onlyRelated Issue
Fixes aws#5518
Changes Made
The bug occurs when
SourceCode.requirementsisNone(the default when not specified) and thisNonevalue gets passed as thedependenciesparameter to hash functions that attempt list concatenation. Theget_processing_code_hashfunction directly concatenatesdependencieswith a list without checking forNone, causingTypeError: can only concatenate list (not 'NoneType') to list. Theget_training_code_hashfunction already hasif dependencies:guards in the current codebase, butget_processing_code_hashdoes not. Additionally, theget_code_hashfunction should defensively defaultNonerequirements to avoid passingNonedownstream. The fix is twofold: (1) inget_code_hash, defaultrequirementstoNonehandled properly, and (2) inget_processing_code_hash, add adependencies = dependencies or []guard at the start of the function body to handleNonedependencies gracefully.AI-Generated PR
This PR was automatically generated by the PySDK Issue Agent.
Merge Checklist
prefix: descriptionformat