122127 Commits

Author SHA1 Message Date
Victor Stinner
aa36f83c16
gh-118702: Implement vectorcall for BaseException (#118703)
* BaseException_vectorcall() now creates a tuple from 'args' array.
* Creation an exception using BaseException_vectorcall() is now a
  single function call, rather than having to call
  BaseException_new() and then BaseException_init().
  Calling BaseException_init() is inefficient since it overrides
  the 'args' attribute.
* _PyErr_SetKeyError() now uses PyObject_CallOneArg() to create the
  KeyError instance to use BaseException_vectorcall().
2024-05-10 21:08:24 +02:00
Jelle Zijlstra
ec9d12be96
Rename typing._collect_parameters (#118900)
Unfortunately, released versions of typing_extensions
monkeypatch this function without the extra parameter, which makes
it so things break badly if current main is used with typing_extensions.

Fortunately, the monkeypatching is not needed on Python 3.13, because CPython
now implements PEP 696. By renaming the function, we prevent the monkeypatch
from breaking typing.py internals.

We keep the old name (raising a DeprecationWarning) to help other external users who call it.
2024-05-10 16:55:49 +00:00
Mark Shannon
f5c6b9977a
GH-118910: Less boilerplate in the tier 2 optimizer (#118913) 2024-05-10 17:43:23 +01:00
Petr Viktorin
941eea0a27
gh-118771: Ensure names defined in optimizer.h start with Py/_Py (GH-118825) 2024-05-10 18:20:12 +02:00
Barney Gale
f772d0d08a
GH-78707: Drop deprecated pathlib.PurePath.[is_]relative_to() arguments (#118780)
Remove support for supplying additional positional arguments to
`PurePath.relative_to()` and `is_relative_to()`. This has been deprecated
since Python 3.12.
2024-05-10 15:53:46 +00:00
Jelle Zijlstra
13d7cf997b
gh-118895: Call PyType_Ready() on typing.NoDefault (#118897) 2024-05-10 08:42:00 -07:00
Adam Dangoor
c444362c6e
Correct the argument names for secrets.choice and secrets.randbelow in secrets.rst (GH-118098)
Correct the argument names for `secrets.choice` and `secrets.randbelow` in `secrets.rst`.
2024-05-10 14:30:42 +00:00
Alex Turner
33d20199af
gh-117657: Fix QSBR race condition (#118843)
`_Py_qsbr_unregister` is called when the PyThreadState is already
detached, so the access to `tstate->qsbr` isn't safe without locking the
shared mutex. Grab the `struct _qsbr_shared` from the interpreter
instead.
2024-05-10 10:26:35 -04:00
mpage
22d5185308
gh-117657: Fix data races reported by TSAN on interp->threads.main (#118865)
Use relaxed loads/stores when reading/writing to this field.
2024-05-10 09:59:14 -04:00
Sam Gross
db5af7da09
gh-118789: Restore hidden _PyWeakref_ClearRef (#118797)
_PyWeakref_ClearRef was previously exposed in the public C-API, although
it begins with an underscore and is not documented. It's used by a few
C-API extensions. There is currently no alternative public API that can
replace its use.

_PyWeakref_ClearWeakRefsExceptCallbacks is the only thread-safe way to
use _PyWeakref_ClearRef in the free-threaded build. This exposes the C
symbol, but does not make the API public.
2024-05-10 15:54:18 +02:00
Victor Stinner
a895756aec
gh-117398: Move types to datetime state (#118606)
Move types to the datetime_state structure of the _datetime
extension.
2024-05-10 15:24:06 +02:00
Nikita Sobolev
004db2170e
Rename notimplemented_methods into nodefault_methods (#118896) 2024-05-10 12:46:20 +00:00
Inada Naoki
7ac933e260
gh-118689: Doc: fix ePub build (#118690) 2024-05-10 19:24:02 +09:00
Victor Stinner
7cc5e81a82
gh-117873: Use positional-only parameters in _posixshmem (#118012)
* shm_unlink() parameter becomes positional-only.
* shm_open() first parameter (path) becomes positional-only,
  the two following parameters remain positional-or-keyword.
2024-05-10 12:04:16 +02:00
Dobatymo
e85e8deaf3
gh-118209: Add Windows structured exception handling to mmap module (GH-118213) 2024-05-10 10:47:30 +01:00
Steve Dower
7e6fcab200
Fix some missing null checks. (GH-118721) 2024-05-10 10:31:55 +01:00
Xie Yanbo
17a2cc199d
Docs: fix typos in documentation (GH-118815) 2024-05-10 09:11:50 +01:00
Sam Gross
46c808172f
Revert "gh-115432: Add critical section variant that handles a NULL object (#115433)" (#118861)
This reverts commit ad4f909e0e7890e027c4ae7fea74586667242ad3.

The API ended up not being used.
2024-05-09 18:33:53 -04:00
Jelle Zijlstra
68fbc00dc8
gh-118851: Default ctx arguments to AST constructors to Load() (#118854)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-05-09 15:30:14 -07:00
Brett Simmers
98ff3f65c0
gh-117657: Replace TSAN suppresions with more specific rules (#118722)
Using `race:` filters out warnings if the function appears anywhere in
the stack trace. This can hide a lot of unrelated warnings, especially
for a function like `_PyEval_EvalFrameDefault`, which is somewhere on
the stack more often than not.

Change all free-threaded suppressions to `race_top:`, which only matches
the top frame, and add any new suppressions this exposes.
2024-05-09 17:02:39 -04:00
Sam Gross
1b1db2fd9a
gh-118846: Fix PGO tests in free-threaded build (#118862)
Avoid immortalizing objects in tests that verify garbage collection of
classes or modules.

This fixes test_ordered_dict and test_struct.
2024-05-09 16:06:20 -04:00
Sam Gross
71cc0651e7
gh-116984: Make mimalloc header includes relative to the current file (#118808)
Some embedders and extensions include parts of the internal API. The
pycore_mimalloc.h file is transitively include by a number of other
internal headers. This avoids include errors for code that was
already including those headers.
2024-05-09 16:03:45 -04:00
Sam Gross
2402715e10
gh-118561: Fix crash involving list.extend in free-threaded build (#118723)
The `list_preallocate_exact` function did not zero initialize array
contents. In the free-threaded build, this could expose uninitialized
memory to concurrent readers between the call to
`list_preallocate_exact` and the filling of the array contents with
items.
2024-05-09 18:52:27 +00:00
Nikita Sobolev
82abe75e77
gh-118849: Fix "code will never be executed" warning in dictobject.c (#118850) 2024-05-09 20:15:14 +03:00
Steve Dower
8af84b503d
gh-118773: Use language-invariant SDDL string instead of aliases for ACLs. (GH-118800) 2024-05-09 17:43:21 +01:00
mpage
c30d8e5d6c
gh-117657: Acquire a critical section around SemLock.__{enter,exit}__ (#118812)
These methods are purely wrappers around `Semlock.{acquire,release}`,
which expect a critical section to be held.
2024-05-09 12:05:52 -04:00
Kirill Podoprigora
c3643a1214
gh-118817: Fix asyncio REPL on Windows (#118819) 2024-05-09 08:20:46 -07:00
Jelle Zijlstra
35b5eaa176
gh-118767: Improve tests and docs for bool(NotImplemented) (#118813) 2024-05-09 13:52:08 +00:00
Steve Dower
82acc5f211
gh-118802: Fix ACL use in test for non-English Windows (GH-118831) 2024-05-09 13:59:18 +01:00
Radislav Chugunov
7c87ce777b
gh-103956: Fix trace output in case of missing source line (GH-103958)
Print only filename with lineno if linecache.getline() returns an empty string.
2024-05-09 12:09:44 +00:00
Nikita Sobolev
da090f1658
gh-118805: Remove type, choices, metavar params of BooleanOptionalAction (#118806)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-05-09 11:46:45 +00:00
Hugo van Kemenade
c68acb1384
gh-118798: Remove deprecated isdst parameter from email.utils.localtime (#118799) 2024-05-09 03:17:02 -06:00
Nikita Sobolev
fa9b9cb113
gh-118033: Fix __weakref__ not set for generic dataclasses (#118099) 2024-05-09 11:36:17 +03:00
Raymond Hettinger
e8cbcf4955
GH-101588: Remove deprecated pickle/copy/deepcopy from itertools (gh-118816) 2024-05-09 03:31:47 -05:00
Kirill Podoprigora
027e6d88fb
[tests]: Mark `test_statistics.test_kde_random with a requires_resource('cpu')` decorator (#118801)
Mark test_kde_random with a requires_resource('cpu') decorator
2024-05-09 11:16:37 +03:00
Nikita Sobolev
2f4db5a04d
gh-118803: Remove ByteString from typing and collections.abc (#118804) 2024-05-09 00:37:55 +01:00
mpage
cb6f75a32c
gh-117657: Fix data races when writing / reading ob_gc_bits (#118292)
Use relaxed atomics when reading / writing to the field. There are still a
few places in the GC where we do not use atomics. Those should be safe as
the world is stopped.
2024-05-08 16:03:39 -04:00
Yutian Li
8d84120b41
Fixing a typo in test_cmd_line.py (#118728) 2024-05-08 19:58:48 +00:00
Serhiy Storchaka
05c2fe1acd
Format None, True, False and NotImplemented as literals (GH-118758) 2024-05-08 22:35:16 +03:00
Ned Batchelder
bcb435ee8f
docs: module page titles should not start with a link to themselves (#117099) 2024-05-08 20:34:40 +01:00
Xie Yanbo
7b0c247f1c
Docs: fix typos in documentation (#118752) 2024-05-08 12:20:40 -06:00
Jelle Zijlstra
c68311df85
Run CI on the 3.13 branch (#118779) 2024-05-08 18:12:36 +00:00
Jelle Zijlstra
3c079a0203
gh-118767: Make bool(NotImplemented) raise TypeError (#118775) 2024-05-08 11:12:00 -07:00
Jelle Zijlstra
aac6b019fe
gh-118772: Allow TypeVars without a default to follow those with a default when constructing aliases (#118774) 2024-05-08 09:54:51 -07:00
Jelle Zijlstra
6d419db10c
Fix file extensions for 3.14 Whats New (#118770) 2024-05-08 16:40:40 +00:00
Kirill Podoprigora
ed2b0fb044
Update Windows library names for the Python version bump (#118766) 2024-05-08 16:00:38 +00:00
Steve Dower
66f8bb76a1
gh-118486: Update docs for CVE-2024-4030 reference (GH-118737) 2024-05-08 15:52:39 +00:00
T. Wouters
891fd12e52
Regenerate configure for 3.14, which the release script forgot. (#118765) 2024-05-08 17:29:50 +02:00
Thomas Wouters
7768ff1e41 Python 3.14.0a0 2024-05-08 16:57:05 +02:00
Thomas Wouters
2268289a47 Python 3.13.0b1 v3.13.0b1 2024-05-08 11:21:00 +02:00