Commit graph

121301 commits

Author SHA1 Message Date
Erlend E. Aasland
e2fcaf19d3
gh-115874: Don't use module state in teedataobject tp_dealloc (#116204)
Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2024-03-18 13:24:24 +01:00
AN Long
cd2ed91780
gh-115538: Emit warning when use bool as fd in _io.WindowsConsoleIO (GH-116925) 2024-03-18 11:48:50 +00:00
Erlend E. Aasland
43c9d6196a
CI: Pass environment variables directly to configure in JIT CI (#116156)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-03-18 10:49:45 +01:00
Erlend E. Aasland
762f489b31
gh-116664: Ensure thread-safe dict access in _warnings (#116768)
Replace _PyDict_GetItemWithError() with PyDict_GetItemRef().
2024-03-18 09:37:48 +00:00
Terry Jan Reedy
4e45c6c54a
gh-116881: Remove erroneous or redundant grammar NULL (GH-116885)
In Lexical Analysis f-strings section, NULL in the description
of 'literal character' means '\0'.  In the format_spec grammar
production, it is wrong with that meaning and redundant if
instead interpreted as <nothing>.  Remove it there.
2024-03-18 10:31:13 +01:00
Hugo van Kemenade
3a99f5c5f3
Bump GitHub Actions (#116944) 2024-03-18 10:44:15 +02:00
mpage
b3f0c1591a
gh-116915: Make _thread._ThreadHandle support GC (#116934)
Even though it has no internal references to Python objects it still
has a reference to its type by virtue of being a heap type. We need
to provide a traverse function that visits the type, but we do not
need to provide a clear function.
2024-03-18 09:40:16 +01:00
Victor Stinner
2982bdb936
gh-85283: Build _statistics extension with the limited C API (#116927)
Argument Clinic now inlines _PyArg_CheckPositional() for the limited
C API. The generated code should be as fast or even a little bit
faster.
2024-03-17 18:59:02 +01:00
Barney Gale
0634201f53
GH-116377: Stop raising ValueError from glob.translate(). (#116378)
Stop raising `ValueError` from `glob.translate()` when a `**` sub-string
appears in a non-recursive pattern segment. This matches `glob.glob()`
behaviour.
2024-03-17 17:09:35 +00:00
Victor Stinner
1cf0301086
gh-85283: Build termios extension with the limited C API (#116928) 2024-03-17 15:12:29 +00:00
Victor Stinner
8e3c953b3a
gh-73468: Add math.fma() function (#116667)
Added new math.fma() function, wrapping C99's ``fma()`` operation:
fused multiply-add function.

Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
2024-03-17 13:58:26 +00:00
Antoine Pitrou
b8d808ddd7
GH-112536: Add more TSan tests (#116911)
These may all exercise some non-trivial aspects of thread synchronization.
2024-03-17 09:47:14 +01:00
John Sloboda
649857a157
gh-85287: Change codecs to raise precise UnicodeEncodeError and UnicodeDecodeError (#113674)
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2024-03-17 04:58:42 +00:00
Carol Willing
c514a975ab
Update titles and subtitles on landing page template (#116914)
* Update titles and subtitles on landing page template

* address review from gvanrossum

* Edits from hugovk review

* Change word order back. Down the road we should split license and history
2024-03-17 00:01:56 +00:00
Victor Stinner
5e0a070dfe
gh-116809: Restore removed _PyErr_ChainExceptions1() function (#116900) 2024-03-16 21:37:11 +01:00
Hugo van Kemenade
259dbc448d
CI: Process stale issues four times per day (#116857) 2024-03-16 11:59:42 -06:00
Michael Droettboom
1a33513f99
gh-116879: Add new optimizer pystats to tables (GH-116880) 2024-03-16 23:10:43 +08:00
Donghee Na
bee7e290cd
gh-112536: Add more TSAN tests (#116896)
---------

Co-authored-by: Antoine Pitrou <antoine@python.org>
2024-03-16 14:52:44 +00:00
jnchen
744c077795
gh-116851: Remove "from ctypes import *" from a ctypes example (GH-116852)
It is confusing, because libc is not imported from ctypes,
but defined in previous examples, which already contain the import.
2024-03-16 15:01:45 +02:00
mpage
33da0e844c
gh-114271: Fix race in Thread.join() (#114839)
There is a race between when `Thread._tstate_lock` is released[^1] in `Thread._wait_for_tstate_lock()`
and when `Thread._stop()` asserts[^2] that it is unlocked. Consider the following execution
involving threads A, B, and C:

1. A starts.
2. B joins A, blocking on its `_tstate_lock`.
3. C joins A, blocking on its `_tstate_lock`.
4. A finishes and releases its `_tstate_lock`.
5. B acquires A's `_tstate_lock` in `_wait_for_tstate_lock()`, releases it, but is swapped
   out before calling `_stop()`.
6. C is scheduled, acquires A's `_tstate_lock` in `_wait_for_tstate_lock()` but is swapped
   out before releasing it.
7. B is scheduled, calls `_stop()`, which asserts that A's `_tstate_lock` is not held.
   However, C holds it, so the assertion fails.

The race can be reproduced[^3] by inserting sleeps at the appropriate points in
the threading code. To do so, run the `repro_join_race.py` from the linked repo.

There are two main parts to this PR:

1. `_tstate_lock` is replaced with an event that is attached to `PyThreadState`.
   The event is set by the runtime prior to the thread being cleared (in the same
   place that `_tstate_lock` was released). `Thread.join()` blocks waiting for the
   event to be set.
2. `_PyInterpreterState_WaitForThreads()` provides the ability to wait for all
   non-daemon threads to exit. To do so, an `is_daemon` predicate was added to
   `PyThreadState`. This field is set each time a thread is created. `threading._shutdown()`
   now calls into `_PyInterpreterState_WaitForThreads()` instead of waiting on
   `_tstate_lock`s.

[^1]: 441affc9e7/Lib/threading.py (L1201)
[^2]: 441affc9e7/Lib/threading.py (L1115)
[^3]: 8194653279

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Antoine Pitrou <antoine@python.org>
2024-03-16 13:56:30 +01:00
Antoine Pitrou
86bc40dd41
gh-112536: Add test_threading to TSAN tests (#116898) 2024-03-16 11:55:46 +00:00
Serhiy Storchaka
c61cb507c1
gh-116484: Fix collisions between Checkbutton and ttk.Checkbutton default names (GH-116495)
Change automatically generated tkinter.Checkbutton widget names to
avoid collisions with automatically generated tkinter.ttk.Checkbutton
widget names within the same parent widget.
2024-03-16 13:31:19 +02:00
Serhiy Storchaka
1069a462f6
gh-116764: Fix regressions in urllib.parse.parse_qsl() (GH-116801)
* Restore support of None and other false values.
* Raise TypeError for non-zero integers and non-empty sequences.

The regressions were introduced in gh-74668
(bdba8ef42b).
2024-03-16 12:36:05 +02:00
Serhiy Storchaka
269051d20e
gh-90535: Fix support of interval>1 in logging.TimedRotatingFileHandler (GH-116220)
Fix support of interval values > 1 in logging.TimedRotatingFileHandler
for when='MIDNIGHT' and when='Wx'.
2024-03-16 12:29:42 +02:00
Donghee Na
20578a1f68
gh-112536: Add TSAN builds on Github Actions (#116872) 2024-03-16 11:10:37 +01:00
Nikita Sobolev
a1c4923d65
gh-116858: Add @cpython_only to several tests in test_cmd_line (#116859) 2024-03-16 11:54:42 +03:00
Raymond Hettinger
0c7dc494f2
Minor kde() docstring nit: make presentation order match the function signature (#116876) 2024-03-15 14:02:10 -05:00
Mark Shannon
950667ed07
GH-115802: Reduce the size of _INIT_CALL_PY_EXACT_ARGS. (GH-116856) 2024-03-15 17:16:30 +00:00
Dino Viehland
280de3661b
gh-116868: Avoid locking in PyType_IsSubtype (#116829)
Make PyType_IsSubType not acquire lock
2024-03-15 12:35:29 -04:00
Donghee Na
ebf29b3a02
gh-112536: Add --tsan test for reasonable TSAN execution times. (gh-116601) 2024-03-16 01:07:16 +09:00
Nikita Sobolev
16349868d3
gh-116782: Mention __type_params__ in inspect.getmembers docs (#116783)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-03-15 18:47:46 +03:00
Donghee Na
8da83f3386
gh-116621: Specialize list.extend for dict keys/values (gh-116816) 2024-03-15 23:48:34 +09:00
Tian Gao
59e30f41ed
gh-116735: Use MISSING for CALL event if argument is absent (GH-116737) 2024-03-15 14:46:18 +00:00
Zackery Spytz
d180b507c4
gh-63283: IDNA prefix should be case insensitive (GH-17726)
Any capitalization of "xn--" should be acceptable for the ACE prefix
(see https://tools.ietf.org/html/rfc3490#section-5).

Co-authored-by: Pepijn de Vos <pepijndevos@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-03-15 15:38:13 +01:00
mpage
ce2c996b2f
gh-111926: Simplify proxy creation logic (#116844)
Since 3.12, allocating a GC-able object cannot trigger GC. This allows
us to simplify the logic for creating the canonical callback-less
proxy object.
2024-03-15 09:58:40 -04:00
mpage
001b21d1c5
gh-111926: Simplify weakref creation logic (#116843)
Since 3.12, allocating a GC object cannot immediately trigger GC. This
allows us to simplify the logic for creating the canonical callback-less
weakref.
2024-03-15 09:56:13 -04:00
Mark Shannon
2cf18a4430
GH-116422: Modify a few uops so that they can be supported by tier 2 with hot/cold splitting (GH-116832) 2024-03-15 10:48:00 +00:00
Tian Gao
a50cf6c3d7
gh-90095: Ignore empty lines and comments in .pdbrc (#116834) 2024-03-15 09:36:04 +00:00
Victor Stinner
8fc8fbb43a
gh-85283: Build pwd extension with the limited C API (#116841)
Argument Clinic now uses the PEP 737 "%T" format to format type name
for the limited C API.
2024-03-15 08:49:58 +01:00
Raymond Hettinger
41e844a4ac
gh-116842: Improve test comment and fix a doctest (gh-116846) 2024-03-14 21:40:36 -05:00
Barney Gale
1904f0a224
GH-113838: Add "Comparison to os.path" section to pathlib docs (#115926) 2024-03-15 00:11:49 +00:00
vxiiduu
be1c808fca
gh-116195: Implements a fast path for nt.getppid (GH-116205)
Use the NtQueryInformationProcess system call to efficiently retrieve the parent process ID in a single step, rather than using the process snapshots API which retrieves large amounts of unnecessary information and is more prone to failure (since it makes heap allocations).

Includes a fallback to the original win32_getppid implementation in case the unstable API appears to return strange results.
2024-03-14 23:09:36 +00:00
Victor Stinner
7bbb9b57e6
gh-111696, PEP 737: Add %T and %N to PyUnicode_FromFormat() (#116839) 2024-03-14 22:23:00 +00:00
Jason R. Coombs
5f52d20a93
gh-116811: Ensure MetadataPathFinder.invalidate_caches is reachable when delegated through PathFinder. (#116812)
* Make MetadataPathFinder a proper classmethod.

* In PathFinder.invalidate_caches, also invoke MetadataPathFinder.invalidate_caches.

* Add blurb
2024-03-14 17:59:00 -04:00
Jason R. Coombs
be59aaf3ab
gh-106531: Refresh zipfile._path with zipp 3.18. (#116835)
* gh-106531: Refresh zipfile._path with zipp 3.18.

* Add blurb
2024-03-14 21:53:50 +00:00
Raymond Hettinger
ab9e322ae1
Minor improvements to the itertools documentation (gh-116833) 2024-03-14 16:39:50 -05:00
Victor Stinner
c432df6d56
gh-111696, PEP 737: Add PyType_GetModuleName() function (#116824)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-03-14 18:17:43 +00:00
Victor Stinner
25cd8730aa
gh-113317, AC: Add libclinic.converter module (#116821)
* Move CConverter class to a new libclinic.converter module.
* Move CRenderData and Include classes to a new libclinic.crenderdata
  module.
2024-03-14 18:59:43 +01:00
Jason R. Coombs
fd8e30eb62
gh-112795: Move the test for ZipFile into the core tests for zipfile. (#116823)
Move the test for ZipFile into the core tests for zipfile.
2024-03-14 17:50:24 +00:00
Mark Shannon
61e54bfcee
GH-116422: Factor out eval breaker checks at end of calls into its own micro-op. (GH-116817) 2024-03-14 16:31:47 +00:00