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>
(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>
* 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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)
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>
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>
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>
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>
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>
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)
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>
* 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>
(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>
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>
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>
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>
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>
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>
* 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>
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.
[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-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>
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)
* 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
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>
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)
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>
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>
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>
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)
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>
(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>
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>
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>
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>
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>
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>
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)
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>
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>
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>
[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)
[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>
[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)
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)
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)
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>
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>
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>
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>
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>
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>
* 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').
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>
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)
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>
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)
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>
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>