Commit graph

120742 commits

Author SHA1 Message Date
Laurie O b2d9d134dc
gh-96471: Add shutdown() method to queue.Queue (#104750)
Co-authored-by: Duprat <yduprat@gmail.com>
2024-02-09 20:58:30 -08:00
Donghee Na d4d5bae147
gh-111968: Refactor _PyXXX_Fini to integrate with _PyObject_ClearFreeLists (gh-114899) 2024-02-10 00:57:04 +00:00
dave-shawley 564385612c
gh-115165: Fix typing.Annotated for immutable types (#115213)
The return value from an annotated callable can raise any exception from
__setattr__ for the `__orig_class__` property.
2024-02-09 22:11:37 +00:00
Sam Gross a3af3cb4f4
gh-110481: Implement inter-thread queue for biased reference counting (#114824)
Biased reference counting maintains two refcount fields in each object:
`ob_ref_local` and `ob_ref_shared`. The true refcount is the sum of these two
fields. In some cases, when refcounting operations are split across threads,
the ob_ref_shared field can be negative (although the total refcount must be
at least zero). In this case, the thread that decremented the refcount
requests that the owning thread give up ownership and merge the refcount
fields.
2024-02-09 17:08:32 -05:00
Carl Meyer a225520af9
gh-112903: Handle non-types in _BaseGenericAlias.__mro_entries__() (#115191)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-02-09 12:19:09 -07:00
Peter Lazorchak 5a173efa69
Add Peter L to ACKS (GH-115222) 2024-02-10 01:06:14 +08:00
Kirill Podoprigora f8931adc59
gh-115142: Skip test_optimizer if _testinternalcapi module is not available (GH-115175) 2024-02-09 18:59:41 +02:00
Sam Gross 31633f4473
gh-115184: Fix refleak tracking issues in free-threaded build (#115188)
Fixes a few issues related to refleak tracking in the free-threaded build:

- Count blocks in abandoned segments
- Call `_mi_page_free_collect` earlier during heap traversal in order to get an accurate count of blocks in use.
- Add missing refcount tracking in `_Py_DecRefSharedDebug` and `_Py_ExplicitMergeRefcount`.
- Pause threads in  `get_num_global_allocated_blocks` to ensure that traversing the mimalloc heaps is safe.
2024-02-09 09:23:12 -05:00
Erlend E. Aasland 769d444826
Docs: correctly link to code objects (#115214) 2024-02-09 15:11:36 +01:00
Serhiy Storchaka 846fd721d5
gh-115059: Flush the underlying write buffer in io.BufferedRandom.read1() (GH-115163) 2024-02-09 12:36:12 +02:00
Brett Cannon c968dc7ff3
GH-113632: update configure.ac for WebAssembly support tiers (#115192)
Move WASI to tier 2 and drop Emscripten.
2024-02-09 09:21:49 +01:00
Nikita Sobolev 553c90ccc2
gh-101100: Fix sphinx warnings in library/enum.rst (#114696)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2024-02-08 23:40:28 -07:00
adang1345 5914a211ef
gh-115167: Exclude vcruntime140_threads.dll from Windows build output (GH-115176) 2024-02-08 21:42:45 +00:00
Tomas R ed1a8daf10
gh-112069: Adapt set/frozenset methods to Argument Clinic (#115112) 2024-02-08 17:47:27 +01:00
Shantanu 17689e3c41
gh-107944: Improve error message for getargs with bad keyword arguments (#114792) 2024-02-08 01:04:41 -08:00
Artem Chernyshev 9e90313320
gh-115136: Fix possible NULL deref in getpath_joinpath() (GH-115137)
Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>
2024-02-08 08:40:38 +00:00
Justin Applegate 4a7f63869a
gh-115146: Fix typo in pickletools.py documentation (GH-115148) 2024-02-08 10:12:58 +02:00
Alex Gaynor 38b970dfcc
When the Py_CompileStringExFlags fuzzer encounters a SystemError, abort (#115147)
This allows us to catch bugs beyond memory corruption and assertions.
2024-02-07 17:21:33 -05:00
Carl Meyer 8f0998e844
gh-114828: parenthesize non-atomic macro definitions in pycore_symtable.h (#115143) 2024-02-07 13:19:47 -07:00
Sam Gross ef3ceab09d
gh-112066: Use PyDict_SetDefaultRef in place of PyDict_SetDefault. (#112211)
This changes a number of internal usages of `PyDict_SetDefault` to use `PyDict_SetDefaultRef`.

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-02-07 13:43:18 -05:00
Carl Meyer fedbf77191
gh-114828: Fix __class__ in class-scope inlined comprehensions (#115139) 2024-02-07 16:56:16 +00:00
Mark Shannon 8a3c499ffe
GH-108362: Revert "GH-108362: Incremental GC implementation (GH-108038)" (#115132)
Revert "GH-108362: Incremental GC implementation (GH-108038)"

This reverts commit 36518e69d7.
2024-02-07 12:38:34 +00:00
Skip Montanaro d0322fdf2c
gh-101100: Fix Py_DEBUG dangling Sphinx references (#115003) 2024-02-07 10:48:42 +00:00
Skip Montanaro 2afc7182e6
gh-114505: Add missing header file dependencies (#114513)
Also move PYTHON_HEADERS up and make _testembed.o depend on it.
2024-02-07 08:50:24 +00:00
Edgar Ramírez Mondragón 60375a3809
gh-115114: Add missing slash to file URI prefix file:/ (#115115)
Add missing slash to file URI prefix `file:/`
2024-02-07 05:22:47 +00:00
Finite State Machine 3f71c416c0
gh-115106 docs: 'enum.Flag.__iter__()' did not exist prior to Python 3.11 (GH-115107)
change versionchanged to versionadded
2024-02-06 17:28:01 -08:00
Erlend E. Aasland 11ac6f5354
gh-115009: Update Windows installer to use SQLite 3.45.1 (#115065) 2024-02-06 23:44:14 +01:00
Dino Viehland 92abb01240
gh-112075: Add critical sections for most dict APIs (#114508)
Starts adding thread safety to dict objects.


Use @critical_section for APIs which are exposed via argument clinic and don't directly correlate with a public C API which needs to acquire the lock
Use a _lock_held suffix for keeping changes to complicated functions simple and just wrapping them with a critical section
Acquire and release the lock in an existing function where it won't be overly disruptive to the existing logic
2024-02-06 14:03:43 -08:00
Sam Gross b6228b521b
gh-115035: Mark ThreadHandles as non-joinable earlier after forking (#115042)
This marks dead ThreadHandles as non-joinable earlier in
`PyOS_AfterFork_Child()` before we execute any Python code. The handles
are stored in a global linked list in `_PyRuntimeState` because `fork()`
affects the entire process.
2024-02-06 14:45:04 -05:00
Artem Mukhin 71239d50b5
gh-103224: Resolve paths properly in test_sysconfig (GH-103292)
To pass tests when executed through a Python symlink.

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
2024-02-06 19:32:07 +00:00
Matthieu Caneill 76108b8b05
#gh-75705: Set unixfrom envelope in mailbox._mboxMMDF (GH-107117) 2024-02-06 20:44:12 +02:00
Sam Gross 7fdd4235d7
gh-112529: Stop the world around gc.get_referents (#114823)
We do not want to add locking in `tp_traverse` slot implementations.
Instead, stop the world when calling `gc.get_referents`. Note that the the
stop the world call is a no-op in the default build.

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2024-02-06 11:45:42 -05:00
Donghee Na f7a22a7055
gh-112087: Make list_{count, index, contains} to be thread-safe. (gh-114916) 2024-02-06 16:41:18 +00:00
Sam Gross de61d4bd4d
gh-112066: Add PyDict_SetDefaultRef function. (#112123)
The `PyDict_SetDefaultRef` function is similar to `PyDict_SetDefault`,
but returns a strong reference through the optional `**result` pointer
instead of a borrowed reference.

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-02-06 11:36:23 -05:00
da-woods 0e2ab73dc3
gh-114756: Update FAQ section on removing the GIL (#114957)
Update FAQ section on removing the GIL to reflect recent progress on PEP 703 and PEP 684.

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2024-02-06 10:55:44 -05:00
Nikita Sobolev d7334e2c20
gh-106233: Fix stacklevel in zoneinfo.InvalidTZPathWarning (GH-106234) 2024-02-06 15:08:56 +02:00
Mariusz Felisiak 1a10437a14
gh-91602: Add iterdump() support for filtering database objects (#114501)
Add optional 'filter' parameter to iterdump() that allows a "LIKE"
pattern for filtering database objects to dump.

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-02-06 12:34:56 +01:00
Seth Michael Larson 4bf41879d0
gh-112302: Change 'licenseConcluded' field to 'NOASSERTION' (#115038) 2024-02-06 12:25:58 +02:00
Erlend E. Aasland 13eb5215c9
gh-115009: Update macOS installer to use SQLite 3.45.1 (#115066)
Co-authored-by: Ned Deily <nad@python.org>
2024-02-06 11:04:35 +01:00
Barney Gale 1b1f8398d0
GH-106747: Make pathlib ABC globbing more consistent with glob.glob() (#115056)
When expanding `**` wildcards, ensure we add a trailing slash to the
topmost directory path. This matches `glob.glob()` behaviour:

    >>> glob.glob('dirA/**', recursive=True)
    ['dirA/', 'dirA/dirB', 'dirA/dirB/dirC']

This does not affect `pathlib.Path.glob()`, because trailing slashes aren't
supported in pathlib proper.
2024-02-06 02:48:18 +00:00
Ned Deily 299e16ca0f
gh-109991: Update GitHub CI workflows to use OpenSSL 3.0.13. (#115050)
Also update multissltests to use 1.1.1w, 3.0.13, 3.1.5, and 3.2.1.
2024-02-05 21:10:11 -05:00
Ned Deily 638e811a3c
gh-109991: Update macOS installer to use OpenSSL 3.0.13. (GH-115052) 2024-02-05 20:59:25 -05:00
Zachary Ware 01dceba13e
gh-109991: Update Windows build to use OpenSSL 3.0.13 (#115043) 2024-02-05 23:10:55 +00:00
Serhiy Storchaka bb57ffdb38
gh-83648: Support deprecation of options, arguments and subcommands in argparse (GH-114086) 2024-02-06 00:41:34 +02:00
mpage c32bae5290
gh-114944: Fix race between _PyParkingLot_Park and _PyParkingLot_UnparkAll when handling interrupts (#114945)
Fix race between `_PyParkingLot_Park` and `_PyParkingLot_UnparkAll` when handling interrupts

There is a potential race when `_PyParkingLot_UnparkAll` is executing in
one thread and another thread is unblocked because of an interrupt in
`_PyParkingLot_Park`. Consider the following scenario:

1. Thread T0 is blocked[^1] in `_PyParkingLot_Park` on address `A`.
2. Thread T1 executes `_PyParkingLot_UnparkAll` on address `A`. It
   finds the `wait_entry` for `T0` and unlinks[^2] its list node.
3. Immediately after (2), T0 is woken up due to an interrupt. It
   then segfaults trying to unlink[^3] the node that was previously
   unlinked in (2).

To fix this we mark each waiter as unparking before releasing the bucket
lock. `_PyParkingLot_Park` will wait to handle the coming wakeup, and not
attempt to unlink the node, when this field is set. `_PyParkingLot_Unpark`
does this already, presumably to handle this case.
2024-02-05 13:48:37 -08:00
Serhiy Storchaka 652fbf88c4
gh-82626: Emit a warning when bool is used as a file descriptor (GH-111275) 2024-02-05 22:51:11 +02:00
Erlend E. Aasland 09096a1647
gh-115015: Argument Clinic: fix generated code for METH_METHOD methods without params (#115016) 2024-02-05 21:49:17 +01:00
Serhiy Storchaka 4aa4f0906d
gh-109475: Fix support of explicit option value "--" in argparse (GH-114814)
For example "--option=--".
2024-02-05 22:42:43 +02:00
HarryLHW 750489cc77
gh-114967: Fix "Built-in Exceptions" documentation ambiguous wording (#114968)
Change the somewhat vague "listed below" to "listed in this chapter" in Doc/library/exceptions.rst.
The exceptions are listed in multiple sections after two intermediate sections.
---------
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-02-05 15:22:57 -05:00
Dino Viehland bcccf1fb63
gh-112075: Add gc shared bits (#114931)
Add GC shared flags for objects to the GC bit states in free-threaded builds
2024-02-05 10:35:59 -08:00