Commit Graph

129 Commits

Author SHA1 Message Date
yihong b8c8b8f1d3 gh-139391: properly handle signal.signal() in UnixConsole when called from a non-main thread (#139392) 2025-10-09 14:58:01 +00:00
DeepWzh 81959a0364 gh-133400: Fixed Ctrl+D (^D) behavior in :mod:_pyrepl module (GH-133883)
Co-authored-by: adam j hartz <adam@smatz.net>
2025-10-09 16:16:48 +02:00
Łukasz Langa 2fc7004d54 gh-134466: Don't run when termios is inaccessible (GH-138911)
Without the ability to set required capabilities, the REPL cannot
function properly (syntax highlighting and multiline editing can't
work).

We refuse to work in this degraded state.
2025-09-17 12:59:49 +02:00
yihong b9dbf6acb3 gh-135329: prevent infinite traceback loop on Ctrl-C for strace (GH-138133)
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Co-authored-by: dura0ok <slpmcf@gmail.com>
Co-authored-by: graymon <greyschwinger@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-09-16 12:39:03 +02:00
Loïc Simon 537133d2b6 gh-69605: Hardcode some stdlib submodules in PyREPL module completion (os.path, collections.abc...) (GH-138268)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-09-15 18:51:34 +02:00
Łukasz Langa 811acc85d5 gh-134953: Make the True/False/None check more efficient (GH-138931) 2025-09-15 18:27:37 +02:00
yihong 8ef7735c53 gh-128636: Fix crash in PyREPL when os.environ is overwritten with an invalid value for macOS (GH-138089)
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-09-15 18:26:23 +02:00
00ll00 26cfb17942 gh-138239: Fix incorrect highlighting of "type" in type statements in the REPL (GH-138241)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-09-15 18:21:41 +02:00
Stan Ulbrych a5b9d0b8b2 gh-134953: Expand theming for True/False/None (#135000)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-09-15 16:36:17 +02:00
yihong 7a3bca50e0 gh-138318, PyREPL: builtins should not be highlighted when used as attribute names (#138319) 2025-09-08 14:04:22 +01:00
ggqlq 8750e5ecfc gh-134869: Fix Ctrl+C corrupts REPL autocomplete (#134929) 2025-08-18 21:54:39 +01:00
Hood Chatham c933a6bb32 gh-124621: Emscripten: Support pyrepl in browser (GH-136931)
Basic support for pyrepl in Emscripten. Limitations:
* requires JSPI
* no signal handling implemented

As followup work, it would be nice to implement a webworker variant
for when JSPI is not available and proper signal handling.

Because it requires JSPI, it doesn't work in Safari. Firefox requires
setting an experimental flag. All the Chromiums have full support since
May. Until we make it work without JSPI, let's keep the original web_example
around.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Éric <merwok@netwok.org>
2025-07-22 12:13:38 +02:00
Petr Viktorin 28153fec58 gh-135621: Simplify TermInfo (GH-136916) 2025-07-21 13:06:42 +02:00
Łukasz Langa 09dfb50f1b gh-135621: Remove dependency on curses from PyREPL (GH-136758) 2025-07-21 11:57:34 +02:00
Olga Matoula 3a64844533 gh-136801: Fix PyREPL syntax highlightning on match cases after multi-line case (GH-136804) 2025-07-19 15:15:49 +02:00
Richard Si be02e68158 gh-72327: Suggest using system terminal for pip install in PyREPL (#136328)
Users new to Python packaging often try to use pip from the REPL only to
be met with a confusing SyntaxError. If this happens, guide the user to
use a system terminal instead to invoke pip.

Closes #72327

---------

Co-authored-by: Tom Viner <tom@viner.tv>
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2025-07-15 14:25:07 +00:00
Dzmitry Plashchynski f320c951c3 gh-131189: Fix "msvcrt" import warning on Linux when "_ctypes" is not available. (GH-131201)
Fix "msvcrt" import warning on Linux when "_ctypes" is not available.

On Linux, compiling without "libffi" causes a
"No module named 'msvcrt'" warning when launching PyREPL.
2025-07-15 09:44:31 +02:00
sobolevn b3ae76911d Bump mypy to 1.16.1 (#135720) 2025-06-23 15:29:30 +03:00
Loïc Simon 0e3bc962c6 gh-69605: Disable PyREPL module autocomplete fallback on regular completion (gh-134181)
Co-authored-by: Loïc Simon <loic.simon@napta.io>
2025-05-26 01:05:08 +02:00
Chris Eibl 91b48868a8 GH-130328: Speedup pasting in legacy console on Windows (gh-133728) 2025-05-25 15:17:43 +02:00
Yuichiro Tachibana (Tsuchiya) b1b8962443 gh-127960 Fix the REPL to set the correct namespace by setting the correct __main__ module (gh-134275)
The `__main__` module imported in the `_pyrepl` module points to the `_pyrepl` module itself when the interpreter was launched without `-m` option and didn't execute a module,
while it's an unexpected behavior that `__main__` can be `_pyrepl` and relative imports such as `from . import *` works based on the `_pyrepl` module.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-22 02:18:00 +02:00
Kevin Hernández a3a3cf6d15 gh-134215: PyREPL: Do not show underscored modules by default during autocompletion (gh-134267)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-20 22:26:48 +02:00
Chris Patti c91ad5da9d gh-128066: Properly handle history file writes for RO fs on PyREPL (gh-134380)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-20 21:47:57 +02:00
Tom Wang 8421b03b16 gh-134235: Import Autocomplete for Builtin Modules (GH-134277)
* added enhancement auto completing import with sys builtins

---------

Co-authored-by: Hunter <hyoung3@gmail.com>
2025-05-19 14:21:30 -07:00
Loïc Simon 71ea6a6798 gh-134158: Fix PyREPL coloring of double braces in f/t-strings (gh-134159)
Co-authored-by: Loïc Simon <loic.simon@napta.io>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-19 16:12:23 +02:00
Kirill Podoprigora c31547a591 gh-134097: Print number of refs & blocks after each statement in new REPL (gh-134136)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-19 15:30:43 +02:00
Łukasz Langa b2fabce6ab gh-133541: Handle SyntaxError raised by the tokenizer on user input (#133606) 2025-05-08 21:14:38 +01:00
Matt Wozniski fd37f1a8ad gh-133490: Fix syntax highlighting for remote PDB (#133494) 2025-05-06 11:44:49 +02:00
Noah Kim c4bcc6a778 gh-102567: Add -X importtime=2 for logging an importtime message for already-loaded modules (#118655)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-05-06 01:03:55 +01:00
Łukasz Langa f610bbdf74 gh-133346: Make theming support in _colorize extensible (GH-133347)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-05-05 23:45:25 +02:00
Stan Ulbrych e4561da886 gh-132017: Handle SIGCONT in pyrepl (#132918) 2025-05-05 20:37:01 +00:00
Chris Eibl 07f416a3f0 GH-132439: Fix REPL swallowing characters entered with AltGr on cmd.exe (GH-132440)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-05-05 18:45:45 +02:00
Sergey Miryanov 0c5151bc81 gh-131878: Fix input of unicode characters with two or more code points in new pyrepl on Windows (gh-131901)
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
2025-05-05 18:25:00 +02:00
Sergey Miryanov 99a0d7e5b3 gh-131878: Handle top level exceptions in new pyrepl and prevent of closing it (#131910)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-05 16:54:19 +02:00
sobolevn 8467026ed6 Bump mypy to 1.15 (#133405) 2025-05-05 13:29:48 +03:00
Łukasz Langa fac41f56d4 gh-131507: Add support for syntax highlighting in PyREPL (GH-133247)
Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-05-02 20:22:31 +02:00
Chris Eibl acb222ce8f GH-130328: pasting in new REPL is slow on Windows (GH-132884) 2025-04-29 18:03:45 +02:00
Sergey B Kirpichev 276252565c gh-127495: Append to history file after every statement in PyREPL (GH-132294) 2025-04-27 15:32:37 +02:00
Tomas R. c3a7118065 gh-69605: Add module autocomplete to PyREPL (#129329) 2025-04-25 02:24:26 +01:00
Bénédikt Tran 492e3e6976 gh-129098: avoid using content of _pyrepl/__main__.py when reporting tracebacks (#130721) 2025-04-20 18:24:30 +01:00
Łukasz Langa 4cc82ffa37 gh-131507: Refactor screen and cursor position calculations (GH-131547)
This is based off #131509.
2025-03-21 18:27:35 +01:00
Łukasz Langa 5d8e981c84 gh-131507: Clean up tests and type checking for _pyrepl (#131509) 2025-03-21 15:48:10 +01:00
Victor Stinner db27aee2fe gh-131152: Remove unused imports in _pyrepl and ctypes (#131150) 2025-03-12 14:04:12 +00:00
Sergey Miryanov 7c98b0674d gh-130804: Fix support of typing unicode chars in pyrepl (#130805) 2025-03-10 22:13:50 +00:00
FeH2 6ab5c4aa05 gh-124927: Fix conversion issue between coordinates and position in REPL (#125001) 2025-03-10 21:54:49 +00:00
Pablo Galindo Salgado a931a8b324 gh-117174: Add a new route in linecache to fetch interactive source code (#117500) 2025-03-10 21:54:05 +00:00
Bartosz Sławecki 7ed3dc6392 gh-128231: Use runcode() return value for failing early (GH-129488) 2025-02-24 15:50:13 +01:00
Y5 a65366ed87 gh-124096: Enable REPL virtual terminal support on Windows (#124119)
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.

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-02-23 20:30:33 +01:00
donBarbos 510fefdc62 gh-127349: Add check for correct resizing in REPL (#127387) 2025-01-30 19:34:09 +00:00
Andy Fiddaman 0b15d9c0d2 gh-128330: Terminal control characters should be restored on repl exit (#128331) 2025-01-23 17:30:08 +00:00