Commit Graph

44 Commits

Author SHA1 Message Date
Sergey B Kirpichev 354d55eb1f
gh-121804: Always show error location for SyntaxError's in new repl (#121886) 2024-08-19 15:19:23 +01:00
CF Bolz-Tereick 63603bca35
gh-82378 fix sys.tracebacklimit in pyrepl, approach 2 (#123062)
Make sure that pyrepl uses the same logic for sys.tracebacklimit as both
the basic repl and the standard sys.excepthook
2024-08-18 13:28:23 +02:00
CF Bolz-Tereick bd3d31f380
gh-87320: In the code module, handle exceptions raised in sys.excepthook (GH-122456)
Before, the exception caused by calling non-default sys.excepthook
in code.InteractiveInterpreter bubbled up to the caller, ending the REPL.
2024-07-31 10:33:29 +00:00
Sam Gross 2c1b1e7a07
gh-121973: Fix flaky test_pyrepl tests (GH-122140)
This fixes the flakiness in:
* test_inspect_keeps_globals_from_inspected_file
* test_inspect_keeps_globals_from_inspected_module

The output already includes newlines. Adding newlines for every entry in
the output list introduces non-determinism because it added '\n' in
places where stdout is flushed or some buffer becomes full.

The regex also needed to be updated because pyrepl includes control
characters -- the visible output on each line doesn't immediately follow
a newline character.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-23 15:17:13 +02:00
Sam Gross a09e215abf
gh-121988: Fix test hang when pyrepl is not available (#121990)
Also explicitly fail the test if we timeout while waiting for output so
that this failure mode is caught earlier.
2024-07-20 16:04:14 +02:00
Łukasz Langa 19cbf8fd63
gh-120678: Guard against stdin.fileno() being unavailable (#121924) 2024-07-17 16:05:34 +00:00
Alex Waygood ac07451116
gh-120678: pyrepl: Include globals from modules passed with `-i` (GH-120904)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-17 16:18:42 +02:00
saucoide 7d111dac16
gh-121610: pyrepl - handle extending blocks when multi-statement blocks are pasted (GH-121757)
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 add a few extra checks to allow extending when in an indented
block, and tests for a few examples

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-16 01:33:57 +02:00
Sam Gross 4134261ab8
gh-121605: Fix test hang when pyrepl is not available (GH-121820)
The fallback repl does not support "exit" without parentheses, so the
test would hang until the timeout expired.
2024-07-16 00:50:16 +02:00
Sergey B Kirpichev fd085a411e
gh-121359: make clean environment (no PYTHON* vars) for test_pyrepl.TestMain (GH-121672)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-15 21:21:49 +02:00
Sam Gross abc3aeebdb
gh-121605: Increase timeout in test_pyrepl.run_repl (#121606)
We also need to close the `slave_fd` earlier so that reading from
`master_fd` won't block forever when the subprocess finishes.
2024-07-13 15:54:28 +02:00
Pablo Galindo Salgado 4b9e10d0ea
gh-121499: Fix multi-line history rendering in the REPL (#121531)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2024-07-13 12:54:10 +02:00
Marta Gómez Macías e745996b2d
gh-121609: Fix pasting of characters containing unicode character joiner (#121667) 2024-07-13 10:44:18 +00:00
Sergey B Kirpichev 68e279b37a
gh-121351: Skip test_not_wiping_history_file() if no readline (#121422) 2024-07-07 00:53:54 +02:00
Victor Stinner 6239d41527
gh-121359: Run test_pyrepl in isolated mode (#121414)
run_repl() now pass the -I option (isolated mode) to Python if the
'env' parameter is not set.
2024-07-05 22:30:08 +02:00
Sergey B Kirpichev afee76b6eb
gh-121245: a regression test for site.register_readline() (#121259) 2024-07-03 11:45:43 +01:00
Łukasz Langa d611c4c8e9
gh-118908: Use __main__ for the default PyREPL namespace (#121054) 2024-06-26 15:01:10 -04:00
devdanzin 9e45fd9858
gh-121016: Add test for `PYTHON_BASIC_REPL` envioronment variable (#121017) 2024-06-26 10:39:07 +00:00
Victor Stinner 0f3e36454d
gh-120635: Avoid leaking processes in test_pyrepl (#120676)
If the child process takes longer than SHORT_TIMEOUT seconds to
complete, kill the process but then wait until it completes with no
timeout to not leak child processes.
2024-06-19 15:14:29 +02:00
Victor Stinner f4d301d8b9
gh-120417: Remove unused imports in tests (part 4) (#120632) 2024-06-17 17:35:20 +02:00
Pablo Galindo Salgado 3453362183
gh-118908: Protect the REPL subprocess with a timeout in tests (#120408) 2024-06-12 19:09:25 +00:00
Eugene Triguba 86a8a1c57a
gh-118908: Limit exposed globals from internal imports and definitions on new REPL startup (#119547) 2024-06-11 17:40:31 +00:00
Jelle Zijlstra 9b8611eeea
gh-119180: PEP 649 compiler changes (#119361) 2024-06-11 13:06:49 +00:00
Pablo Galindo Salgado d9095194dd
gh-119842: Honor PyOS_InputHook in the new REPL (GH-119843)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Michael Droettboom <mdboom@gmail.com>
2024-06-04 20:32:43 +02:00
Lysandros Nikolaou 010ea93b2b
gh-119553: Clear reader on Ctrl-C command (GH-119801) 2024-06-04 19:46:33 +02:00
Lysandros Nikolaou 8fc7653766
gh-120041: Do not use append_to_screen when completions are visible (GH-120042) 2024-06-04 18:09:31 +02:00
Daniel Hollas 2e0aa731ae
gh-118835: pyrepl: Fix prompt length computation for custom prompts containing ANSI escape codes (#119942) 2024-06-03 18:07:06 +01:00
Łukasz Langa 6acb32fac3
Use Cirrus M1 macOS runners for CI (GH-119979)
Co-authored-by: Ee Durbin <ee@python.org>
2024-06-03 17:32:40 +02:00
Łukasz Langa 2237946af0
gh-118894: Make asyncio REPL use pyrepl (GH-119433) 2024-05-31 22:26:02 +02:00
Victor Stinner 91601a5596
gh-111201: Skip pyrepl Windows tests earlier (#119848)
Don't attempt to load pyrepl Windows console if platforms others than
Windows. For example, the import can fail if ctypes is missing.
2024-05-31 14:06:10 +00:00
Łukasz Langa 4c387a76f3
gh-111201: [pyrepl] Ensure optional platform-specific imports are optional (GH-119834) 2024-05-31 14:41:26 +02:00
Arnon Yaari dae0375bd9
gh-111201: Improve pyrepl auto indentation (#119606)
- auto-indent when editing multi-line block
- ignore comments
2024-05-31 11:02:54 +02:00
Dino Viehland 0d07182821
gh-111201: Support pyrepl on Windows (#119559)
Co-authored-by: Anthony Shaw <anthony.p.shaw@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-31 09:49:03 +02:00
Sergey B Kirpichev 86d1a1aa88
gh-119555: catch SyntaxError from compile() in the InteractiveColoredConsole (#119557) 2024-05-29 07:57:50 +01:00
Jelle Zijlstra a8e35e8eba
gh-119443: Turn off from __future__ import annotations in REPL (#119493) 2024-05-28 17:05:18 -07:00
Łukasz Langa 6e012ced6c
gh-119469: Fix _pyrepl reference leaks (#119470) 2024-05-23 19:28:31 +02:00
Aya Elsayed 5091c4400c
gh-118911: Trailing whitespace in a block shouldn't prevent the user from terminating the code block (#119355)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-22 07:56:35 +02:00
Pablo Galindo Salgado e6572e8f98
gh-111201: Speed up paste mode in the REPL (#119341)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-22 07:28:32 +02:00
Arnon Yaari cd516cd1f5
gh-111201: auto-indentation in _pyrepl (#119348)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-22 06:21:14 +02:00
Eugene Triguba 73ab83b27f
gh-119357: Increase test coverage for keymap in _pyrepl (#119358)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-22 04:36:01 +02:00
Koudai Aono 506b1a3ff6
gh-119205: Fix autocompletion bug in new repl (#119229)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-21 23:22:21 +00:00
Pablo Galindo Salgado a3e4fec873
gh-118893: Evaluate all statements in the new REPL separately (#119318)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-21 23:16:56 +00:00
Lysandros Nikolaou 561ff1fa71
gh-111201: Remove readline dependency from the PyREPL (#119262) 2024-05-21 22:30:45 +02:00
Eugene Triguba f49df4f486
gh-119306: Break up _pyrepl tests (#119307) 2024-05-21 18:44:09 +02:00