Commit Graph

90 Commits

Author SHA1 Message Date
Miss Islington (bot) 08c9ba5b72
[3.13] gh-134097: Print number of refs & blocks after each statement in new REPL (gh-134136) (gh-134221)
(cherry picked from commit c31547a591)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-19 16:13:25 +02:00
Stan Ulbrych 1dfe5def08
[3.13] gh-132017: Handle SIGCONT in `pyrepl` (#132918) (#133470) 2025-05-05 23:13:08 +02:00
Łukasz Langa 891232f338
[3.13] gh-131878: Fix input of unicode characters with two or more code points in new pyrepl on Windows (gh-131901) (gh-133468)
(cherry picked from commit 0c5151bc81)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
2025-05-05 23:08:09 +02:00
Łukasz Langa 76f52c434c
[3.13] gh-130804: Fix support of typing unicode chars in pyrepl (GH-130805) (GH-133462)
(cherry picked from commit 7c98b0674d)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
2025-05-05 21:39:21 +02:00
Łukasz Langa e4d68488bc
[3.13] GH-132439: Fix REPL swallowing characters entered with AltGr on cmd.exe (GH-132440) (GH-133460)
(cherry picked from commit 07f416a3f0)

Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-05-05 20:09:34 +02:00
Miss Islington (bot) a2bf7a0a47
[3.13] gh-124096: Enable REPL virtual terminal support on Windows (GH-124119) (GH-133457)
To support virtual terminal mode in Windows PYREPL, we need a scanner
to read over the supported escaped VT sequences.

Windows REPL input was using virtual key mode, which does not support
terminal escape sequences. This patch calls `SetConsoleMode` properly
when initializing and send sequences to enable bracketed-paste modes
to support verbatim copy-and-paste.
(cherry picked from commit a65366ed87)

Co-authored-by: Y5 <124019959+y5c4l3@users.noreply.github.com>
Signed-off-by: y5c4l3 <y5c4l3@proton.me>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: Dustin L. Howett <dustin@howett.net>
Co-authored-by: wheeheee <104880306+wheeheee@users.noreply.github.com>
2025-05-05 19:39:06 +02:00
Łukasz Langa 87b14c8f21
[3.13] gh-131878: Handle top level exceptions in new pyrepl and prevent of closing it (GH-131910) (GH-133445)
Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
2025-05-05 17:20:54 +02:00
Miss Islington (bot) df1669ed20
[3.13] Bump mypy to 1.15 (GH-133405) (#133429)
Bump mypy to 1.15 (GH-133405)
(cherry picked from commit 8467026ed6)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-05-05 10:54:56 +00:00
Miss Islington (bot) 62663bfed5
[3.13] gh-129098: avoid using content of `_pyrepl/__main__.py` when reporting tracebacks (GH-130721) (#132755)
gh-129098: avoid using content of `_pyrepl/__main__.py` when reporting tracebacks (GH-130721)
(cherry picked from commit 492e3e6976)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-04-20 17:48:16 +00:00
Miss Islington (bot) 8f6a9aa6ae
[3.13] gh-128231: Use `runcode()` return value for failing early (GH-129488) (#130513)
gh-128231: Use `runcode()` return value for failing early (GH-129488)
(cherry picked from commit 7ed3dc6392)

Co-authored-by: Bartosz Sławecki <bartoszpiotrslawecki@gmail.com>
2025-03-28 13:11:45 +02:00
Miss Islington (bot) 55fb3a75d5
[3.13] gh-131507: Refactor screen and cursor position calculations (GH-131547) (GH-131557)
gh-131507: Refactor screen and cursor position calculations (GH-131547)

This is based off GH-131509.
(cherry picked from commit 4cc82ffa37)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-03-21 18:58:06 +01:00
Łukasz Langa 095c1263eb
[3.13] gh-131507: Clean up tests and type checking for `_pyrepl` (GH-131509) (GH-131546)
(cherry picked from commit 5d8e981c84)
2025-03-21 17:25:45 +01:00
Miss Islington (bot) c7022230d2
[3.13] gh-117174: Add a new route in linecache to fetch interactive source code (GH-117500) (#131060)
gh-117174: Add a new route in linecache to fetch interactive source code (GH-117500)
(cherry picked from commit a931a8b324)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-03-10 23:11:24 +00:00
Miss Islington (bot) 977af3a6a2
[3.13] gh-124927: Fix conversion issue between coordinates and position in REPL (GH-125001) (#131061)
gh-124927: Fix conversion issue between coordinates and position in REPL (GH-125001)
(cherry picked from commit 6ab5c4aa05)

Co-authored-by: FeH2 <i@feh2.im>
2025-03-10 22:18:13 +00:00
Miss Islington (bot) 4c6318e24d
[3.13] gh-128388: pyrepl on Windows: add meta and ctrl+arrow keybindings (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 688f3a0d4b)

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>
2025-03-03 16:57:53 +01:00
donBarbos 08b045c438
[3.13] gh-127349: Add check for correct resizing in REPL (GH-127387) (#129485)
(cherry picked from commit 510fefdc62)
2025-02-04 15:18:22 +01:00
Miss Islington (bot) 5c102a12a1
[3.13] gh-118878: Pyrepl: show completions menu below the current line (GH-118939) (#129161)
gh-118878: Pyrepl: show completions menu below the current line (GH-118939)

(cherry picked from commit 29caec62ee)

Co-authored-by: Daniel Hollas <daniel.hollas@bristol.ac.uk>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-01-23 22:15:27 +01:00
Miss Islington (bot) 52ccf264df
[3.13] gh-128330: Terminal control characters should be restored on repl exit (GH-128331) (#129233)
gh-128330: Terminal control characters should be restored on repl exit (GH-128331)
(cherry picked from commit 0b15d9c0d2)

Co-authored-by: Andy Fiddaman <andy@omnios.org>
2025-01-23 17:55:28 +00:00
Miss Islington (bot) 0b90dc8e89
[3.13] gh-128636: Fix crash in PyREPL when `os.environ` is overwritten with 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 ba9a4b6215)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2025-01-22 16:38:13 +00:00
Miss Islington (bot) 0ddcb61ffe
[3.13] gh-123024: Correctly prepare/restore around help and show-history commands (GH-124485) (#129155)
gh-123024: Correctly prepare/restore around help and show-history commands (GH-124485)
(cherry picked from commit 5a9afe2362)

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>
2025-01-21 22:15:57 +00:00
Miss Islington (bot) 0c7045378f
[3.13] gh-126332: Fix pyrepl crash for double ctrl-z in line overflow (GH-126650) (#129154)
gh-126332: Fix pyrepl crash for double ctrl-z in line overflow (GH-126650)

(cherry picked from commit d147e5e52c)

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2025-01-21 21:04:41 +00:00
Victor Stinner a5741d63bc
[3.13] gh-122273: Support PyREPL history on Windows (#127141) (#127289)
gh-122273: Support PyREPL history on Windows (#127141)

Co-authored-by: devdanzin <74280297+devdanzin@users.noreply.github.com>
(cherry picked from commit 3c7a90a831)
2024-11-26 11:17:13 +00:00
Miss Islington (bot) 9162340e06
[3.13] gh-126456: Fix _pyrepl curses tigetstr() (GH-126472) (#126790)
gh-126456: Fix _pyrepl curses tigetstr() (GH-126472)
(cherry picked from commit b2bbdc56e3)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-11-13 17:19:03 +00:00
Nice Zombies d54dbd62cc
[3.13] gh-124960: Fixed `barry_as_FLUFL` future flag does not work in new 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 6a08a753b7)
2024-10-14 20:00:45 +02:00
Miss Islington (bot) 9e218afc85
[3.13] Support the "pager" binary in _pyrepl (GH-122878) (#124242)
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 426569eb8c)

Co-authored-by: Stefano Rivera <stefano@rivera.za.net>
Co-authored-by: T. Wouters <thomas@python.org>
2024-10-07 23:45:43 +02:00
Miss Islington (bot) 862ec8bd51
[3.13] gh-124628: Pyrepl inputs on Windows shouldn't always be blocking reads (GH-124629) (#124638)
gh-124628: Pyrepl inputs on Windows shouldn't always be blocking reads (GH-124629)
(cherry picked from commit 83e5dc0f4d)

Co-authored-by: Dino Viehland <dinoviehland@meta.com>
2024-09-27 11:45:06 -07:00
Miss Islington (bot) 9fc8771942
[3.13] gh-123856: Fix PyREPL failure when a keyboard interrupt is triggered 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 c1600c78e4)

Co-authored-by: Emily Morehouse <emily@cuttlesoft.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-09-26 13:39:01 -07:00
Miss Islington (bot) 112b1704fa
[3.13] gh-124027: Support Del, PgUp, and PgDn on TERM=vt100 (GH-124028) (#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 f4e5643df6)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
2024-09-13 01:36:34 +00:00
Miss Islington (bot) 5c3078d6e5
[3.13] gh-120221: Support KeyboardInterrupt in asyncio REPL (GH-123795) (#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 033510e11d)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-09-06 22:25:19 +02:00
Miss Islington (bot) 2cc1899b93
[3.13] gh-119310: Fix encoding when reading old history file (GH-121779) (#123784)
(cherry picked from commit e95984826e)

Co-authored-by: aorcajo <589252+aorcajo@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-09-06 16:23:47 +02:00
Miss Islington (bot) c787a5161c
[3.13] gh-119034, REPL: Change page up/down keys to search in history (GH-123607) (GH-123773)
Change <page up> and <page down> keys of the Python REPL to history
search forward/backward.

(cherry picked from commit 8311b11800)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-09-06 14:04:11 +02:00
Miss Islington (bot) b221c5bba1
[3.13] gh-111201: fix auto-indent in pyrepl for muliple pound comments (GH-123196) (GH-123764)
(cherry picked from commit d683f49a7b)

Co-authored-by: Arnon Yaari <wiggin15@yahoo.com>
2024-09-06 13:09:22 +02:00
Miss Islington (bot) 5e03734c94
[3.13] gh-123240: Raise input audit events in the new REPL (GH-123274) (#123737)
(cherry picked from commit aa1339aaaa)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-09-05 17:45:20 +02:00
Miss Islington (bot) 67851201d8
[3.13] gh-123572: Fix key codes in VK_MAP in windows_console.py (GH-122692) (#123632)
gh-123572: Fix key codes in VK_MAP in windows_console.py (GH-122692)
(cherry picked from commit 782217f28f)

Co-authored-by: devdanzin <74280297+devdanzin@users.noreply.github.com>
2024-09-03 15:01:14 +01:00
Miss Islington (bot) 865bfb1530
[3.13] gh-123177: Fix prompt for wrapped lines in pyrepl (GH-123324) (#123327)
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 602fcf97df)

Co-authored-by: Matt Wozniski <mwozniski@bloomberg.net>
2024-08-26 02:13:36 +01:00
Miss Islington (bot) e37b7f1a9c
[3.13] gh-123177: Deactivate line wrap for Apple Terminal via scape codes in 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 fdb3f9b588)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2024-08-25 22:01:56 +00:00
Miss Islington (bot) 31fae8c94f
[3.13] gh-123228: fix return type for _ReadlineWrapper.get_line_buffer() (GH-123281) (#123293)
gh-123228: fix return type for _ReadlineWrapper.get_line_buffer() (GH-123281)
(cherry picked from commit ca18ff2a34)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Carl Friedrich Bolz-Tereick <cfbolz@gmx.de>
2024-08-24 16:11:17 +00:00
CF Bolz-Tereick 0955db1bd8
[3.13] gh-82378 fix sys.tracebacklimit in pyrepl, approach 2 (GH-123062) (#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 63603bca35)
2024-08-23 12:59:08 +01:00
Sergey B Kirpichev 5271f8fead
[3.13] gh-122546: use same filename for different exceptions in new repl (GH-123217) (#123226) 2024-08-23 00:28:09 +01:00
Miss Islington (bot) 98c7196977
[3.13] gh-123149: Suppress verbose repr in new REPL (GH-123151) (#123157)
gh-123149: Suppress verbose repr in new REPL (GH-123151)
(cherry picked from commit 833c58b81e)

Co-authored-by: James <snoopjedi@gmail.com>
2024-08-19 19:28:12 +00:00
Sergey B Kirpichev c8f4069ab1
[3.13] gh-121804: Always show error location for SyntaxError's in new repl (GH-121886) (#123148)
(cherry picked from commit 354d55eb1f)
2024-08-19 20:01:58 +01:00
Miss Islington (bot) 7a90d94df7
[3.13] gh-119896: Fix CTRL-Z behavior in the new REPL on Windows (GH-122217) (#122451)
gh-119896: Fix CTRL-Z behavior in the new REPL on Windows (GH-122217)
(cherry picked from commit d1a1bca1f0)

Co-authored-by: Dino Viehland <dinoviehland@meta.com>
2024-07-30 12:34:22 -07:00
Miss Islington (bot) 148beb6de9
[3.13] gh-121957: Emit audit events for `python -i` and `python -m asyncio` (GH-121958) (GH-122115)
Relatedly, emit the `cpython.run_startup` event from the Python version of
`PYTHONSTARTUP` handling.
(cherry picked from commit dc93d1125f)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-22 13:36:57 +02:00
Miss Islington (bot) 3d9692dbf8
[3.13] gh-120678: pyrepl: Include globals from modules passed with `-i` (GH-120904) (#121916)
(cherry picked from commit ac07451116)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-17 16:52:46 +02:00
Miss Islington (bot) 4a62fdf35d
[3.13] gh-121295: Fix blocked console after interrupting a long paste (GH-121815) (GH-121826)
(cherry picked from commit 498a94c198)

Co-authored-by: Marta Gómez Macías <mgmacias@google.com>
2024-07-16 08:29:04 +02:00
Miss Islington (bot) 73f77e642a
[3.13] gh-121610: pyrepl - handle extending blocks when multi-statement 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 7d111dac16)

Co-authored-by: saucoide <32314353+saucoide@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-16 08:28:41 +02:00
Miss Islington (bot) 5b718e7fc7
[3.13] gh-121790: Fix interactive console initialization (GH-121793) (GH-121822)
(cherry picked from commit e5c7216f37)

Co-authored-by: Milan Oberkirch <milan.oberkirch@geops.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-16 00:49:41 +02:00
Miss Islington (bot) b506de4eb5
[3.13] gh-121245: Refactor site.register_readline() (GH-121659) (GH-121816)
(cherry picked from commit 05d413764c)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-15 22:49:18 +02:00
Miss Islington (bot) 308857b82a
[3.13] gh-121746: Bind Alt+Enter to "accept" in the REPL (GH-121754) (GH-121803)
(cherry picked from commit 6522f0e438)

Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
2024-07-15 20:14:50 +02:00
Miss Islington (bot) e28f863bd5
[3.13] gh-121609: Fix pasting of characters containing unicode character joiner (GH-121667) (#121733)
Co-authored-by: Marta Gómez Macías <mgmacias@google.com>
2024-07-14 03:02:46 -06:00