Commit graph

57 commits

Author SHA1 Message Date
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
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
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
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
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
Ł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
Thomas Grainger
24c84d816f
gh-128770: fix ResourceWarning in test_pyrepl (#128906) 2025-01-22 12:48:33 +00:00
Daniel Hollas
29caec62ee
gh-118878: Pyrepl: show completions menu below the current line (#118939)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-01-21 21:06:13 +00:00
Lysandros Nikolaou
5a9afe2362
gh-123024: Correctly prepare/restore around help and show-history commands (#124485)
Co-authored-by: Emily Morehouse <emily@cuttlesoft.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-01-21 21:04:30 +00:00
Hugo van Kemenade
05d12eecbd
gh-127873: Only check sys.flags.ignore_environment for PYTHON* env vars (#127877) 2025-01-21 16:10:08 +00:00
Hugo van Kemenade
76856ae165
Revert "gh-128770: raise warnings as errors in test suite - except for test_socket which still logs warnings (#128726)" (#128936) 2025-01-17 15:16:10 +02:00
Thomas Grainger
7807b40730
gh-128770: raise warnings as errors in test suite - except for test_socket which still logs warnings (#128726)
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Brett Cannon <brett@python.org>
2025-01-17 13:39:16 +02:00
devdanzin
44becb8cba
gh-125666: Avoid PyREPL exiting when a null byte is in input (#125732) 2024-10-27 01:23:53 +00:00
Victor Stinner
65ce228d63
gh-125096: Don't import _pyrepl in site if PYTHON_BASIC_REPL (#125097)
If the PYTHON_BASIC_REPL environment variable is set, the site module
no longer imports the _pyrepl module.

Moreover, the site module now respects -E and -I command line
options: ignore PYTHON_BASIC_REPL in this case.
2024-10-08 15:48:40 +02:00
Jelle Zijlstra
365dffbaad
gh-119180: No longer set __annotations__ in __main__ (#124634) 2024-09-27 05:49:43 -07:00
Emily Morehouse
c1600c78e4
gh-123856: Fix PyREPL failure when a keyboard interrupt is triggered after using a history search (#124396)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-09-25 20:22:03 +02:00
aorcajo
e95984826e
gh-119310: Fix encoding when reading old history file (#121779)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-09-06 15:40:29 +02:00
Victor Stinner
8311b11800
gh-119034, REPL: Change page up/down keys to search in history (#123607)
Change <page up> and <page down> keys of the Python REPL to history
search forward/backward.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-09-06 13:15:00 +02:00
Arnon Yaari
d683f49a7b
gh-111201: fix auto-indent in pyrepl for muliple pound comments (#123196) 2024-09-06 07:33:40 +00:00
CF Bolz-Tereick
aa905925e1
gh-123228: don't leak file descriptors in pyrepl test (#123302) 2024-08-25 15:52:51 +01:00
Sergey B Kirpichev
ca18ff2a34
gh-123228: fix return type for _ReadlineWrapper.get_line_buffer() (#123281)
Co-authored-by: Carl Friedrich Bolz-Tereick <cfbolz@gmx.de>
2024-08-24 17:46:05 +02:00
Sergey B Kirpichev
4c3f0cbeae
gh-122546: Relax SyntaxError check when raising errors on the new REPL (#123233) 2024-08-23 00:25:33 +01:00
Sergey B Kirpichev
3d7b1a526d
gh-122546: use same filename for different exceptions in new repl (#123217)
* gh-122546: use same filename for different exceptions in new repl

* +1
2024-08-22 12:55:30 +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
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
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
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