Commit Graph

27203 Commits

Author SHA1 Message Date
Miss Islington (bot) 656eb16707
[3.11] bpo-11102: Make configure enable major(), makedev(), and minor() on HP-UX (GH-19856) (GH-113541)
Always include <sys/types.h> before <sys/sysmacros.h>.

(cherry picked from commit f108468970)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-28 11:02:23 +00:00
Miss Islington (bot) 54927cd21a
[3.11] bpo-26791: Update shutil.move() to provide the same symlink move behavior as the mv shell when moving a symlink into a directory that is the target of the symlink (GH-21759) (GH-113518)
(cherry picked from commit c66b577d9f)

Co-authored-by: Jeffrey Kintscher <49998481+websurfer5@users.noreply.github.com>
2023-12-27 19:03:45 +02:00
Miss Islington (bot) a1f0118a26
[3.11] gh-57795: IDLE: Enter the selected text when opening the "Replace" dialog (GH-17593) (GH-113515)
(cherry picked from commit 712afab5ac)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Co-authored-by: Roger Serwy <roger.serwy@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-27 14:43:59 +00:00
Serhiy Storchaka f1951900f1
[3.11] bpo-36959: Fix error messages for invalid ISO format string in _strptime() (GH-13408) (GH-113499)
Previously some error messages complained about incompatible
combinations of directives that are not contained in the format string.

(cherry picked from commit 4b2c3e8e43)

Co-authored-by: Gordon P. Hemsley <me@gphemsley.org>
2023-12-26 20:09:41 +00:00
Ronald Oussoren 0eea5c04b8
[3.11] gh-101778: Fix build error when there's a dangling symlink in the directory containing "ffi.h" (#113466)
gh-101778: Fix build error when there's a dangling symlink in the directory containing "ffi.h"
2023-12-26 10:05:48 +01:00
Serhiy Storchaka 4b358d754c
[3.11] gh-106905: Use separate structs to track recursion depth in each PyAST_mod2obj call. (GH-113035) (GH-113472) (GH-113476)
(cherry picked from commit 48c49739f5)
(cherry picked from commit d58a5f453f)

Co-authored-by: Yilei Yang <yileiyang@google.com>
Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
2023-12-25 20:40:33 +00:00
Miss Islington (bot) 1cc594d571
[3.11] bpo-37013: Fix the error handling in socket.if_indextoname() (GH-13503) (GH-112598)
* Fix a crash when pass UINT_MAX.
* Fix an integer overflow on 64-bit non-Windows platforms.
(cherry picked from commit 0daf555c6f)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2023-12-25 20:55:27 +02:00
Miss Islington (bot) d04ca4ccd7
[3.11] gh-113421: Fix multiprocessing logger for "%(filename)s" (GH-113423) (GH-113451)
(cherry picked from commit ce77ee5035)

Co-authored-by: Xu Song <xusong.vip@gmail.com>
2023-12-24 10:22:34 +00:00
Miss Islington (bot) 336d445934
[3.11] gh-113028: Correctly memoize str in pickle when escapes added (GH-113436) (GH-113449)
This fixes a divergence between the Python and C implementations of pickle
for protocol 0, such that it pickle.py fails to re-use the first pickled
representation of strings involving characters that have to be escaped.
(cherry picked from commit 08398631a0)

