Fix bug in bencode.decode-list where decoding fails for empty list - #42
Open
lsp-ableton wants to merge 3 commits into
Open
Fix bug in bencode.decode-list where decoding fails for empty list#42lsp-ableton wants to merge 3 commits into
bencode.decode-list where decoding fails for empty list#42lsp-ableton wants to merge 3 commits into
Conversation
lsp-ableton
force-pushed
the
fix-decode-list
branch
from
October 21, 2021 10:55
98890a9 to
46d6427
Compare
In the case of an empty list, `thing` is the byte array [b'l', b'e'], i.e. the list marker "l" followed immediately by the end marker "e". Previously, we would incorrectly attempt to decode the end marker in this case. We should make the end marker detection part of the `while` condition so that the return value will be an empty list and the rest of the input will be correctly decoded.
Sometimes when embedding a REPL server in an application with an event loop, we don't want expressions sent to the REPL to be evaluated asynchronously, rather we want to be able to control where they are evaluated in the main thread. To this end, we introduce a "cooperative" option for the REPL server, which means that eval ops will put the input on a queue which will be processed to complete the evaluation only when `poll-repl-server` is called.
lsp-ableton
force-pushed
the
fix-decode-list
branch
from
October 21, 2021 10:57
46d6427 to
9193b62
Compare
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.
In the case of an empty list, the
thingto decode is the byte array [b'l', b'e'], i.e. thelist marker "l" followed immediately by the end marker "e".
Previously, we would incorrectly attempt to decode the end marker in this case.
We should make the end marker detection part of the
whilecondition so thatthe return value will be an empty list and the rest of the input will be
correctly decoded.
In particular, this resulted in an error any time I tried to evaluate an expression using
cider(version1.2.0snapshot)