Skip to content

Fix bug in bencode.decode-list where decoding fails for empty list - #42

Open
lsp-ableton wants to merge 3 commits into
allison-casey:masterfrom
lsp-ableton:fix-decode-list
Open

Fix bug in bencode.decode-list where decoding fails for empty list#42
lsp-ableton wants to merge 3 commits into
allison-casey:masterfrom
lsp-ableton:fix-decode-list

Conversation

@lsp-ableton

Copy link
Copy Markdown

In the case of an empty list, the thing to decode 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.

In particular, this resulted in an error any time I tried to evaluate an expression using cider (version 1.2.0snapshot)

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.
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.

1 participant