fix: close _stdout_stream in SubprocessCLITransport.close()#688
Open
possibilities wants to merge 1 commit intoanthropics:mainfrom
Open
fix: close _stdout_stream in SubprocessCLITransport.close()#688possibilities wants to merge 1 commit intoanthropics:mainfrom
possibilities wants to merge 1 commit intoanthropics:mainfrom
Conversation
close() properly closed _stdin_stream and _stderr_stream via .aclose() but only set _stdout_stream = None without closing it, leaking anyio TextReceiveStream objects and producing ResourceWarnings.
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.
Summary
close()called.aclose()on_stdin_streamand_stderr_streambut only set_stdout_stream = None, leaking the anyioTextReceiveStreamand producingResourceWarnings.aclose()call for_stdout_stream, matching the existing pattern for the other two streamstest_connect_closeto verify all stream closuresTest plan
pytest tests/test_transport.py::TestSubprocessCLITransport::test_connect_closepassestriofailures); excludedtest_sdk_mcp_integration.pyandtest_tool_callbacks.py(pre-existingpytest-asynciofailures)ruff checkandruff formatcleanmypy src/clean