diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-29 04:15:16 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:15 -0300 |
| commit | 4b64d4b237b2bc5f8197e2232c84c0d1ed1a8fdb (patch) | |
| tree | 725cd69dd0ae6990eafd71ec25bb0e52b9f354e8 /test | |
| parent | 7c59482436656443b698e867c423b27dd365a96c (diff) | |
| download | pardes-4b64d4b237b2bc5f8197e2232c84c0d1ed1a8fdb.tar.gz pardes-4b64d4b237b2bc5f8197e2232c84c0d1ed1a8fdb.zip | |
A multi-line paste into Python's REPL runs whole, back at its prompt
The Enter went on Python's first output after the paste, before it had
taken in the whole paste, and one Enter leaves a multi-line input at
... anyway. Python's output now only restarts a 100 ms quiet wait (the
250 ms fallback stays), and a paste of more than one line gets the second
Enter a block gets. fs.py runs print(11)\nprint(22), the same with a
trailing newline, and a for block followed by a statement in a real
python3, each back at >>>.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test')
| -rw-r--r-- | test/fs.py | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -524,6 +524,18 @@ def python_repl_runs_one_line(binary): record = b'MX0 0 0 %d %s\n' % (len(line), line) client.rpc(118, struct.pack('<IQI', fid, 0, len(record)) + record) assert wait_for(f'\n{1000 + n}'), (n, body()) + # More than one line, with and without a newline at the end, + # and a block with a statement after it: each runs whole, + # and the REPL is back at its prompt, not at `...`. + for code, outputs in [(b'print(11)\nprint(22)', ['11', '22']), + (b'print(33)\nprint(44)\n', ['33', '44']), + (b'for i in range(2):\n print(55 + i)\nprint(77)\n', ['55', '56', '77'])]: + record = b'MX0 0 0 %d %s\n' % (len(code), code) + client.rpc(118, struct.pack('<IQI', fid, 0, len(record)) + record) + for out in outputs: + assert wait_for(f'\n{out}\n'), (code, out, body()) + time.sleep(.5) + assert body().rstrip().endswith('>>>'), (code, body()[-200:]) finally: client.close(fid) |