Co-authored-by: Jeff Allen <ja.py@farowl.co.uk>
2023-12-24 10:01:53 +00:00
Miss Islington (bot) b60bddbde2
[3.11] gh-112559: Avoid unnecessary conversion attempts to enum_klass in signal.py (GH-113040) (#113444)
gh-112559: Avoid unnecessary conversion attempts to enum_klass in signal.py (GH-113040)
(cherry picked from commit 050783cb37)

Co-authored-by: Yilei Yang <yileiyang@google.com>
2023-12-23 18:09:46 -08:00
Miss Islington (bot) 478da38e74
[3.11] gh-74573: document that ndbm can silently corrupt databases on macOS (GH-113354) (#113432)
gh-74573: document that ndbm can silently corrupt databases on macOS (GH-113354)

* gh-74573: document that ndbm can silently corrupt databases on macOS

The system ndbm implementation on macOS has an undocumented limitation
on the size of values and can silently corrupt database files when those
are exceeded.

(cherry picked from commit 593b4d81d2)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-12-23 13:49:58 +01:00
Miss Islington (bot) 80b2bad2c2
[3.11] gh-113188: Fix shutil.copymode() and shutil.copystat() on Windows (GH-113285) (GH-113426)
Previously they worked differenly if dst is a symbolic link:
they modified the permission bits of dst itself rather than the file
it points to if follow_symlinks is true or src is not a symbolic link,
and did nothing if follow_symlinks is false and src is a symbolic link.
(cherry picked from commit c7874bb56f)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-23 12:53:48 +02:00
Miss Islington (bot) 706b40e892
[3.11] gh-65701: document that freeze doesn't work with framework builds on macOS (GH-113352) (#113361)
gh-65701: document that freeze doesn't work with framework builds on macOS (GH-113352)

* gh-65701: document that freeze doesn't work with framework builds on macOS

The framework install is inherently incompatible with freeze. Document
that that freeze doesn't work with framework builds and bail out
early when trying to run freeze anyway.

(cherry picked from commit df1eec3dae)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-12-22 11:16:59 +01:00
Miss Islington (bot) 90593e6fa1
[3.11] gh-112305: Fix check-clean-src to detect frozen_modules .h files. (GH-113344) (#113347)
gh-112305: Fix check-clean-src to detect frozen_modules .h files. (GH-113344)

A typo left this check broken so many of us who do out-of-tree builds
were seeing strange failures due to bad `Python/frozen_modules/*.h`
files being picked up from the source tree and used at build time from
different Python versions leading to errors like:

`Fatal Python error: _PyImport_InitCore: failed to initialize importlib`

Or similar once our build got to an "invoke the interpreter"
bootstrapping step due to incorrect bytecode being embedded.
(cherry picked from commit 103c4ea274)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-12-21 07:47:20 +00:00
Miss Islington (bot) 9cbe4738bc
[3.11] GH-113214: Fix SSLProto exception handling in SSL-over-SSL scenarios (GH-113334) (#113340)
When wrapped, `_SSLProtocolTransport._force_close(exc)` is called just like in the unwrapped scenario `_SelectorTransport._force_close(exc)` or `_ProactorBasePipeTransport._force_close(exc)` would be called, except here the exception needs to be passed through the `SSLProtocol._abort()` method, which didn't accept an exception object.

This commit ensures that this path works, in the same way that the uvloop implementation of SSLProto passes on the exception (on which the current implementation of SSLProto is based).

(cherry picked from commit 1ff0238594)

Co-authored-by: Martijn Pieters <mj@zopatista.com>
2023-12-20 16:51:51 -08:00
Miss Islington (bot) 5e0d9aea99
[3.11] gh-102362: Fix macOS version number in result of sysconfig.get_platform() (GH-112942) (#113265)
gh-102362: Fix macOS version number in result of sysconfig.get_platform() (GH-112942)

Change _osx_support.get_platform_osx() to make sure that the
version number in the result includes at least a major and
minor version (e.g. 14.2) even if MACOSX_DEPLOYMENT_TARGET is
set to just a major version (e.g. 14).

This matches the versions expected by pip when selecting
appropriate wheels for installation.
(cherry picked from commit 893c9ccf48)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
2023-12-19 19:57:08 +01:00
Hugo van Kemenade 182676beba
[3.11] gh-101100: Fix Sphinx warnings in `library/ast.rst` (GH-113289) (#113291) 2023-12-19 18:12:33 +02:00
Miss Islington (bot) 1dd2ad6f8e
[3.11] gh-113269: IDLE - Fix test_editor hang (macOS) (GH-113271) (#113273)
gh-113269: IDLE - Fix test_editor hang (macOS) (GH-113271)

Hangs on installed 3.13.0a2 on macOS Catalina.
Behavior on installed 3.12.1 and 3.11.7 is unknown.
(cherry picked from commit fa9ba02353)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2023-12-19 05:42:59 +00:00
Miss Islington (bot) 44bdb6d55c
[3.11] gh-113199: Make read1() and readline() of HTTPResponse close IO after reading all data (GH-113200) (GH-113260)
(cherry picked from commit 41336a72b9)

Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
2023-12-18 20:34:15 +00:00
Stéphane Bidoul 2cd3564738
[3.11] gh-113246: Updated bundled pip to 23.3.2 (gh-113249) (#113254)
Updated bundled pip to 23.3.2.
(cherry picked from commit 4a24bf9a13)
2023-12-18 11:34:58 +00:00
Miss Islington (bot) a7a176de07
[3.11] gh-110746: Improve markup in ``tkinter.ttk.rst`` (GH-111236) (#113194)
gh-110746: Improve markup in ``tkinter.ttk.rst`` (GH-111236)

* gh-110746: Improve markup in tkinter.ttk.rst

* gh-110746: Improve markup in tkinter.ttk.rst

* 📜🤖 Added by blurb_it.

---------

(cherry picked from commit 00d2b6d1fc)

Co-authored-by: Akshat Khandelwal <35228810+akshatgokul@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2023-12-15 22:56:36 +01:00
Miss Islington (bot) 220fae7706
[3.11] gh-113009: Fix multiprocessing Process.terminate() on Windows (GH-113128) (#113178)
gh-113009: Fix multiprocessing Process.terminate() on Windows (GH-113128)

On Windows, Process.terminate() no longer sets the returncode
attribute to always call WaitForSingleObject() in Process.wait().
Previously, sometimes the process was still running after
TerminateProcess() even if GetExitCodeProcess() is not STILL_ACTIVE.
(cherry picked from commit 4026ad5b2c)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-12-15 15:20:18 +00:00
Miss Islington (bot) 6ff7c1311f
[3.11] gh-61648: Detect line numbers of properties in doctests (GH-113161) (GH-113165)
(cherry picked from commit 8f8f0f97e1)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-15 13:38:45 +00:00
Serhiy Storchaka d4234937a1
[3.11] gh-112716: Fix SystemError when __builtins__ is not a dict (GH-112770) (GH-113105)
It was raised in two cases:
* in the import statement when looking up __import__
* in pickling some builtin type when looking up built-ins iter, getattr, etc.

(cherry picked from commit 1161c14e8c)
2023-12-14 12:59:33 +00:00
Miss Islington (bot) a45a059afe
[3.11] bpo-40648: Test modes that file can get with chmod() on Windows (GH-20130) (GH-113069)
Order of tests matter second part makes testing file writable and
possible to remove again.
(cherry picked from commit f5c05e015c)

Co-authored-by: Pavol Babinčák‏ <scroolik@gmail.com>
2023-12-13 20:48:43 +00:00
Hugo van Kemenade 51858aa606
[3.11] gh-101100: Fix Sphinx warning in references with asterisks (GH-113029) (#113044) 2023-12-13 11:02:20 +02:00
Miss Islington (bot) 5aec2d2452
[3.11] gh-94606: Fix error when message with Unicode surrogate not surrogateescaped string (GH-94641) (GH-112972)
(cherry picked from commit 27a5fd8cb8)

Co-authored-by: Sidney Markowitz <sidney@sidney.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-11 16:47:25 +00:00
Miss Islington (bot) a37e1473da
[3.11] gh-112898: warn about unsaved files when quitting IDLE on macOS (GH-112939) (#112961)
gh-112898: warn about unsaved files when quitting IDLE on macOS (GH-112939)

* gh-112898: warn about unsaved files when quitting IDLE on macOS

Implement the TK function ``::tk::mac::Quit`` on macOS to
ensure that IDLE asks about saving unsaved files when
quitting IDLE.

(cherry picked from commit 3251ba8f1a)


Co-authored-by: Christopher Chavez chrischavez@gmx.us

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
2023-12-11 17:14:45 +01:00
Miss Islington (bot) 95f5c8c46c
[3.11] gh-109980: Fix test_tarfile_vs_tar on macOS (GH-112905) (#112928)
gh-109980: Fix test_tarfile_vs_tar on macOS (GH-112905)

On recentish macOS versions the system tar
command includes system metadata (ACLs, extended attributes
and resource forks) in the tar archive, which
shutil.make_archive will not do. This can cause
spurious test failures.
(cherry picked from commit dd2ebdf89f)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
2023-12-10 19:50:10 +01:00
Miss Islington (bot) 2d8012f852
[3.11] gh-79429: Ignore FileNotFoundError when remove a temporary directory in the multiprocessing finalizer (GH-112865) (GH-112897)
(cherry picked from commit 7e82c626c4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-09 13:31:42 +00:00
Miss Islington (bot) 1eac0aab85
[3.11] gh-110017: Disable test_signal.test_stress_modifying_handlers on macOS (GH-112834) (#112852)
gh-110017: Disable test_signal.test_stress_modifying_handlers on macOS (GH-112834)

Test test_stress_modifying_handlers in test_signal can crash
the interpreter due to a bug in macOS. Filed as FB13453490
with Apple.
(cherry picked from commit bf0beae6a0)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
2023-12-08 10:08:04 +01:00
Serhiy Storchaka a18201bff1
[3.11] gh-79325: Fix recursion error in TemporaryDirectory cleanup on Windows (GH-112762) (GH-112848)
(cherry picked from commit b2923a61a1)
2023-12-07 17:46:30 +00:00
Serhiy Storchaka 5585334d77
[3.11] gh-91133: tempfile.TemporaryDirectory: fix symlink bug in cleanup (GH-99930) (GH-112839)
(cherry picked from commit 81c16cd94e)

Co-authored-by: Søren Løvborg <sorenl@unity3d.com>
2023-12-07 18:37:10 +02:00
Miss Islington (bot) 666a484d29
[3.11] gh-109981: Fix support.fd_count() on macOS 14 (GH-112797) (#112825)
gh-109981: Fix support.fd_count() on macOS 14 (GH-112797)

Use scanning "/dev/fd/" on macOS in support.fd_count(). That's both more efficient than scanning all possible file descriptors, and avoids crashing the interpreter when there are open "guarded" file descriptors.

"Guarded" file descriptors are a macOS feature where file descriptors used by system libraries are marked and cause hard crashes when used by "user" code.

(cherry picked from commit 953ee622b3)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2023-12-07 11:28:54 +01:00
Diego Russo b49c963e85
[3.11] gh-110190: Fix ctypes structs with array on Arm (#112604) (#112766)
Set MAX_STRUCT_SIZE to 32 in stgdict.c when on Arm platforms.
This because on Arm platforms structs with at most 4 elements of any
floating point type values can be passed through registers. If the type
is double the maximum size of the struct is 32 bytes.
On x86-64 Linux, it's maximum 16 bytes hence we need to differentiate.

(cherry picked from commit bc68f4a4ab)
2023-12-06 16:57:42 +01:00
Miss Islington (bot) 010819a295
[3.11] gh-75666: Tkinter: "unbind(sequence, funcid)" now only unbinds "funcid" (GH-111322) (GH-112801)
Previously, "widget.unbind(sequence, funcid)" destroyed the current binding
for "sequence", leaving "sequence" unbound, and deleted the "funcid"
command.

Now it removes only "funcid" from the binding for "sequence", keeping
other commands, and deletes the "funcid" command.
It leaves "sequence" unbound only if "funcid" was the last bound command.

(cherry picked from commit cc7e45cc57)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: GiovanniL <13402461+GiovaLomba@users.noreply.github.com>
2023-12-06 15:04:07 +00:00
Miss Islington (bot) 36f6fa4640
[3.11] gh-112769: test_zlib: Fix comparison of ZLIB_RUNTIME_VERSION with non-int suffix (GH-112771) (GH-112774)
zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813ff1)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
2023-12-05 20:02:06 +00:00
Miss Islington (bot) 54ca4c64d0
[3.11] bpo-35332: Handle os.close() errors in shutil.rmtree() (GH-23766) (GH-112764)
* Ignore os.close() errors when ignore_errors is True.
* Pass os.close() errors to the error handler if specified.
* os.close no longer retried after error.

(cherry picked from commit 11d88a178b)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-05 19:25:52 +00:00
Miss Islington (bot) 23920a0843
[3.11] bpo-43153: Don't mask `PermissionError` with `NotADirectoryError` during tempdirectory cleanup (GH-29940) (GH-112754)
(cherry picked from commit 8cdfee1bb9)

Co-authored-by: Ken Jin <kenjin@python.org>
Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-05 13:44:49 +00:00
Pablo Galindo 012381cd2b Merge remote-tracking branch 'upstream/3.11' into 3.11 2023-12-04 21:50:17 +00:00
Miss Islington (bot) be4acc7040
[3.11] gh-105967: Work around a macOS bug, limit zlib C library crc32 API calls to 1gig (GH-112615) (#112725)
gh-105967: Work around a macOS bug, limit zlib C library crc32 API calls to 1gig (GH-112615)

Work around a macOS bug, limit zlib crc32 calls to 1GiB.

Without this, `zlib.crc32` and `binascii.crc32` could produce incorrect
results on multi-gigabyte inputs depending on the macOS version's Apple
supplied zlib implementation.
(cherry picked from commit 4eddb4c9d9)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-12-04 20:20:41 +00:00
Pablo Galindo fa7a6f2303 Python 3.11.7 2023-12-04 17:56:29 +00:00
Miss Islington (bot) 8dbda1cf3e
[3.11] gh-108927: Fix removing testing modules from sys.modules (GH-108952) (ПР-112712)
It breaks import machinery if the test module has submodules used in
other tests.
(cherry picked from commit e08b70fab1)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-04 18:16:03 +02:00
Miss Islington (bot) e3d380ded6
[3.11] gh-109786: Fix leaks and crash when re-enter itertools.pairwise.__next__() (GH-109788) (GH-112700)
(cherry picked from commit 6ca9d3e017)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-04 12:20:19 +00:00
Miss Islington (bot) 7e89dd9926
[3.11] gh-112625: Protect bytearray from being freed by misbehaving iterator inside bytearray.join (GH-112626) (GH-112694)
(cherry picked from commit 0e732d0997)

Co-authored-by: chilaxan <chilaxan@gmail.com>
2023-12-04 10:37:25 +02:00
Miss Islington (bot) db537702e4
[3.11] [3.12] gh-112618: Make Annotated cache typed (GH-112619) (GH-112628) (#112633)
[3.12] gh-112618: Make Annotated cache typed (GH-112619) (GH-112628)
(cherry picked from commit 2a378ca2ef)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-12-03 00:58:13 +00:00
Alexey Izbyshev 0443f926be
[3.11] bpo-35191: Fix unexpected integer truncation in socket.setblocking() (GH-10415)
On platforms with 64-bit long, socket.setblocking(x) treated all x
which lower 32 bits are zero as False due to integer truncation.

Reported by ubsan.
2023-12-01 17:44:03 +02:00
Miss Islington (bot) f6edb83fe9
[3.11] gh-112509: Fix keys being present in both required_keys and optional_keys in TypedDict (GH-112512) (#112531)
(cherry picked from commit 4038869423)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-11-29 17:51:00 +00:00
Miss Islington (bot) 42dd2613fe
[3.11] gh-112105: Make completer delims work on libedit (gh-112106) (gh-112488)
gh-112105: Make completer delims work on libedit (gh-112106)
(cherry picked from commit 2df26d8348)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2023-11-28 06:39:47 +00:00
Miss Islington (bot) c3e5d0d936
[3.11] gh-68166: Tkinter: Add tests and examples for element_create() (GH-111453) (GH-111858)
* 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>
2023-11-27 20:14:30 +00:00
Miss Islington (bot) 390a5b81a9
[3.11] gh-112387: Fix error positions for decoded strings with backwards tokenize errors (GH-112409) (#112469)
gh-112387: Fix error positions for decoded strings with backwards tokenize errors (GH-112409)
(cherry picked from commit 45d648597b)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2023-11-27 19:05:20 +00:00
Miss Islington (bot) 43b081bfc4
[3.11] gh-112388: Fix an error that was causing the parser to try to overwrite tokenizer errors (GH-112410) (#112467)
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>
2023-11-27 18:56:27 +00:00
Serhiy Storchaka 054d18e883
[3.11] bpo-41422: Visit the Pickler's and Unpickler's memo in tp_traverse (GH-21664) (GH-112465)
(cherry picked from commit 967f2a3052)

Co-authored-by: kale-smoothie <34165060+kale-smoothie@users.noreply.github.com>
2023-11-27 18:46:34 +00:00
Serhiy Storchaka 581b244155
[3.11] gh-112438: Fix support of format units with the "e" prefix in nested tuples in PyArg_Parse (gh-112439) (GH-112461)
(cherry picked from commit 4eea1e8236)
2023-11-27 18:11:09 +00:00
Serhiy Storchaka 6d9b1819b8
[3.11] gh-84443: SSLSocket.recv_into() now support buffer protocol with itemsize != 1 (GH-20310) (GH-112459)
It is also no longer use __len__().

(cherry picked from commit 812360fddd)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2023-11-27 17:41:05 +00:00
Miss Islington (bot) 8c9f273760
[3.11] gh-94722: fix DocTest.__eq__ for case of no line number on one side (GH-112385) (#112401)
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>
2023-11-25 17:39:16 +00:00
Miss Islington (bot) 253ad788c6
[3.11] gh-110950: add upstream Tk fixes to macOS installer. (GH-111041) (#112293)
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>
2023-11-21 08:29:34 +00:00
DPR 13975051b5
[3.11] gh-109538: Catch closed loop runtime error and issue warning (GH-111983) (#112141)
Issue a ResourceWarning instead.

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
(cherry picked from commit e0f5127975)
2023-11-20 15:12:17 -08:00
Nikita Sobolev 6c51c84b39
[3.11] gh-112266: Remove `(if defined)` part from `__dict__` and `__weakref__` docstrings (GH-112268) (#112276) 2023-11-20 09:04:38 +00:00
Miss Islington (bot) f6e11eab49
[3.11] gh-73561: Omit interface scope from IPv6 when used as Host header (GH-93324) (#112273)
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>
2023-11-19 15:25:40 -08:00
Miss Islington (bot) e19d75df76
[3.11] gh-79871: IDLE - Fix and test debugger module (GH-11451) (#112257)
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>
2023-11-19 04:34:54 +00:00
Miss Islington (bot) e2421a36f0
[3.11] gh-111942: Fix crashes in TextIOWrapper.reconfigure() (GH-111976) (GH-112059)
* 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>
2023-11-15 14:20:18 +00:00
Miss Islington (bot) cd3e2d3a6c
[3.11] gh-111841: Fix os.putenv() and os.unsetenv() with embedded NUL on Windows (GH-111842) (GH-111967)
(cherry picked from commit 0b06d2482d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-11-11 11:17:29 +02:00
Miss Islington (bot) 7b55a955bc
[3.11] gh-111251: Fix error checking in _blake2 module init (GH-111252) (#111298)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-11-10 14:43:51 +00:00
Miss Islington (bot) 0e45786a6a
gh-111356: io: Add missing documented objects to io.__all__ (GH-111370)
Add DEFAULT_BUFFER_SIZE, text_encoding, and IncrementalNewlineDecoder.
(cherry picked from commit baeb7718f8)

Co-authored-by: Nicolas Tessore <n.tessore@ucl.ac.uk>
2023-11-10 07:32:41 +00:00
Brett Cannon 226f4bc692
[3.11] GH-111804: Drop posix.fallocate() under WASI (GH-111869) (GH-111920)
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.
2023-11-09 15:36:15 -08:00
Donghee Na bd4cc4715f
[3.11] gh-101180: Fix a bug where iso2022_jp_3 and iso2022_jp_2004 co… (gh-111771)
[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>
2023-11-06 11:29:59 +00:00
Miss Islington (bot) 425efc1182
[3.11] gh-111159: Fix `SyntaxError` doctests for non-builtin exception classes (GH-111541) (#111733)
gh-111159: Fix `SyntaxError` doctests for non-builtin exception classes (GH-111541)
(cherry picked from commit 18c954849b)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-11-04 10:12:15 +00:00
Miss Islington (bot) f7ffe4a8ea
[3.11] [3.12] GH-110894: Call loop exception handler for exceptions in client_connected_cb (GH-111601) (GH-111632) (#111634)
* [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>
2023-11-04 01:23:01 +00:00
Miss Islington (bot) 1d7ad7780a
[3.11] gh-110367: Make regrtest --verbose3 compatible with --huntrleaks -jN (GH-111577) (#111590)
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>
2023-11-01 03:57:23 +00:00
Pablo Galindo Salgado a4aa213b65
[3.11] gh-109181: Speed up Traceback object creation by lazily compute the line number (GH-111548) (#111550)
.
(cherry picked from commit abb15420c1)
2023-10-31 15:59:31 +00:00
Pablo Galindo Salgado 19a266ca89
[3.11] gh-111366: Correctly show custom syntax error messages in the codeop module functions (GH-111384). (#111516)
(cherry picked from commit cd6e0a04a1)
2023-10-31 14:41:20 +00:00
Miss Islington (bot) 08e4e11b75
[3.11] gh-111380: Show SyntaxWarnings only once when parsing if invalid syntax is encouintered (GH-111381) (#111383)
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>
2023-10-31 13:29:42 +00:00
Miss Islington (bot) c66f0bedeb
[3.11] gh-111531: Tkinter: fix reference leaks in bind_class() and bind_all() (GH-111533) (GH-111536)
(cherry picked from commit e3353c498d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-10-31 07:13:29 +00:00
Hugo van Kemenade e7cdcccd26
[3.11] gh-111187: Postpone removal version for locale.getdefaultlocale() to 3.15 (GH-111188) (#111326) 2023-10-27 16:08:53 +03:00
Pablo Galindo Salgado 22cde39fbf
[3.11] bpo-43950: handle wide unicode characters in tracebacks (GH-28150) (#111373) 2023-10-27 09:46:20 +09:00
Savannah Ostrowski 12c7e5071c
[3.11] GH-94438: Restore ability to jump over None tests (GH-111338)
(cherry picked from commit 6640f1d)
2023-10-25 20:47:16 +00:00
Serhiy Storchaka fc9a5ef1a8
[3.11] [3.12] gh-111165: Move test running code from test.support to libregrtest (GH-111166) (GH-111316) (GH-111318)
Remove no longer used functions run_unittest() and run_doctest() from
the test.support module.
(cherry picked from commit f6a45a03d0)
(cherry picked from commit 5c4f9a1c7e)
2023-10-25 12:37:19 +00:00
Serhiy Storchaka 14167031eb
[3.11] gh-111309: Use unittest to collect and run distutils tests (GH-111311)
* use unittest.main() instead of run_unittest(test_suite()) to run tests from
  modules via the CLI
* add explicit load_tests() to load doctests
* use test.support.load_package_tests() to load tests in submodules of
  distutils.tests
* removes no longer needed test_suite() functions
2023-10-25 14:57:17 +03:00
Miss Islington (bot) bb92fdabc7
[3.11] gh-111174: Fix crash in getbuffer() called repeatedly for empty BytesIO (GH-111210) (GH-111315)
(cherry picked from commit 9da98c0d9a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-10-25 11:18:30 +00:00
Miss Islington (bot) 3c3c489d41
[3.11] gh-110196: Fix ipaddress.IPv6Address.__reduce__ (GH-110198) (GH-111190)
(cherry picked from commit 767f416feb)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2023-10-22 19:12:58 +00:00
Miss Islington (bot) cf777399a9
[3.11] gh-111085: Fix invalid state handling in TaskGroup and Timeout (GH-111111) (GH-111172)
asyncio.TaskGroup and asyncio.Timeout classes now raise proper RuntimeError
if they are improperly used.

* When they are used without entering the context manager.
* When they are used after finishing.
* When the context manager is entered more than once (simultaneously or
  sequentially).
* If there is no current task when entering the context manager.

They now remain in a consistent state after an exception is thrown,
so subsequent operations can be performed correctly (if they are allowed).

(cherry picked from commit 6c23635f2b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>
2023-10-21 19:40:07 +00:00
Miss Islington (bot) cf28c61c73
[3.11] gh-111159: Fix `doctest` output comparison for exceptions with notes (GH-111160) (#111170)
gh-111159: Fix `doctest` output comparison for exceptions with notes (GH-111160)
(cherry picked from commit fd60549c0a)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-10-21 18:23:38 +00:00
Serhiy Storchaka 4222dd93af
[3.11] gh-110918: regrtest: allow to intermix --match and --ignore options (GH-110919) (GH-111168)
Test case matching patterns specified by options --match, --ignore,
--matchfile and --ignorefile are now tested in the order of
specification, and the last match determines whether the test case be run
or ignored.
(cherry picked from commit 9a1fe09622)
2023-10-21 17:30:19 +00:00
Miss Islington (bot) 47670fbdd0
[3.11] gh-110932: Fix regrtest for SOURCE_DATE_EPOCH (GH-111143) (#111153)
gh-110932: Fix regrtest for SOURCE_DATE_EPOCH (GH-111143)

If the SOURCE_DATE_EPOCH environment variable is defined, use its
value as the random seed.
(cherry picked from commit 7237fb578d)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-10-21 09:01:10 +00:00
Miss Islington (bot) 69bcaf7e0e
gh-110913: Fix WindowsConsoleIO chunking of UTF-8 text (GH-111007)
(cherry picked from commit 11312eae6e)

Co-authored-by: Tamás Hegedűs <sorgloomer@users.noreply.github.com>
2023-10-20 12:19:04 +00:00
Miss Islington (bot) 69f0c90011
[3.11] gh-111092: Make turtledemo run without default root enabled (GH-111093) (#111096)
gh-111092: Make turtledemo run without default root enabled (GH-111093)

Add missing 'root' argument to PanedWindow call.
Other root children already have it.
(cherry picked from commit b802882fb2)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2023-10-20 04:25:17 +00:00
Miss Islington (bot) f22cdecb19
[3.11] GH-101100: Fix reference warnings for ``__enter__`` and ``__exit__`` (GH-110112) (#111076)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-10-19 18:34:27 +03:00
Miss Islington (bot) 1b60244b97
[3.11] GH-101100: Fix reference warnings for ``__getitem__`` (GH-110118) (#111074)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-10-19 18:33:12 +03:00
Radislav Chugunov 26a028269b
[3.11] gh-108791: Fix pdb CLI invalid argument handling (GH-108816) (#111063)
* [3.11] gh-108791: Fix `pdb` CLI invalid argument handling (GH-108816)
(cherry picked from commit 162213f2db)

Co-authored-by: Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com>
2023-10-19 14:26:40 +01:00
Tian Gao fabfc2ccfc
[3.11] GH-65052: Prevent pdb from crashing when trying to display objects (GH-111002)
(cherry picked from commit c523ce0f43)
2023-10-18 16:42:36 -07:00
Miss Islington (bot) 8e3d90c332
[3.11] gh-111015: Install IDLE.app and Python Launcher.app on macOS with correct permissions (gh-111038)
(cherry picked from commit cb1bf89c40)

Co-authored-by: Joshua Root <jmr@macports.org>
Co-authored-by: Ned Deily <nad@python.org>
2023-10-18 13:25:04 +00:00
Pablo Galindo Salgado 4e4a3e161f
[3.11] gh-110696: Fix incorrect syntax error message for incorrect argument unpacking (GH-110706) (#110766) 2023-10-18 13:59:17 +01:00
Miss Islington (bot) 73ebe2f881
[3.11] gh-110995: Fix test_gdb check_usable_gdb() (GH-110998) (#111004)
gh-110995: Fix test_gdb check_usable_gdb() (GH-110998)

Fix detection of gdb built without Python scripting support.

* check_usable_gdb() doesn't check gdb exit code when calling
  run_gdb().
* Use shutil.which() to get the path to the gdb program.
(cherry picked from commit 920b3dfaca)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-10-17 18:43:46 +00:00
Serhiy Storchaka 5c55f50a71
[3.11] [3.12] bpo-42663: Fix parsing TZ strings in zoneinfo module (GH-23825) (GH-110882) (GH-110889)
zipinfo now supports the full range of values in the TZ string
determined by RFC 8536 and detects all invalid formats.
Both Python and C implementations now raise exceptions of the same
type on invalid data.
(cherry picked from commit ab08ff7882)
(cherry picked from commit 72b0f0eaf5)
2023-10-15 08:32:26 +00:00
Miss Islington (bot) 1c26f1ce6c
[3.11] gh-109747: Improve errors for unsupported look-behind patterns (GH-109859) (GH-110860)
Now re.error is raised instead of OverflowError or RuntimeError for
too large width of look-behind pattern.

The limit is increased to 2**32-1 (was 2**31-1).
(cherry picked from commit e2b3d831fd)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-10-14 06:51:24 +00:00
Nikita Sobolev e16922f070
[3.11] gh-109216: Fix possible memory leak in `BUILD_MAP` (#109323)
* [3.11] gh-109216: Fix possible memory leak in `BUILD_MAP`

* Add NEWS

* Update Python/ceval.c

Co-authored-by: Kumar Aditya <kumaraditya@python.org>

---------

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2023-10-12 12:52:03 +00:00
Erlend E. Aasland 5178fb0b89
[3.11] GH-107518: Remove the Argument Clinic How-To (#109900) (#110761)
(cherry picked from commit d1f7fae424)

* Remove the content of the Argument Clinic HOWTO
* Update cross-references to the Argument Clinic
* Add a note directing readers to the devguide

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-10-12 09:52:59 +00:00
Hugo van Kemenade fd061a9bbe
[3.11] gh-108826: Document `dis` module CLI and rename `_test` function to `main` (#108827) (#110689)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com>
2023-10-11 14:48:03 -06:00
Miss Islington (bot) ad50415637
[3.11] gh-99834: Update macOS installer to Tcl/Tk 8.6.13. (GH-110710)
(cherry picked from commit 13e460086b)

Co-authored-by: Ned Deily <nad@python.org>
2023-10-11 21:42:24 +02:00
Miss Islington (bot) 46347d3caf
[3.11] gh-110647: Fix signal test_stress_modifying_handlers() (GH-110650) (#110659)
gh-110647: Fix signal test_stress_modifying_handlers() (GH-110650)

* cycle_handlers() now waits until at least one signal is received.
* num_received_signals can be equal to num_sent_signals.
(cherry picked from commit e07c37cd52)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-10-11 00:21:51 +00:00
Erlend E. Aasland a009bb872c
[3.11] gh-109286: Update Windows installer to use SQLite 3.43.1 (#110403) (#110479) 2023-10-11 00:41:12 +02:00
Serhiy Storchaka 3788c48d12
[3.11] gh-110388: Add tests for tty (GH-110394) (GH-110634)
(cherry picked from commit 7f702b2)
2023-10-10 16:27:22 +02:00
Miss Islington (bot) e511f544ea
[3.11] gh-81002: Add tests for termios (GH-110386) (GH-110620)
(cherry picked from commit 92a9e98024)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-10-10 14:11:06 +02:00
Miss Islington (bot) 7fefed091a
[3.11] gh-110590: Fix a bug where _sre.compile would overwrite exceptions (GH-110591) (#110614)
TypeError would be overwritten by OverflowError
if 'code' param contained non-ints.
(cherry picked from commit 344d3a222a)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-10-10 10:48:07 +00:00
Miss Islington (bot) 2b3a418279
[3.11] gh-110378: Close invalid generators in contextmanager and asynccontextmanager (GH-110499) (#110589)
contextmanager and asynccontextmanager context managers now close an invalid
underlying generator object that yields more then one value.
(cherry picked from commit 96fed66a65)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2023-10-10 11:12:52 +02:00
Bo Anderson 9e9df93ffc
[3.11] gh-109191: Fix build with newer editline (gh-110239) (#110575)
(cherry picked from commit f4cb0d27cc)
2023-10-09 19:42:25 +00:00
Miss Islington (bot) e913c6f4d6
[3.11] gh-110519: Improve deprecation warning in the gettext module (GH-110520) (GH-110564)
Deprecation warning about non-integer numbers in gettext now always refers
to the line in the user code where gettext function or method is used.
Previously, it could refer to a line in gettext code.

Also, increase test coverage for NullTranslations and domain-aware functions
like dngettext().
(cherry picked from commit 326c6c4e07)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-10-09 16:10:34 +02:00
Miss Islington (bot) 26c3e700b1
[3.11] gh-110437: Allow overriding VCRuntimeDLL with a semicolon separated list of DLLs to bundle (GH-110470)
gh-110437: Allow overriding VCRuntimeDLL with a semicolon separated list of DLLs to bundle (GH-110470)
(cherry picked from commit 12cc6792d0)

Co-authored-by: Steve Dower <steve.dower@python.org>
2023-10-09 11:42:57 +00:00
Miss Islington (bot) b473d48505
[3.11] gh-109286: Update macOS installer to use SQLite 3.43.1 (GH-110482) (#110551)
(cherry picked from commit 48419a50b4)

Co-authored-by: jtranquilli <76231120+jtranquilli@users.noreply.github.com>
2023-10-09 12:31:27 +02:00
Miss Islington (bot) f21c09ca03
[3.11] gh-110237: Check `PyList_Append` for errors in `_PyEval_MatchClass` (GH-110238) (#110512)
gh-110237: Check `PyList_Append` for errors in `_PyEval_MatchClass` (GH-110238)
(cherry picked from commit dd9d781da3)

Co-authored-by: denballakh <47365157+denballakh@users.noreply.github.com>
2023-10-08 00:29:46 +00:00
Serhiy Storchaka 6a33529cf0
[3.11] gh-109521: Fix obscure cases handling in PyImport_GetImporter() (GH-109522) (GH-109781)
PyImport_GetImporter() now sets RuntimeError if it fails to get sys.path_hooks
or sys.path_importer_cache or they are not list and dict correspondingly.

Previously it could return NULL without setting error in obscure cases,
crash or raise SystemError if these attributes have wrong type.
(cherry picked from commit 62c7015e89)
2023-10-07 16:05:13 +03:00
Miss Islington (bot) 4499e6caff
[3.11] gh-103053: Fix test_tools.test_freeze on FreeBSD (GH-110451) (#110457)
gh-103053: Fix test_tools.test_freeze on FreeBSD (GH-110451)

Fix test_tools.test_freeze on FreeBSD: run "make distclean" instead
of "make clean" in the copied source directory to remove also the
"python" program.

Other test_freeze changes:

* Log executed commands and directories, and the current directory.
* No longer uses make -C option to change the directory, instead use
  subprocess cwd parameter.
(cherry picked from commit a4baa9e8ac)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-10-06 01:32:21 +00:00
Miss Islington (bot) f7a1d7d060
[3.11] gh-103053: Fix make check-clean-src: check "python" program (GH-110449) (#110454)
gh-103053: Fix make check-clean-src: check "python" program (GH-110449)

"make check-clean-src" now also checks if the "python" program is
found in the source directory: fail with an error if it does exist.
(cherry picked from commit a155f9f342)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-10-06 01:10:39 +00:00
Miss Islington (bot) 8da3367067
[3.11] gh-110167: Fix test_socket deadlock in doCleanups() (GH-110416) (#110424)
gh-110167: Fix test_socket deadlock in doCleanups() (GH-110416)

Fix a deadlock in test_socket when server fails with a timeout but
the client is still running in its thread. Don't hold a lock to call
cleanup functions in doCleanups(). One of the cleanup function waits
until the client completes, whereas the client could deadlock if it
called addCleanup() in such situation.

doCleanups() is called when the server completed, but the client can
still be running in its thread especially if the server failed with a
timeout. Don't put a lock on doCleanups() to prevent deadlock between
addCleanup() called in the client and doCleanups() waiting for
self.done.wait of ThreadableTest._setUp().
(cherry picked from commit 318f5df271)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-10-05 19:18:44 +00:00
Miss Islington (bot) 34c7793cd0
[3.11] gh-110365: Fix error overwrite in `termios.tcsetattr` (GH-110366) (#110390)
(cherry picked from commit 2bbbab212f)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-10-05 14:21:34 +02:00
Victor Stinner 8f22504d74
[3.11] gh-109974: Fix threading lock_tests race conditions (#110057) (#110355)
[3.12] gh-109974: Fix threading lock_tests race conditions (#110057) (#110346)

* gh-109974: Fix threading lock_tests race conditions (#110057)

Fix race conditions in test_threading lock tests. Wait until a
condition is met rather than using time.sleep() with a hardcoded
number of seconds.

* Replace sleeping loops with support.sleeping_retry() which raises
  an exception on timeout.
* Add wait_threads_blocked(nthread) which computes a sleep depending
  on the number of threads. Remove _wait() function.
* test_set_and_clear(): use a way longer Event.wait() timeout.
* BarrierTests.test_repr(): wait until the 2 threads are waiting for
  the barrier. Use a way longer timeout for Barrier.wait() timeout.
* test_thread_leak() no longer needs to count
  len(threading.enumerate()): Bunch uses
  threading_helper.wait_threads_exit() internally which does it in
  wait_for_finished().
* Add BaseLockTests.wait_phase() which implements a timeout.
  test_reacquire() and test_recursion_count() use wait_phase().

(cherry picked from commit 4e356ad183)

* gh-109974: Fix more threading lock_tests race conditions (#110089)

* Add context manager on Bunch class.
* Bunch now catchs exceptions on executed functions and re-raise them
  at __exit__() as an ExceptionGroup.
* Rewrite BarrierProxy.test_default_timeout(). Use a single thread.
  Only check that barrier.wait() blocks for at least default timeout
  seconds.
* test_with(): inline _with() function.

(cherry picked from commit 743e3572ee)
(cherry picked from commit 1d032ea3d6)
2023-10-04 12:07:57 +00:00
Miss Islington (bot) aa8d3db6f2
[3.11] [3.12] gh-109972: Enhance test_gdb (GH-110026) (GH-110351) (#110354)
[3.12] gh-109972: Enhance test_gdb (GH-110026) (GH-110351)

* gh-109972: Enhance test_gdb (GH-110026)

* Split test_pycfunction.py: add test_cfunction_full.py.
  Split the function into the following 6 functions. In verbose
  mode, these "pycfunction" tests now log each tested call.

  * test_pycfunction_noargs()
  * test_pycfunction_o()
  * test_pycfunction_varargs()
  * test_pycfunction_varargs_keywords()
  * test_pycfunction_fastcall()
  * test_pycfunction_fastcall_keywords()

* Move get_gdb_repr() to PrettyPrintTests.
* Replace DebuggerTests.get_sample_script() with SAMPLE_SCRIPT.
* Rename checkout_hook_path to CHECKOUT_HOOK_PATH.
* Rename gdb_version to GDB_VERSION_TEXT.
* Replace (gdb_major_version, gdb_minor_version) with GDB_VERSION.
* run_gdb() uses "backslashreplace" error handler instead of "replace".
* Add check_gdb() function to util.py.
* Enhance support.check_cflags_pgo(): check also for sysconfig
  PGO_PROF_USE_FLAG (if available) in compiler flags.
* Move some SkipTest checks to test_gdb/__init__.py.
* Elaborate why gdb cannot be tested on Windows: gdb doesn't support
  PDB debug symbol files.

(cherry picked from commit 757cbd4f29)

* gh-104736: Fix test_gdb tests on ppc64le with clang (GH-109360)

Fix test_gdb on Python built with LLVM clang 16 on Linux ppc64le (ex:
Fedora 38). Search patterns in gdb "bt" command output to detect
when gdb fails to retrieve the traceback. For example, skip a test if
"Backtrace stopped: frame did not save the PC" is found.

(cherry picked from commit 44d9a71ea2)

* gh-110166: Fix gdb CFunctionFullTests on ppc64le clang build (GH-110331)

CFunctionFullTests now also runs "bt" command before "py-bt-full",
similar to CFunctionTests which also runs "bt" command before
"py-bt". So test_gdb can skip the test if patterns like "?? ()" are
found in the gdb output.

(cherry picked from commit bbce8bd05d)

Co-authored-by: Victor Stinner <vstinner@python.org>
(cherry picked from commit 1de9406f91)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-10-04 12:03:28 +00:00
Victor Stinner 6c98c734c7
[3.11] gh-109972: Split test_gdb.py into test_gdb package (#109977) (… (#110343)
[3.12] gh-109972: Split test_gdb.py into test_gdb package (#109977) (#110339)

gh-109972: Split test_gdb.py into test_gdb package (#109977)

Split test_gdb.py file into a test_gdb package made of multiple
tests, so tests can now be run in parallel.

* Create Lib/test/test_gdb/ directory.
* Split test_gdb.py into multiple files in Lib/test/test_gdb/
  directory.
* Move Lib/test/gdb_sample.py to Lib/test/test_gdb/ directory.
  Update get_sample_script(): use __file__ to locate gdb_sample.py.
* Move gdb_has_frame_select() and HAS_PYUP_PYDOWN to test_misc.py.
* Explicitly skip test_gdb on Windows. Previously, test_gdb was
  skipped even if gdb was available because of
  gdb_has_frame_select().

(cherry picked from commit 8f324b7ecd)
(cherry picked from commit e7a61d34b7)
2023-10-04 10:53:28 +00:00
Miss Islington (bot) 5039db7f9b
[3.11] gh-110267: Add tests for pickling and copying PyStructSequence objects (GH-110272) (GH-110284)
(cherry picked from commit 2d4865d775)

Co-authored-by: Xuehai Pan <XuehaiPan@pku.edu.cn>
2023-10-04 12:01:19 +03:00
Miss Islington (bot) 0c6ae623e5
[3.11] Remove unused Misc/requirements-test.txt (GH-110240) (#110254)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-10-02 23:36:35 -06:00
Pablo Galindo 8b6ee5ba3b Python 3.11.6 2023-10-02 14:29:10 +01:00
Miss Islington (bot) a673248d6c
[3.11] GH-101100: Fix reference warnings for ``namedtuple`` (GH-110113) (#110136)
GH-101100: Fix reference warnings for ``namedtuple`` (GH-110113)
(cherry picked from commit cbdacc738a)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-09-30 06:42:37 +00:00
Zachary Ware d87217ff44
[3.11] gh-109991: Update Windows build to use OpenSSL 3.0.11 (GH-110059)
(cherry picked from commit cf4c297256)
2023-09-29 10:03:48 -05:00
Victor Stinner 8ac6890d5e
[3.11] gh-110031: Skip test_threading fork tests if ASAN (#110100) (#110104)
gh-110031: Skip test_threading fork tests if ASAN (#110100)

Skip test_threading tests using thread+fork if Python is built with
Address Sanitizer (ASAN).

(cherry picked from commit 86e76ab8af)
2023-09-29 15:19:37 +02:00
Victor Stinner 184ce1414b
[3.11] gh-110088, gh-109878: Fix test_asyncio timeouts (#110092) (#110099)
gh-110088, gh-109878: Fix test_asyncio timeouts (#110092)

Fix test_asyncio timeouts: don't measure the maximum duration, a test
should not measure a CI performance. Only measure the minimum
duration when a task has a timeout or delay. Add CLOCK_RES to
test_asyncio.utils.

(cherry picked from commit db0a258e79)
2023-09-29 14:16:15 +02:00
Adam Turner d81bcc2327
[3.11] gh-102304: Add links to the Stable ABI and Limited C API docs (#105345) (#105371) (#109901)
* Add "limited-c-api" and "stable-api" targets
* Rename the "stable-abi-list" target to "limited-api-list"
2023-09-29 11:17:44 +02:00
Serhiy Storchaka c534637106
[3.11] gh-109634: Use :samp: role (GH-109635) (GH-109778)
(cherry picked from commit 92af0cc580)

Co-authored-by: Jacob Coffee <jacob@z7x.org>
2023-09-29 09:39:31 +03:00
Miss Islington (bot) efe83ad276
[3.11] gh-110036: multiprocessing Popen.terminate() catches PermissionError (GH-110037) (#110065)
gh-110036: multiprocessing Popen.terminate() catches PermissionError (GH-110037)

On Windows, multiprocessing Popen.terminate() now catchs
PermissionError and get the process exit code. If the process is
still running, raise again the PermissionError. Otherwise, the
process terminated as expected: store its exit code.
(cherry picked from commit bd4518c60c)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-09-29 01:04:58 +00:00
Davide Rizzo d6e8001467
[3.11] gh-110038: KqueueSelector must count all read/write events (GH-110039) (#110044)
[3.11] gh-110038: KqueueSelector must count all read/write events (GH-110039).
(cherry picked from commit b14f0ab51c)
2023-09-28 20:58:24 +02:00
Miss Islington (bot) 973d549e72
[3.11] gh-110033: Fix signal test_interprocess_signal() (GH-110035) (#110041)
gh-110033: Fix signal test_interprocess_signal() (GH-110035)

Fix test_interprocess_signal() of test_signal. Make sure that the
subprocess.Popen object is deleted before the test raising an
exception in a signal handler. Otherwise, Popen.__del__() can get the
exception which is logged as "Exception ignored in: ...." and the
test fails.
(cherry picked from commit 7e0fbf5175)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-09-28 17:48:58 +00:00
Miss Islington (bot) ff3cadd2a1
[3.11] gh-109594: Fix concurrent.futures test_timeout() (GH-110018) (#110022)
gh-109594: Fix concurrent.futures test_timeout() (GH-110018)

Fix test_timeout() of test_concurrent_futures.test_wait. Remove the
future which may or may not complete depending if it takes longer
than the timeout ot not. Keep the second future which does not
complete before wait(). Make also the test faster: 0.5 second instead
of 6 seconds, so remove @support.requires_resource('walltime')
decorator.
(cherry picked from commit 9be283e5e1)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-09-28 13:49:56 +00:00
Miss Islington (bot) 82dea84dc4
[3.11] gh-109991: Update macOS installer to use OpenSSL 3.0.10. (GH-110010)
(cherry picked from commit 98c0c1de18)

Co-authored-by: Ned Deily <nad@python.org>
2023-09-28 06:34:24 +00:00
Ned Deily 1fd6a73bd8
[3.11] gh-109991: Update GitHub CI workflows to use OpenSSL 3.0.11 and multissltests to use 1.1.1w, 3.0.11, and 3.1.3. (#110006)
(cherry picked from commit c88037d137)
2023-09-28 01:31:17 -04:00
Miss Islington (bot) f764abb375
[3.11] gh-109593: Fix reentrancy issue in multiprocessing resource_tracker (GH-109629) (#109897)
gh-109593: Fix reentrancy issue in multiprocessing resource_tracker (GH-109629)

---------

(cherry picked from commit 0eb98837b6)

Co-authored-by: Antoine Pitrou <antoine@python.org>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2023-09-26 12:21:52 +00:00
Miss Islington (bot) 97f7e9d5d6
[3.11] gh-109631: Allow interruption of short repeated regex matches (GH-109867) (GH-109885)
Counting for signal checking now continues in new match from the point where
it ended in the previous match instead of starting from 0.
(cherry picked from commit 8ac2085b80)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-09-26 08:19:29 +00:00
Miss Islington (bot) 358282e965
[3.11] gh-109748: Fix venv test_zippath_from_non_installed_posix() (GH-109872) (#109874)
gh-109748: Fix venv test_zippath_from_non_installed_posix() (GH-109872)

Fix test_zippath_from_non_installed_posix() of test_venv: don't copy
__pycache__/ sub-directories, because they can be modified by other
Python tests running in parallel.
(cherry picked from commit 25bb266fc8)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-09-26 01:41:32 +02:00
elfstrom 97ea90194c
[3.11] gh-105829: Fix concurrent.futures.ProcessPoolExecutor deadlock (GH-108513) (#109783)
This fixes issue GH-105829, https://github.com/python/cpython/issues/105829

(cherry picked from commit 405b06375a)
2023-09-24 20:28:03 +01:00
Hugo van Kemenade cbe153edd6
[3.11] Docs: Update Donghee Na's name (GH-109743) (#109759)
* Update Donghee Na's name in Docs/

* Update Donghee Na's name in Misc/ACKS

* Update Donghee Na's name in Misc/NEWS.d/
2023-09-23 06:53:47 +03:00
Miss Islington (bot) 567c3e846e
[3.11] ACKS: Fix ordering; Correct Itamar Oren's surname; Add Adam Turner (GH-109737) (#109742)
ACKS: Fix ordering; Correct Itamar Oren's surname; Add Adam Turner  (GH-109737)
(cherry picked from commit 3e8fcb7df7)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-09-22 15:05:04 +00:00
Miss Islington (bot) 43ff8fcce2
[3.11] gh-109375: Fix bug where pdb registers an alias without an associated command (GH-109376) (#109430)
gh-109375: Fix bug where pdb registers an alias without an associated command (GH-109376)
(cherry picked from commit 68a6f21f47)

Co-authored-by: buermarc <44375277+buermarc@users.noreply.github.com>
2023-09-22 03:45:11 +02:00
Victor Stinner 66a973a09e
[3.11] gh-108388: Convert test_concurrent_futures to package (#108401) (#109704)
* gh-108388: Convert test_concurrent_futures to package (#108401)

Convert test_concurrent_futures to a package of sub-tests.

(cherry picked from commit aa6f787faa)

Notes on backport to 3.11:

* AsCompletedTests: Revert test_future_times_out() => test_zero_timeout()
* Restore TODO comment
* ThreadPoolExecutorTest.test_hang_global_shutdown_lock():
  add @support.requires_resource('cpu').
2023-09-22 01:37:25 +00:00
Miss Islington (bot) b3af888342
[3.11] gh-108388: Split test_multiprocessing_spawn (GH-108396) (#109688)
gh-108388: Split test_multiprocessing_spawn (GH-108396)

Split test_multiprocessing_fork, test_multiprocessing_forkserver and
test_multiprocessing_spawn into test packages. Each package is made
of 4 sub-tests: processes, threads, manager and misc. It allows
running more tests in parallel and so reduce the total test duration.
(cherry picked from commit aa9a359ca2)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-09-21 20:44:21 +00:00
Victor Stinner 0c79353e11
[3.11] gh-109613: _pystat_fromstructstat() checks for exceptions (#109618) (#109668)
gh-109613: _pystat_fromstructstat() checks for exceptions (#109618)

Fix os.stat() and os.DirEntry.stat(): check for exceptions.
Previously, on Python built in debug mode, these functions could
trigger a fatal Python error (and abort the process) when a function
succeeded with an exception set.

_pystat_fromstructstat() now exits immediately if an exception is
raised, rather only checking for exceptions at the end. It fix
following fatal error in fill_time():

    Fatal Python error: _Py_CheckSlotResult:
    Slot * of type int succeeded with an exception set

(cherry picked from commit d4cea794a7)
2023-09-21 18:00:38 +00:00
Miss Islington (bot) e918b19f42
[3.11] GH-109209: Bump the minimum Sphinx version to 4.2 (GH-109210) (#109637)
GH-109209: Bump the minimum Sphinx version to 4.2 (GH-109210)
(cherry picked from commit 712cb173f8)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-09-21 06:32:10 +00:00
Victor Stinner 8c7fadb9bf
[3.11] gh-103053: Skip test_freeze_simple_script() on PGO build (#109591) (#109616)
gh-103053: Skip test_freeze_simple_script() on PGO build (#109591)

Skip test_freeze_simple_script() of test_tools.test_freeze if Python
is built with "./configure --enable-optimizations", which means with
Profile Guided Optimization (PGO): it just makes the test too slow.
The freeze tool is tested by many other CIs with other (faster)
compiler flags.

test.pythoninfo now gets also get_build_info() of
test.libregrtests.utils.

(cherry picked from commit 81cd1bd713)
2023-09-20 15:45:23 +00:00
Shantanu 2184b76496
[3.11] gh-108843: fix ast.unparse for f-string with many quotes (#108980)
* [3.11] gh-108843: fix ast.unparse for f-string with many quotes

* 📜🤖 Added by blurb_it.

* simplify

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2023-09-18 15:11:56 +01:00
Miss Islington (bot) f7bfac4b3d
[3.11] gh-109396: Fix test_socket.test_hmac_sha1() in FIPS mode (GH-109423) (#109427)
gh-109396: Fix test_socket.test_hmac_sha1() in FIPS mode (GH-109423)

Use a longer key: FIPS mode requires at least of at least 112 bits.
The previous key was only 32 bits.
(cherry picked from commit e091b9f20f)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-09-15 00:52:40 +02:00
Miss Islington (bot) f1f85a42ea
[3.11] gh-109351: Fix crash when compiling AST with invalid NamedExpr (GH-109352) (#109380)
gh-109351: Fix crash when compiling AST with invalid NamedExpr (GH-109352)
(cherry picked from commit 79101edb03)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-09-13 16:32:08 +00:00
Miss Islington (bot) 66c0d0ac8c
[3.11] gh-104736: Fix test_gdb tests on ppc64le with clang (GH-109360) (#109362)
gh-104736: Fix test_gdb tests on ppc64le with clang (GH-109360)

Fix test_gdb on Python built with LLVM clang 16 on Linux ppc64le (ex:
Fedora 38). Search patterns in gdb "bt" command output to detect
when gdb fails to retrieve the traceback. For example, skip a test if
"Backtrace stopped: frame did not save the PC" is found.
(cherry picked from commit 44d9a71ea2)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-09-13 04:48:44 +00:00