Commit graph

115 commits

Author SHA1 Message Date
Serhiy Storchaka
279db6bede
gh-139640: Fix swallowing syntax warnings in different modules (GH-139755)
Revert GH-131993.

Fix swallowing some syntax warnings in different modules if they accidentally
have the same message and are emitted from the same line.
2025-10-14 17:48:09 +03:00
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
Stan Ulbrych
e7e3d1d4a8
gh-139805: Bump test_repl_eio timeout for slow builtbots (#139807) 2025-10-09 00:34:40 +02:00
Victor Stinner
c985822d86
gh-135329: Use longer timeout in pyrepl test_repl_eio() (#139503)
Replace hardcoded 5 seconds with support.SHORT_TIMEOUT.

Fix the following error on slow CI such as GitHub Action UBSan:

test test_pyrepl failed -- Traceback (most recent call last):
  File "Lib/test/test_pyrepl/test_unix_console.py", line 362, in test_repl_eio
    _, err = proc.communicate(timeout=5)  # sleep for pty to settle
             ~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "Lib/subprocess.py", line 1219, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
                     ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "Lib/subprocess.py", line 2126, in _communicate
    self._check_timeout(endtime, orig_timeout, stdout, stderr)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "Lib/subprocess.py", line 1266, in _check_timeout
    raise TimeoutExpired(
    ...<2 lines>...
            stderr=b''.join(stderr_seq) if stderr_seq else None)
subprocess.TimeoutExpired: Command '[...]' timed out after 5 seconds
2025-10-02 16:44:02 +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
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
Chris Eibl
4f3cab96c1
gh-138801: re-enable pyrepl tests on Windows (#138802) 2025-09-12 10:47:43 +03: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
Sam Gross
98d462cf4d
gh-137179: Fix flaky test_history_survive_crash test (gh-137180)
Kill the REPL subprocess once it prints the output from the command
immediately before the `time.sleep()`.
2025-07-29 14:25:50 -04: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
devdanzin
baccfdb3d4
gh-130999: Avoid exiting the new REPL when there are non-string candidates for suggestions (gh-131001) 2025-06-02 13:04:59 +02: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
1000283694
GH-130328: Fix WindowsConsoleGetEventTests after gh-133728 (gh-134660) 2025-05-25 20:17:13 +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
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
Jessica Temporal
faebf87b37
gh-134214: Fix test case in pyrepl (gh-134223) 2025-05-19 16:26:04 +02: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
Stan Ulbrych
dbca27cfca
gh-133379: Fix misuse of the term "arguments" in error messages (GH-133382)
The right term is "parameters".
2025-05-10 15:00:43 +03:00
Łukasz Langa
b2fabce6ab
gh-133541: Handle SyntaxError raised by the tokenizer on user input (#133606) 2025-05-08 21:14:38 +01:00
Tan Long
4617d68d73
gh-133639: Fix test_auto_indent_default() doesn't run input_code (#133640) 2025-05-08 09:24:19 +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
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
Ł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
sobolevn
b739ec5ab7
gh-133054: Skip test_pyrepl tests when cannot use pyrepl is reported (#133055)
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
2025-04-28 19:09:28 +03: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
Chris Eibl
815061cbab
speedup test_pyrepl (#132688)
speedup test_unix_console.py and test_windows_console.py
2025-04-19 02:12:40 +01:00
Tomas R.
3d08c8ad20
gh-131927: Prevent emitting optimizer warnings twice in the REPL (#131993) 2025-04-12 11:34:36 +01:00
Bartosz Sławecki
a6cf8275f8
gh-117174: Adapt test_multiple_statements_fail_early to new REPL behavior (follow-up gh-131065) (#131836)
Adapt test to new REPL behavior (follow-up gh-117174)
2025-03-28 15:09:31 +01:00
Łukasz Langa
5d8e981c84
gh-131507: Clean up tests and type checking for _pyrepl (#131509) 2025-03-21 15:48:10 +01:00
R. David Murray
a09c2b2ba6
Fix test_pyrepl.TestDumbTerminal if PYTHON_BASIC_REPL set. (#131332)
Most of the tests that care already adjust PYTHON_BASIC_REPL as needed,
but this one doesn't, and it fails if the developer has the variable set.
2025-03-17 18:56:21 +01:00
Victor Stinner
b2ca26875a
gh-131152: Remove unused imports from tests (part 2) (#131154) 2025-03-13 10:57:40 +01: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
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
Pieter Eendebak
0c4248f88e
gh-126332: Add tests for _pyrepl.utils (#129325) 2025-02-21 16:10:13 +00:00
AN Long
798f8d3ea9
Replace non-breaking spaces with normal spaces (#130116)
Using normal spaces in place of non-breaking spaces.
2025-02-16 09:33:14 +08:00
donBarbos
510fefdc62
gh-127349: Add check for correct resizing in REPL (#127387) 2025-01-30 19:34:09 +00:00
Tomas R.
ba9a4b6215
gh-128636: Fix crash in PyREPL when os.environ is overwritten with an invalid value (#128653) 2025-01-22 16:15:23 +00:00