Fix unbound stream variable in DHT provider_store.py#1313
Merged
Conversation
Fixes libp2p#1335. Completes PR libp2p#1313 follow-up: regression test when new_stream fails, plus towncrier entry. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
|
Hi @TimSC — thank you for opening #1313 and for the clear diagnosis of the What was added
Branch Latest commit on No further changes to your core fix in Thanks again for contributing to py-libp2p. |
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.
Fixes #1335
What was wrong?
When
host.new_streamfails before a stream is opened,_send_add_providerhit an unboundstreaminfinally, masking the real error:How was it fixed?
Initialize
stream = Noneand only close when a stream was opened.Test plan
new_streamfailure returnsFalsewithoutUnboundLocalErrormake prmake linux-docsCute Animal Picture