| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
| |
(#130513)
gh-128231: Use `runcode()` return value for failing early (GH-129488)
(cherry picked from commit 7ed3dc6392613832f66c63507385b1da109cbf21)
Co-authored-by: Bartosz Sławecki <bartoszpiotrslawecki@gmail.com>
|
| |
|
|
|
|
|
|
|
|
| |
(GH-131547) (GH-131557)
gh-131507: Refactor screen and cursor position calculations (GH-131547)
This is based off GH-131509.
(cherry picked from commit 4cc82ffa377db5073fdc6f85c6f35f9c47397796)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
|
| |
|
|
|
| |
(GH-131546)
(cherry picked from commit 5d8e981c8477ce483374b2fe6cd309a08c956299)
|
| |
|
|
|
|
|
|
| |
code (GH-117500) (#131060)
gh-117174: Add a new route in linecache to fetch interactive source code (GH-117500)
(cherry picked from commit a931a8b32415f311008dbb3f09079aae1e6d7a3d)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
|
| |
|
|
|
|
|
|
| |
REPL (GH-125001) (#131061)
gh-124927: Fix conversion issue between coordinates and position in REPL (GH-125001)
(cherry picked from commit 6ab5c4aa05bf35832a3ccd1e71b28b8475fa30f4)
Co-authored-by: FeH2 <i@feh2.im>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(GH-128389) (GH-130500)
gh-128388: pyrepl on Windows: add meta and ctrl+arrow keybindings (GH-128389)
Fix `Lib/_pyrepl/windows_console.py` to support more keybindings, like the
`Ctrl`+`←` and `Ctrl`+`→` word-skipping keybindings and those with meta (i.e. Alt),
e.g. to `kill-word` or `backward-kill-word`.
Specifics: if Ctrl is pressed, emit "ctrl left" and "ctrl right" instead of just "left" or
"right," and if Meta/Alt is pressed, emit the special key code for meta before
emitting the other key that was pressed.
(cherry picked from commit 688f3a0d4b94874ff6d72af3baafd8bbf911153e)
Co-authored-by: Paulie Peña <203125+paulie4@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
|
| |
|
| |
(cherry picked from commit 510fefdc625dd2ed2b6b3975314a59e291b94ae8)
|
| |
|
|
|
|
|
|
|
|
| |
(GH-118939) (#129161)
gh-118878: Pyrepl: show completions menu below the current line (GH-118939)
(cherry picked from commit 29caec62ee0650493c83c778ee2ea50b0501bc41)
Co-authored-by: Daniel Hollas <daniel.hollas@bristol.ac.uk>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
|
| |
|
|
|
|
|
|
| |
exit (GH-128331) (#129233)
gh-128330: Terminal control characters should be restored on repl exit (GH-128331)
(cherry picked from commit 0b15d9c0d2d30c7d3f17ebb90dd822ef32f977cc)
Co-authored-by: Andy Fiddaman <andy@omnios.org>
|
| |
|
|
|
|
|
|
| |
an invalid value (GH-128653) (#129186)
gh-128636: Fix crash in PyREPL when `os.environ` is overwritten with an invalid value (GH-128653)
(cherry picked from commit ba9a4b621577b92f36d88388cc9f791c2dc7d7ba)
Co-authored-by: Tomas R <tomas.roun8@gmail.com>
|
| |
|
|
|
|
|
|
|
|
| |
commands (GH-124485) (#129155)
gh-123024: Correctly prepare/restore around help and show-history commands (GH-124485)
(cherry picked from commit 5a9afe23620aadea30013076d64686be8bf66f7e)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Emily Morehouse <emily@cuttlesoft.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
|
| |
|
|
|
|
|
|
|
|
| |
(GH-126650) (#129154)
gh-126332: Fix pyrepl crash for double ctrl-z in line overflow (GH-126650)
(cherry picked from commit d147e5e52cdb90496ae5fe85b3263cdfa9407a28)
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
|
| |
|
|
|
|
| |
gh-122273: Support PyREPL history on Windows (#127141)
Co-authored-by: devdanzin <74280297+devdanzin@users.noreply.github.com>
(cherry picked from commit 3c7a90a83146dc6e55f6f9ecd9af0bf9682f98a6)
|
| |
|
|
|
|
| |
gh-126456: Fix _pyrepl curses tigetstr() (GH-126472)
(cherry picked from commit b2bbdc56e3276f3b37ea5cf5f73f49c4cce6d9f6)
Co-authored-by: Victor Stinner <vstinner@python.org>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
REPL (#124999) (#125475)
gh-124960: Fixed `barry_as_FLUFL` future flag does not work in new REPL (#124999)
Co-authored-by: Wulian <xiguawulian@gmail.com>
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 6a08a753b702ac63c9b6ac58dd204d1fe9662e9d)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Support the "pager" binary in _pyrepl (GH-122878)
Debian (and derivatives) provide a /usr/bin/pager binary, managed by the
alternatives system, that always points to an available pager utility.
Allow _pyrepl to use it, to follow system policy.
This is a very trivial change, from a patch that Debian has been
carrying since 2.7 era. Seems appropriate to upstream.
https://bugs.debian.org/799555
(cherry picked from commit 426569eb8ca1edaa68026aa2bab6b8d1c9105f93)
Co-authored-by: Stefano Rivera <stefano@rivera.za.net>
Co-authored-by: T. Wouters <thomas@python.org>
|
| |
|
|
|
|
|
|
| |
reads (GH-124629) (#124638)
gh-124628: Pyrepl inputs on Windows shouldn't always be blocking reads (GH-124629)
(cherry picked from commit 83e5dc0f4d0d8d71288f162840b36f210fb03abf)
Co-authored-by: Dino Viehland <dinoviehland@meta.com>
|
| |
|
|
|
|
|
|
|
| |
after using a history search (GH-124396) (#124530)
gh-123856: Fix PyREPL failure when a keyboard interrupt is triggered after using a history search (GH-124396)
(cherry picked from commit c1600c78e4565b6bb558ade451abe2648ba4dd0a)
Co-authored-by: Emily Morehouse <emily@cuttlesoft.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#124029)
gh-124027: Support Del, PgUp, and PgDn on TERM=vt100 (GH-124028)
pyrepl: Support Del, PgUp, and PgDn on TERM=vt100
From Fedora's /etc/inputrc:
"\e[5~": history-search-backward
"\e[6~": history-search-forward
"\e[3~": delete-char
Fixes https://github.com/python/cpython/issues/124027
(cherry picked from commit f4e5643df64d0c2a009ed224560044b3409a47c0)
Co-authored-by: Miro Hrončok <miro@hroncok.cz>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#123799)
This switches the main pyrepl event loop to always be non-blocking so that it
can listen to incoming interruptions from other threads.
This also resolves invalid display of exceptions from other threads
(gh-123178).
This also fixes freezes with pasting and an active input hook.
(cherry picked from commit 033510e11dff742d9626b9fd895925ac77f566f1)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
|
| |
|
|
|
|
|
|
| |
(#123784)
(cherry picked from commit e95984826eb3cdb3a3baedb2ccea35e11e9f8161)
Co-authored-by: aorcajo <589252+aorcajo@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
|
| |
|
|
|
|
|
|
|
|
|
| |
(GH-123607) (GH-123773)
Change <page up> and <page down> keys of the Python REPL to history
search forward/backward.
(cherry picked from commit 8311b11800509c975023e062e2c336f417c5e4c0)
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
|
| |
|
|
|
|
|
| |
(GH-123196) (GH-123764)
(cherry picked from commit d683f49a7b0635a26150cfbb398a3d93b227a74e)
Co-authored-by: Arnon Yaari <wiggin15@yahoo.com>
|
| |
|
|
|
| |
(cherry picked from commit aa1339aaaa6363c38186defaa079d069b4cb08b2)
Co-authored-by: sobolevn <mail@sobolevn.me>
|
| |
|
|
|
|
|
|
| |
(#123632)
gh-123572: Fix key codes in VK_MAP in windows_console.py (GH-122692)
(cherry picked from commit 782217f28f0d67916fc3ff82b03b88573686c0e7)
Co-authored-by: devdanzin <74280297+devdanzin@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
gh-123177: Fix prompt for wrapped lines in pyrepl (GH-123324)
When display lines above the cursor come from the cache, the first line
to not come from the cache may be a wrapped line, starting half way
through a logical line in the buffer. Detect and handle this case to
avoid accidentally drawing a stray prompt in the middle of a logical
line.
(cherry picked from commit 602fcf97df1665538d4e9841f9dc6bc33e38bece)
Co-authored-by: Matt Wozniski <mwozniski@bloomberg.net>
|
| |
|
|
|
|
|
|
| |
the new REPL (GH-123267) (#123322)
gh-123177: Deactivate line wrap for Apple Terminal via scape codes in the new REPL (GH-123267)
(cherry picked from commit fdb3f9b588f58f3cf95fe1dbf6e5b61ef525a351)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
|
| |
|
|
|
|
|
|
|
| |
(GH-123281) (#123293)
gh-123228: fix return type for _ReadlineWrapper.get_line_buffer() (GH-123281)
(cherry picked from commit ca18ff2a34435faa557f7f9d4d3a554dadb05e50)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Carl Friedrich Bolz-Tereick <cfbolz@gmx.de>
|
| |
|
|
|
|
|
| |
(#123252)
Make sure that pyrepl uses the same logic for sys.tracebacklimit as both
the basic repl and the standard sys.excepthook
(cherry picked from commit 63603bca35798c166e1b8e0be76aef69217f8b1b)
|
| |
|
|
| |
(GH-123217) (#123226)
|
| |
|
|
|
|
| |
gh-123149: Suppress verbose repr in new REPL (GH-123151)
(cherry picked from commit 833c58b81ebec84dc24ef0507f8c75fe723d9f66)
Co-authored-by: James <snoopjedi@gmail.com>
|
| |
|
|
|
| |
(GH-121886) (#123148)
(cherry picked from commit 354d55eb1fa40f272419aa6459ee5d2c4804c8ea)
|
| |
|
|
|
|
|
|
| |
(#122451)
gh-119896: Fix CTRL-Z behavior in the new REPL on Windows (GH-122217)
(cherry picked from commit d1a1bca1f0550a4715f1bf32b1586caa7bc4487b)
Co-authored-by: Dino Viehland <dinoviehland@meta.com>
|
| |
|
|
|
|
|
|
|
| |
(GH-121958) (GH-122115)
Relatedly, emit the `cpython.run_startup` event from the Python version of
`PYTHONSTARTUP` handling.
(cherry picked from commit dc93d1125f594ac7aece98558eaf33d09c348519)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
|
| |
|
|
|
|
|
|
| |
(GH-120904) (#121916)
(cherry picked from commit ac07451116d52dd6a5545d27b6a2e3737ed27cf0)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
|
| |
|
|
|
|
|
| |
(GH-121815) (GH-121826)
(cherry picked from commit 498a94c198e72525b8a7f4cb4f4a8957560f593a)
Co-authored-by: Marta Gómez Macías <mgmacias@google.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
blocks are pasted (GH-121757) (GH-121825)
console.compile with the "single" param throws an exception when
there are multiple statements, never allowing to adding newlines
to a pasted code block (gh-121610)
This adds a few extra checks to allow extending when in an indented
block, and tests for a few examples.
(cherry picked from commit 7d111dac160c658b277ec0fac75eee8edcfbe9dc)
Co-authored-by: saucoide <32314353+saucoide@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
|
| |
|
|
|
|
| |
(cherry picked from commit e5c7216f376a06d2c931daf999e2980e494e747e)
Co-authored-by: Milan Oberkirch <milan.oberkirch@geops.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
|
| |
|
|
|
|
| |
(cherry picked from commit 05d413764c8ae793b8321c21cb10094c934b8cb3)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
|
| |
|
|
|
| |
(cherry picked from commit 6522f0e438a8c56a8f3cce2095b193ea6e3f5016)
Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
|
| |
|
|
|
|
| |
joiner (GH-121667) (#121733)
Co-authored-by: Marta Gómez Macías <mgmacias@google.com>
|
| |
|
|
|
|
|
|
| |
set (GH-121498) (#121703)
gh-121497: Make Pyrepl respect correctly the history with input hook set (GH-121498)
(cherry picked from commit 4e36dd7d87eb0f1bd1ecd53e368c16a5f75967a0)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
|
| |
|
|
|
|
|
|
|
| |
(#121679)
gh-121499: Fix multi-line history rendering in the REPL (GH-121531)
(cherry picked from commit 4b9e10d0ea352592049c1f2a00318d7274143fa4)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
|
| |
|
|
| |
(#121059)
|
| |
|
|
|
|
| |
gh-120417: Remove unused imports in the stdlib (GH-120420)
(cherry picked from commit 4c6d4f5cb33e48519922d635894eef356faddba2)
Co-authored-by: Victor Stinner <vstinner@python.org>
|
| |
|
|
|
|
|
| |
(#120392)
(cherry picked from commit 02e74c356223feb0771759286d24d1dbac01d4ca)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
|
| |
|
|
| |
(GH-120354) (#120368)
|
| |
|
|
| |
definitions on new REPL startup (GH-119547) (#120362)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
gh-119517: Fixes for pasting in pyrepl (GH-120253)
* Remove pyrepl's optimization for self-insert
This will be replaced by a less specialized optimization.
* Use line-buffering when pyrepl echoes pastes
Previously echoing was totally suppressed until the entire command had
been pasted and the terminal ended paste mode, but this gives the user
no feedback to indicate that an operation is in progress. Drawing
something to the screen once per line strikes a balance between
perceived responsiveness and performance.
* Remove dead code from pyrepl
`msg_at_bottom` is always true.
* Speed up pyrepl's screen rendering computation
The Reader in pyrepl doesn't hold a complete representation of the
screen area being drawn as persistent state. Instead, it recomputes it,
on each keypress. This is fast enough for a few hundred bytes, but
incredibly slow as the input buffer grows into the kilobytes (likely
because of pasting).
Rather than making some expensive and expansive changes to the repl's
internal representation of the screen, add some caching: remember some
data from one refresh to the next about what was drawn to the screen
and, if we don't find anything that has invalidated the results that
were computed last time around, reuse them. To keep this caching as
simple as possible, all we'll do is look for lines in the buffer that
were above the cursor the last time we were asked to update the screen,
and that are still above the cursor now. We assume that nothing can
affect a line that comes before both the old and new cursor location
without us being informed. Based on this assumption, we can reuse old
lines, which drastically speeds up the overwhelmingly common case where
the user is typing near the end of the buffer.
* Speed up pyrepl prompt drawing
Cache the `can_colorize()` call rather than repeatedly recomputing it.
This call looks up an environment variable, and is called once per
character typed at the REPL. The environment variable lookup shows up as
a hot spot when profiling, and we don't expect this to change while the
REPL is running.
* Speed up pasting multiple lines into the REPL
Previously, we were checking whether the command should be accepted each
time a line break was encountered, but that's not the expected behavior.
In bracketed paste mode, we expect everything pasted to be part of
a single block of code, and encountering a newline shouldn't behave like
a user pressing <Enter> to execute a command. The user should always
have a chance to review the pasted command before running it.
* Use a read buffer for input in pyrepl
Previously we were reading one byte at a time, which causes much slower
IO than necessary. Instead, read in chunks, processing previously read
data before asking for more.
* Optimize finding width of a single character
`wlen` finds the width of a multi-character string by adding up the
width of each character, and then subtracting the width of any escape
sequences. It's often called for single character strings, however,
which can't possibly contain escape sequences. Optimize for that case.
* Optimize disp_str for ASCII characters
Since every ASCII character is known to display as single width, we can
avoid not only the Unicode data lookup in `disp_str` but also the one
hidden in `str_width` for them.
* Speed up cursor movements in long pyrepl commands
When the current pyrepl command buffer contains many lines, scrolling up
becomes slow. We have optimizations in place to reuse lines above the
cursor position from one refresh to the next, but don't currently try to
reuse lines below the cursor position in the same way, so we wind up
with quadratic behavior where all lines of the buffer below the cursor
are recomputed each time the cursor moves up another line.
Optimize this by only computing one screen's worth of lines beyond the
cursor position. Any lines beyond that can't possibly be shown by the
console, and bounding this makes scrolling up have linear time
complexity instead.
---------
(cherry picked from commit 32a0faba439b239d7b0c242c1e3cd2025c52b8cf)
Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
Co-authored-by: Matt Wozniski <mwozniski@bloomberg.net>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
|
| |
|
|
|
|
|
| |
(GH-120075) (#120076)
(cherry picked from commit 69b3e8ea569faabccd74036e3d0e5ec7c0c62a20)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
|