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-101100: Define `_tkinter` module to fix references (GH-112382)
Define _tkinter module to fix references
(cherry picked from commit 6b961b8cea)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
gh-101100: Define `test.regrtest` module to fix references (GH-112381)
Define test.regrtest module to fix references
(cherry picked from commit d525d01e27)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
gh-59254: mention in open() doc that line buffering is for writing (GH-112318)
(cherry picked from commit fafae08cc7)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Fix docstring and var name of itertools recipe (GH-112113)
`prepend()` works with arbitrary iterables, not only iterators. In fact,
the example given uses a `list`, which is iterable, but not an iterator.
(cherry picked from commit 6c47eaccfa)
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
Add upstream Tk patches for three problems affecting tkinter users:
- Update macOS installer to include a fix accepted by upstream Tcl/Tk
for a crash encountered after the first :meth:`tkinter.Tk` instance
is destroyed. (gh-92603)
- Update macOS installer to include an upstream Tcl/Tk fix
for the ``ttk::ThemeChanged`` error encountered in Tkinter. (gh-71383)
- Update macOS installer to include an upstream Tcl/Tk fix for the
``Secure coding is not enabled for restorable state!`` warning
encountered in Tkinter on macOS 14 Sonoma. (gh-110950)
(cherry picked from commit d67f947c72)
Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
Co-authored-by: Ned Deily <nad@python.org>
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>
gh-112165: Fix typo in `__main__.py` (GH-112183)
Change '[2]' to '[1]' to get second argument.
(cherry picked from commit 8cd70eefc7)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
gh-110812: Isolating Extension Modules HOWTO: List GC-related gotchas (GH-111504)
(cherry picked from commit 985679f05d)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Eric Snow <ericsnowcurrently@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>
Docs: Add the time to the HTML last updated format (GH-110091)
(cherry picked from commit 6c214dea7c)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.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>
Augment the list of places where parentheses are
required around assignnment statements. In particular,
'a := 0' and 'a = b := 1' are syntax errors.
(cherry picked from commit 9a2f25d374)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Fix undefined behaviour in datetime.time.fromisoformat() (GH-111982)
Fix undefined behaviour in datetime.time.fromisoformat() when parsing a string without a timezone. 'tzoffset' is not assigned to by parse_isoformat_time if it returns 0, but time_fromisoformat then passes tzoffset to another function, which is undefined behaviour (even if the function in question does not use the value).
(cherry picked from commit 21615f77b5)
Co-authored-by: T. Wouters <thomas@python.org>
[3.12] gh-109181: Fix refleak in tb_get_lineno() (GH-111948)
PyFrame_GetCode() returns a strong reference.
(cherry picked from commit 4b0c875d91)
Co-authored-by: Victor Stinner <vstinner@python.org>
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>
GH-111804: Drop posix.fallocate() under WASI (GH-111869)
Drop posix.fallocate() under WASI.
The underlying POSIX function, posix_fallocate(), was found to vary too
much between implementations to remain in WASI. As such, while it was
available in WASI preview1, it's been dropped in preview2.
gh-111895: Convert definition list to bullet list for readability on mobile (GH-111898)
Convert definition list to bullet list for readability on mobile
(cherry picked from commit 7d21e3d5ee)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
[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>