Commit Graph

119042 Commits

Author SHA1 Message Date
Adam Turner c32abf1f21
GH-109190: Copyedit 3.12 What's New: asyncio (#109661)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Itamar Oren <itamarost@gmail.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-09-22 15:32:32 +02:00
Adam Turner 168c3a8a89
GH-109190: Copyedit 3.12 What's New: PEP 669 (#109658)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-09-22 15:31:49 +02:00
Victor Stinner cbbdf2c144
gh-109709: Fix asyncio test_stdin_broken_pipe() (#109710)
Replace harcoded sleep of 500 ms with synchronization using a pipe.

Fix also Process._feed_stdin(): catch also BrokenPipeError on
stdin.write(input), not only on stdin.drain().
2023-09-22 15:29:42 +02:00
Łukasz Langa 46b63ced25
Remove outdated docstring from the `quantify` itertools recipe (#109726) 2023-09-22 15:09:32 +02:00
Adam Turner cade5960ae
GH-109190: Copyedit 3.12 What's New: Other Language Changes (#109660) 2023-09-22 15:05:39 +02:00
elfstrom 405b06375a
gh-105829: Fix concurrent.futures.ProcessPoolExecutor deadlock (#108513)
This fixes issue #105829, https://github.com/python/cpython/issues/105829

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Antoine Pitrou <antoine@python.org>
Co-authored-by: Chris Withers <chris@withers.org>
Co-authored-by: Thomas Moreau <thomas.moreau.2010@gmail.com>
2023-09-22 13:55:56 +01:00
Adam Turner e94a2232ea
GH-109190: Copyedit 3.12 What's New: PEP 684 (#109657) 2023-09-22 14:53:53 +02:00
Adam Turner d9415f6a45
GH-109190: Copyedit 3.12 What's New: bytecode (LOAD_METHOD) (#109665)
bytecode: suppress reference to removed LOAD_METHOD
2023-09-22 14:50:20 +02:00
EliseevEgor 8fc071345b
gh-106584: Fix exit code for unittest in Python 3.12 (#106588)
Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-09-22 14:26:27 +02:00
Adam Turner 34ddcc3fa1
GH-109190: Copyedit 3.12 What's New: calendar (#109662)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-09-22 06:29:48 +00:00
Adam Turner d3fe1a902f
GH-109190: Copyedit 3.12 What's New: tokenize (#109663) 2023-09-22 00:28:13 -06:00
Adam Turner 291401389b
GH-109190: Copyedit 3.12 What's New: Consistently show module names (#109664)
Consistently show module names
2023-09-22 08:37:44 +03:00
Victor Stinner 3cce6be06a
gh-109566: Fix typo in PCbuild/rt.bat (#109701) 2023-09-22 02:43:48 +00:00
Victor Stinner 1eb1b45183
gh-109702: Increase concurrent_futures deadlock timeout (#109703)
Replace SHORT_TIMEOUT with LONG_TIMEOUT in test_deadlock of
test_concurrent_futures.
2023-09-22 03:13:31 +02:00
AN Long 4230d7ce93
gh-108996: fix and enable test_msvcrt (#109226)
* Add _testconsole.flush_console_input_buffer() function.
* test_kbhit(), test_getwch() and test_getwche() now call
  flush_console_input_buffer().
* Don't override sys.stdin anymore (not needed).
2023-09-22 02:19:48 +02:00
Victor Stinner 3f5c5649cf
gh-104469: Disallow using Py_LIMITED_API with Py_BUILD_CORE (#109690)
Fix make check-c-globals: complete USE_LIMITED_C_API list of the
c-analyzer.
2023-09-22 01:21:07 +02:00
Victor Stinner 26e06ad617
gh-108948: Skip test_tarfile.test_modes() on EFTYPE error (#109697)
On FreeBSD, regular users cannot set the sticky bit. Skip the test if
chmod() fails with EFTYPE error.
2023-09-22 00:59:08 +02:00
Davide Rizzo 608c1f3083
gh-109582: test_fork_signal_handling should wait for event (#109605)
Sometimes the child_handled event was missing because either
the child quits before it gets a chance to handle the signal,
or the parent asserts before the event notification is
delivered via IPC.  Synchronize explicitly to avoid this.
2023-09-21 23:20:29 +02:00
Sam Gross 2aceb21ae6
gh-109693: Remove pycore_atomic_funcs.h (#109694)
_PyUnicode_FromId() now uses pyatomic.h functions instead.
2023-09-21 22:57:20 +02:00
Victor Stinner 5b8f024683
gh-108303: Update test_fractions for new Lib/test/mathdata/ (#109686) 2023-09-21 19:48:20 +00:00
Adam Turner e47d12e222
GH-109190: Copyedit 3.12 What's New: PEP 701 (#109655) 2023-09-21 13:37:28 -06:00
Adam Turner 16c24023c1
GH-109190: Copyedit 3.12 What's New: Improved Error Messages (#109654) 2023-09-21 13:24:44 -06:00
Nikita Sobolev ed587be0d0
gh-108303: Move all math files to `Lib/test/mathdata/` (#109512) 2023-09-21 21:14:41 +02:00
Adam Turner 11636788da
GH-109190: Copyedit 3.12 What's New: Typing PEPs (#109659) 2023-09-21 13:05:54 -06:00
Adam Turner 22b70ca480
GH-109190: Copyedit 3.12 What's New: PEP 709 (#109656) 2023-09-21 12:50:33 -06:00
AN Long 869f177b5c
gh-74481: Add missing debug function docs and constants to msvcrt (GH-109650) 2023-09-21 16:44:24 +01:00
Victor Stinner d4cea794a7
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
2023-09-21 09:55:06 +02:00
Nikita Sobolev 115c49ad5a
gh-109625: Move _ready_to_import() from test_import to support.import_helper (#109626) 2023-09-21 09:39:36 +02:00
Adam Turner 712cb173f8
GH-109209: Bump the minimum Sphinx version to 4.2 (#109210) 2023-09-21 09:06:36 +03:00
Irit Katriel 9ccf0545ef
gh-109627: duplicated smalll exit blocks need to be assigned jump target labels (#109630) 2023-09-20 23:08:06 +00:00
Hugo van Kemenade 14cdefa667
gh-109408: Move Windows builds from Azure Pipelines PR to GitHub Actions (#109569) 2023-09-20 12:56:42 -06:00
Heinz-Alexander Fuetterer ef6d475db3
Fix typos in docs and comments (#109619) 2023-09-20 16:58:23 +00:00
Carl Meyer 32ffe58c12
gh-109390: add dump_symtable utility under #if 0 (#109391)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-09-20 10:55:56 -06:00
Victor Stinner d41d2e69f6
gh-109054: Document configure variables (#109224) 2023-09-20 18:51:53 +02:00
Victor Stinner ced6924630
gh-108973: Fix asyncio test_subprocess_consistent_callbacks() (#109431)
SubprocessProtocol process_exited() method can be called before
pipe_data_received() and pipe_connection_lost() methods. Document it
and adapt the test for that.

Revert commit 282edd7b2a.
_child_watcher_callback() calls immediately _process_exited(): don't
add an additional delay with call_soon(). The reverted change didn't
make _process_exited() more determistic: it can still be called
before pipe_connection_lost() for example.

Co-authored-by: Davide Rizzo <sorcio@gmail.com>
2023-09-20 15:54:19 +02:00
Benjamin Peterson 850cc8d0b1
gh-109559: Update unicodedata checksums for 15.1.0. (#109597)
Update unicodedata checksums for 15.1.0.
2023-09-19 22:40:34 -07:00
James Gerity def828995a
fixes gh-109559: Update `unicodedata` for Unicode 15.1.0 (GH-109560)
---------

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2023-09-19 22:07:47 -07:00
Jelle Zijlstra 1293fcc3c6
gh-109543: Remove unnecessary hasattr check (#109544)
Also added a new test case covering the scenario I thought this
might be about.
2023-09-19 20:15:52 -07:00
Victor Stinner 81cd1bd713
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.
2023-09-20 01:58:34 +00:00
Victor Stinner 3e3a7da590
gh-90108: Disable LTO on _freeze_module and _testembed (#109581)
LTO optimization is nice to make Python faster, but _freeze_module
and _testembed performance is not important. Using LTO to build these
two programs make a whole Python build way slower, especially
combined with a sanitizer (like ASAN).
2023-09-20 03:40:32 +02:00
Mateusz Nowak 5a740cd06e
gh-109109: Expose retrieving certificate chains in SSL module (#109113)
Adds APIs to get the TLS certificate chains, verified or full unverified, from SSLSocket and SSLObject.

Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
2023-09-20 01:20:54 +00:00
Ronan Pigott ddf2e953c2
gh-109033: Return filename with os.utime errors (#109034)
The filename was previously intentionally omitted from exception because
"it might confuse the user". Uncaught exceptions are not generally a
replacement for user-facing error messages, so obscuring this
information only has the effect of making the programmer's life more
difficult.
2023-09-20 01:18:23 +02:00
Eric Snow fd7e08a6f3
gh-76785: Use Pending Calls When Releasing Cross-Interpreter Data (gh-109556)
This fixes some crashes in the _xxinterpchannels module, due to a race between interpreters.
2023-09-19 15:01:34 -06:00
Victor Stinner 754519a9f8
gh-109580: Skip test_perf_profiler on ASAN build (#109584)
Skip test_perf_profiler if Python is built with ASAN, MSAN or UBSAN
sanitizer. Python does crash randomly in this test on such build.
2023-09-19 19:42:51 +02:00
Sam Gross 9df6712c12
gh-108724: Fix _PySemaphore compile error on WASM (gh-109583)
Some WASM platforms have POSIX semaphores, but not sem_timedwait.
2023-09-19 17:35:11 +00:00
Sam Gross 0c89056fe5
gh-108724: Add PyMutex and _PyParkingLot APIs (gh-109344)
PyMutex is a one byte lock with fast, inlineable lock and unlock functions for the common uncontended case.  The design is based on WebKit's WTF::Lock.

PyMutex is built using the _PyParkingLot APIs, which provides a cross-platform futex-like API (based on WebKit's WTF::ParkingLot).  This internal API will be used for building other synchronization primitives used to implement PEP 703, such as one-time initialization and events.

This also includes tests and a mini benchmark in Tools/lockbench/lockbench.py to compare with the existing PyThread_type_lock.

Uncontended acquisition + release:
* Linux (x86-64): PyMutex: 11 ns, PyThread_type_lock: 44 ns
* macOS (arm64): PyMutex: 13 ns, PyThread_type_lock: 18 ns
* Windows (x86-64): PyMutex: 13 ns, PyThread_type_lock: 38 ns

PR Overview:

The primary purpose of this PR is to implement PyMutex, but there are a number of support pieces (described below).

* PyMutex:  A 1-byte lock that doesn't require memory allocation to initialize and is generally faster than the existing PyThread_type_lock.  The API is internal only for now.
* _PyParking_Lot:  A futex-like API based on the API of the same name in WebKit.  Used to implement PyMutex.
* _PyRawMutex:  A word sized lock used to implement _PyParking_Lot.
* PyEvent:  A one time event.  This was used a bunch in the "nogil" fork and is useful for testing the PyMutex implementation, so I've included it as part of the PR.
* pycore_llist.h:  Defines common operations on doubly-linked list.  Not strictly necessary (could do the list operations manually), but they come up frequently in the "nogil" fork. ( Similar to https://man.freebsd.org/cgi/man.cgi?queue)

---------

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2023-09-19 09:54:29 -06:00
Victor Stinner 0a31ff0050
gh-109496: Skip test_capi.test_decref_freed_object() on ASAN (#109573)
Skip test_decref_freed_object() of test_capi.test_misc if Python is
built with ASAN, MSAN or UBSAN sanitizers.
2023-09-19 14:42:08 +00:00
Victor Stinner 67d9363372
gh-109566: Run GHA and buildbot tests with --fail-rerun (#109567) 2023-09-19 15:50:27 +02:00
Raymond Hettinger f2636d2c45
Misc itertool recipe improvements, mostly docstrings and comments (gh-109555) 2023-09-19 07:39:44 -05:00
Nikita Sobolev 94c95d42a3
gh-109485: Further improve `test_future_stmt` tests (#109486)
Add assertSyntaxError() which run tests with an additional docstring
and without docstring, and checks for the error message.
2023-09-19 14:01:59 +02:00