gh-112431: Unconditionally call `hash -r` (GH-112432)
The `activate` script calls `hash -r` in two places to make sure the shell picks
up the environment changes the script makes. Before that, it checks to
see if the shell running the script is bash or zsh.
`hash -r` is specified by POSIX and is not exclusive to bash and zsh.
This guard prevents the script from calling `hash -r` in other
`GH-!/bin/sh`-compatible shells like dash.
(cherry picked from commit a194938f33)
Co-authored-by: James Morris <6653392+J-M0@users.noreply.github.com>
gh-112105: Make completer delims work on libedit (gh-112106)
(cherry picked from commit 2df26d8348)
Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
* Remove mention of "vsapi" element type from the documentation.
* Add tests for element_create() and other ttk.Style methods.
* Add examples for element_create() in the documentation.
(cherry picked from commit 005d1e8fc8)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
gh-112388: Fix an error that was causing the parser to try to overwrite tokenizer errors (GH-112410)
(cherry picked from commit 2c8b191742)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
gh-94722: fix DocTest.__eq__ for case of no line number on one side (GH-112385)
(cherry picked from commit fbb9027a03)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
gh-73561: Omit interface scope from IPv6 when used as Host header (GH-93324)
Omit the `@interface_scope` from an IPv6 address when used as Host header by `http.client`.
---------
(cherry picked from commit ce1096f974)
[Google LLC]
Co-authored-by: Michael <35783820+mib1185@users.noreply.github.com>
IDLE: Fix test_debugger bug and buildbot failures (GH-112258)
Missing "requires('gui')" causes Tk() to fail when no gui.
This caused CI Hypothesis test to fail, but I did not understand
the its error message. Then buildbots failed.
IdbTest failed on draft Bdb replacement because so different.
Simplified version works on old and new.
(cherry picked from commit 14fd86a59d)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Add docstrings to the debugger module. Fix two bugs: initialize Idb.botframe (should be in Bdb); In Idb.in_rpc_code, check whether prev_frame is None before trying to use it. Make other code changes.
Expand test_debugger coverage from 19% to 66%.
---------
(cherry picked from commit adedcfa06b)
Co-authored-by: Anthony Shaw <anthony.p.shaw@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
gh-112194: Convert more examples to doctests in `typing.py` (GH-112195)
(cherry picked from commit 949b2cc6ea)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
[3.12] gh-102837: more tests for the math module (GH-111930)(GH-102523) (GH-112030)
* gh-102837: improve test coverage for math module (GH-102523)
(Only the test changes from GH-102523 are cherry-picked)
- input checks for math_1(L989), math_1a(L1023), math_2(L1064,L1071), hypot(L2682), log(L2307), ldexp(L2168), ceil(L1165), floor(L1236,L1239) and dist(L2587,L2588,L2628).
- improve fsum coverage for exceptional cases (L1433,L1438,L1451,L1497), ditto fmod(L2378)
(all line numbers are wrt the main branch at 5e6661bce9)
* gh-102837: more tests for the math module (GH-111930)
Add tests to improve coverage:
* fsum: L1369, L1379, L1383, L1412
* trunc: L2081
* log: L2267
* dist: L2577, L2579
* hypot: L2632
* (not cherry-picked for 3.11: sumprod)
* pow: L2982
* prod: L3294, L3308, L3318-3330
// line numbers wrt to 9dc4fb8204
(cherry picked from commit c61de456db)
---------
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
(cherry picked from commit c6aea46a71)
* Fix crash when encoding is not string or None.
* Fix crash when both line_buffering and write_through raise exception
when converted ti int.
* Add a number of tests for constructor and reconfigure() method
with invalid arguments.
(cherry picked from commit ee06fffd38)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
gh-112007: Re-organize help utility intro message (GH-112017)
Most important: move how-to-quit sentence to the end and mention 'q'.
Re-group the other sentences and improve some wording.
---------
(cherry picked from commit b28bb130bb)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
gh-111929: Fix regrtest --pgo: test_str => test_unicode (GH-111938)
test_unicode was renamed to test_str in Python 3.13, but Python 3.12
still uses test_unicode name.
(cherry picked from commit 5f42a2bc40)
Co-authored-by: Victor Stinner <vstinner@python.org>
Add DEFAULT_BUFFER_SIZE, text_encoding, and IncrementalNewlineDecoder.
(cherry picked from commit baeb7718f8)
Co-authored-by: Nicolas Tessore <n.tessore@ucl.ac.uk>
[3.12] gh-111881: Use lazy import in test.support (#111885) (#111890)
gh-111881: Use lazy import in test.support (#111885)
* Import lazily getpass in test.support
Backport to 3.11: test.support.os_helper is unchanged.
(cherry picked from commit 0372e3b02a)
(cherry picked from commit e983ca859d)
gh-111881: Import doctest lazily in libregrtest (GH-111884)
In most cases, doctest is not needed. So don't always import it at
startup. The change reduces the number of modules already
imported when a test is run.
(cherry picked from commit 6f09f69b7f)
Co-authored-by: Victor Stinner <vstinner@python.org>
[3.11] gh-101180: Fix a bug where iso2022_jp_3 and iso2022_jp_2004 codecs read out of bounds (gh-111695)
(cherry picked from commit c8faa3568a)
Co-authored-by: Masayuki Moriyama <masayuki.moriyama@miraclelinux.com>
* [3.12] GH-110894: Call loop exception handler for exceptions in client_connected_cb (GH-111601) (GH-111632)
(cherry picked from commit 9aa88290d8)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Call loop exception handler for exceptions in `client_connected_cb` of `asyncio.start_server` so that applications can handle it..
(cherry picked from commit 229f44d353)
* gh-111644: Fix asyncio test_unhandled_exceptions() (#111713)
Fix test_unhandled_exceptions() of test_asyncio.test_streams: break
explicitly a reference cycle.
Fix also StreamTests.tearDown(): the loop must not be closed
explicitly, but using set_event_loop() which takes care of shutting
down the executor with executor.shutdown(wait=True).
BaseEventLoop.close() calls executor.shutdown(wait=False).
(cherry picked from commit ac01e2243a)
---------
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
gh-111644: Fix support threading_cleanup() (GH-111714)
Copy the list of dangling threads to make sure that the list of
"Dangling thread" is complete. Previously, the list was incomplete if
threads completed just before the list was displayed.
Changes:
* Rewrite the warning to make it easier to understand.
* Use support.sleeping_retry().
* threading_cleanup() no longer copies threading._dangling,
but only counts the number of dangling thread.
* Remove support.gc_support() call.
(cherry picked from commit f62c7ccf9a)
Co-authored-by: Victor Stinner <vstinner@python.org>
gh-110367: Make regrtest --verbose3 compatible with --huntrleaks -jN (GH-111577)
"./python -m test -j1 -R 3:3 --verbose3" now works as expected, since
run_single_test() does not replace sys.stdout with StringIO in this
case.
(cherry picked from commit d9a5530d23)
Co-authored-by: Victor Stinner <vstinner@python.org>
gh-111380: Show SyntaxWarnings only once when parsing if invalid syntax is encouintered (GH-111381)
(cherry picked from commit 3d2f1f0b83)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
gh-111347: Remove wrong assertion in test_sendfile (GH-111377)
Windows is different.
(cherry picked from commit fa35b9e89b)
Co-authored-by: zcxsythenew <30565051+zcxsythenew@users.noreply.github.com>
- `ThreadedChildWatcher.close()` is now *officially* a no-op; `_join_threads()` never did anything.
- Threads created by that class are now named `asyncio-waitpid-NNN`.
- `test.test_asyncio.utils.TestCase.close_loop()` now waits for the child watcher's threads, but not forever; if a thread hangs, it raises `RuntimeError`.
(cherry picked from commit c3bb10c930)
Co-authored-by: Guido van Rossum <guido@python.org>
Fix locale.LC_CTYPE documentation to no longer mention string.lower() et al. Those functions were removed in Python 3.0:
https://docs.python.org/2/library/string.htmlGH-deprecated-string-functions
Also, fix a comment in logging about locale-specific behavior of `str.lower()`.
(cherry picked from commit 6d42759c5e)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>