Skip to content

Fix missing deepcopy import for event stream operations#589

Merged
SamRemis merged 2 commits into
smithy-lang:developfrom
SamRemis:deepcopy-import-fix
Oct 27, 2025
Merged

Fix missing deepcopy import for event stream operations#589
SamRemis merged 2 commits into
smithy-lang:developfrom
SamRemis:deepcopy-import-fix

Conversation

@SamRemis

@SamRemis SamRemis commented Oct 26, 2025

Copy link
Copy Markdown
Contributor

The ClientGenerator was missing the deepcopy import in generateEventStreamOperation(). Services with only event stream operations fail when smithy-build runs ruff check on the generated code because the generated code calls deepcopy(self._config) without importing it. Non-event-stream operations already had the import.

This adds the missing writer.addStdlibImport("copy", "deepcopy") line.

@SamRemis SamRemis requested a review from a team as a code owner October 26, 2025 22:45

private void generateEventStreamOperation(PythonWriter writer, OperationShape operation) {
writer.pushState(new OperationSection(service, operation));
writer.addStdlibImport("copy", "deepcopy");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding this here, I think we should push this up to the writeSharedOperationInit method

@jonathan343 jonathan343 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@SamRemis SamRemis merged commit 5b9716d into smithy-lang:develop Oct 27, 2025
4 checks passed
SamRemis added a commit to SamRemis/smithy-python that referenced this pull request Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants