Commit graph

127083 commits

Author SHA1 Message Date
Tomas R.
aa845af9bb
gh-130057: Pygettext: Support translator comments (GH-130061) 2025-02-17 12:41:28 +02:00
Bénédikt Tran
6669905723
gh-111178: fix UBSan failures in Modules/_interp*module.c (GH-129779)
Fix UBSan failures for `XIBufferViewObject`

Remove redundant casts, suppress unused return values
2025-02-17 11:34:14 +01:00
Bénédikt Tran
7ea8927ec7
gh-111178: fix UBSan failures in Objects/exceptions.c (GH-128154)
Fix UBSan failures for `PyBaseExceptionObject`, `PyStopIterationObject`, `PySystemExitObject`, `PyImportErrorObject`, `PyOSErrorObject`,  `PyNameErrorObject`,  `PyAttributeErrorObject`, `PySyntaxErrorObject`,  `KeyError`,  `UnicodeError*`, `PyBaseExceptionGroupObject`

Remove redundant casts

Align the naming convention `Py[...]_CAST(op)` where only an assert-only type check is performed.
2025-02-17 11:03:16 +01:00
Serhiy Storchaka
395335d0ff
gh-127750: Fix and optimize functools.singledispatchmethod() (GH-130008)
Remove broken singledispatchmethod caching introduced in gh-85160.
Achieve the same performance using different optimization.

* Add more tests.

* Fix issues with __module__ and __doc__ descriptors.
2025-02-17 11:11:20 +02:00
Tomas R.
fb2d325725
gh-130193: Increase test coverage of gettext.c2py (GH-130208) 2025-02-17 10:57:34 +02:00
sobolevn
422f8e9e02
gh-129805: Fix bytes annotation in Tools/jit (#129806) 2025-02-17 10:55:30 +03:00
Serhiy Storchaka
cfe41037eb
gh-86069: Add more PyNumber_InPlacePower() tests (GH-130111)
Test it with the third argument.
2025-02-17 00:07:10 +00:00
Gregory P. Smith
ae30646089
gh-118761: Revert "Improve import time of subprocess (GH-129427)" (#130201)
* Revert "gh-118761: Improve import time of `subprocess` (GH-129427)"

This reverts commit 49f24650e4.
Also known as f502c8f6a6 in 3.13 (PR #129447)
Also known as f65aa0d1bf in 3.12 (PR #129448)

This caused bugs in the `__del__` finalizer:
 https://github.com/python/cpython/issues/118761#issuecomment-2661504264

---------

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-02-16 18:40:08 +00:00
Barney Gale
655fc8a0fc
pathlib ABCs: remove caching of path parser case sensitivity (#130194)
Remove the caching `_is_case_sensitive()` function. 

The cache used to speed up `PurePath.[full_]match()` and `Path.[r]glob()`,
but that's no longer the case - these methods use
`self.parser is posixpath` to determine case sensitivity.

This makes the `pathlib._abc` module a little easier to backport to Python
3.8, where `functools.cache()` is unavailable.
2025-02-16 17:08:55 +00:00
Sergey Miryanov
e7f00cd14f
gh-130179: Fix persistent_{id,load}_attr reference leaks in _pickle (#130180)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-02-16 17:00:03 +03:00
Irit Katriel
56495f81fc
gh-130080: return in finally in subprocess.py (#130081) 2025-02-16 13:52:04 +00:00
Tomas R.
73d03005b0
gh-130185: Fix unintentionally skipped tests in test_functools (#130186) 2025-02-16 16:34:54 +03:00
Irit Katriel
c9b1bf302c
gh-130139: always check ast node type in ast.parse() with ast input (#130140) 2025-02-16 13:32:39 +00:00
Tomas R.
2e8044a4f7
gh-130177: Fix unintentionally skipped tests in test_gettext (GH-130178) 2025-02-16 14:14:37 +02:00
Tomas R.
361083b84b
gh-127488: Add tests for Tools/i18n/msgfmt.py (GH-127540) 2025-02-16 14:05:01 +02:00
Stan Ulbrych
9837c2a214
gh-130169: Fix broken list markup in Doc/c-api/function.rst (#130174) 2025-02-16 13:55:31 +03:00
AN Long
798f8d3ea9
Replace non-breaking spaces with normal spaces (#130116)
Using normal spaces in place of non-breaking spaces.
2025-02-16 09:33:14 +08:00
Barney Gale
a7d41a8947
GH-128520: Subclass abc.ABC in pathlib._abc (#128745)
Convert `JoinablePath`, `ReadablePath` and `WritablePath` to real ABCs
derived from `abc.ABC`.

Make `JoinablePath.parser` abstract, rather than defaulting to `posixpath`.

Register `PurePath` and `Path` as virtual subclasses of the ABCs rather
than deriving. This avoids a hit to path object instantiation performance.

No change of behaviour in the public (non-abstract) classes.
2025-02-16 00:37:26 +00:00
Ken Jin
359c7dde3b
gh-129989: Properly disable tailcall interp in configure (GH-129991)
Co-authored-by: Zanie Blue <contact@zanie.dev>
2025-02-16 03:01:24 +08:00
Julian Waters
c26bed1160
gh-128345: properly disable gil for _freeze_module.vcxproj (#128344) 2025-02-15 14:05:54 +00:00
Ken Jin
a13460ac44
Add Neil's suggestions to whatsnew wording for tailcall (#130155)
Add Neil's suggestions

Co-authored-by: Neil Schemenauer <690853+nascheme@users.noreply.github.com>
2025-02-15 21:09:37 +08:00
Kumar Aditya
a545749b0e
gh-130145: fix loop.run_forever when loop is already running (#130146) 2025-02-15 15:01:53 +05:30
Tomasz Pytel
a05433f24a
gh-129107: make bytearray thread safe (#129108)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-02-15 07:19:42 +00:00
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి)
d2e60d8e59
gh-130106: Fix a typo in unittest.mock doc (#130107) 2025-02-15 03:30:12 +00:00
Sam Gross
39cd9728a6
gh-130095: Mark _py_abc tests as not thread-safe (gh-130131)
The `_py_abc` implementation is not currently thread-safe (even with the GIL).
Don't run these tests with `--parallel-threads=N` for now.
2025-02-14 16:21:45 -05:00
Dino Viehland
5a586c3e81
gh-130123: Make __new__ wrapper be deferred (#130124)
Make __new__ wrapper be deferred
2025-02-14 12:50:54 -08:00
Inada Naoki
e65e9f9062
Doc: update term "namespace package" (#129251) 2025-02-14 13:47:54 -05:00
Bénédikt Tran
1775091dc1
gh-129173: Use _PyUnicodeError_GetParams in PyCodec_SurrogatePassErrors (GH-129134) 2025-02-14 18:34:32 +01:00
RUANG (James Roy)
303043f506
gh-128703: Fix mimetypes.guess_type for empty Content-Type in registry (GH-128854) 2025-02-14 17:26:26 +00:00
Stan Ulbrych
3402e133ef
gh-82045: Correct and deduplicate "isprintable" docs; add test. (GH-130118)
We had the definition of what makes a character "printable" documented in three places, giving two different definitions.
The definition in the comment on `_PyUnicode_IsPrintable` was inverted; correct that.

With that correction, the two definitions turn out to be equivalent -- but to confirm that, you have to go look up, or happen to know, that those are the only five "Other" categories and only three "Separator" categories in the Unicode character database.  That makes it hard for the reader to tell whether they really are the same, or if there's some subtle difference in the intended semantics.

Fix that by cutting the C API docs' and the C comment's copies of the subtle details, in favor of referring to the Python-level docs. That ensures it's explicit that these are all meant to agree, and also lets us concentrate improvements to the wording in one place.

Speaking of which, borrow some ideas from the C comment, along with other tweaks, to hopefully add a bit more clarity to that one newly-centralized copy in the docs.

Also add a thorough test that the implementation agrees with this definition.

Author:    Greg Price <gnprice@gmail.com>

Co-authored-by: Greg Price <gnprice@gmail.com>
2025-02-14 18:16:47 +01:00
Stefano Rivera
6666b38c28
Correct typo in GH-129623 (#130079)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-02-14 16:27:17 +00:00
Peter Bierma
fda87c028b
CI: Mark the cross-build-linux job as skippable (#130113) 2025-02-14 14:46:04 +00:00
Yan Yanchii
334589f619
gh-126835: Set location for noped out instructions after constant folding in CFG. (#130109) 2025-02-14 14:15:08 +00:00
Tomas R.
0f20281fa2
gh-107510: gettext: Remove unnecessary tests (GH-127965)
There are now separate pygettext tests.
2025-02-14 12:16:10 +00:00
Tomas R.
9d1e668e6f
gh-129911: pygettext: Fix the keyword entry in help output (GH-129914) 2025-02-14 11:34:09 +02:00
Pablo Galindo Salgado
3bd3e09588
gh-125331: Allow the parser to activate future imports on the fly (#125482) 2025-02-14 04:54:56 +00:00
Brandt Bucher
05e89c34bd
GH-115869: Don't JIT zeroed bytes (GH-130023) 2025-02-13 10:51:03 -08:00
Bartosz Sławecki
07f5e33f2e
Fix a typo in _localemodule.c (GH-130085) 2025-02-13 17:29:26 +00:00
Sam Gross
451f291baa
gh-128130: Fix unhandled keyboard interrupt data race (gh-129975)
Use an atomic operation when setting
`_PyRuntime.signals.unhandled_keyboard_interrupt`. We now only clear the
variable at the start of `_PyRun_Main`, which is the same function where
we check it.

This avoids race conditions where previously another thread might call
`run_eval_code_obj()` and erroneously clear the unhandled keyboard
interrupt.
2025-02-13 12:29:03 -05:00
Ken Jin
aa28423201
Revert "gh-130048: Reintroduce full LTO as default on Clang (GH-130049)" (#130088)
This reverts commit 34c06ccc4c.
2025-02-13 17:27:19 +00:00
Dino Viehland
28f5e3de57
gh-129984: Mark immortal objects as deferred (#129985)
Mark immortal objects as deferred
2025-02-13 09:01:43 -08:00
Sam Gross
0559339ccd
gh-130019: Fix data race in _PyType_AllocNoTrack (gh-130058)
The reference count fields, such as `ob_tid` and `ob_ref_shared`, may be
accessed concurrently in the free threading build by a `_Py_TryXGetRef`
or similar operation. The PyObject header fields will be initialized by
`_PyObject_Init`, so only call `memset()` to zero-initialize the remainder
of the allocation.
2025-02-13 11:50:45 -05:00
Donghee Na
c357d69003
no-issue: Add free-threading build for TC dispatch (gh-130083)
no-issue: Add free-threading build for TCO dispatch
2025-02-14 00:25:40 +09:00
Ken Jin
34c06ccc4c
gh-130048: Reintroduce full LTO as default on Clang (GH-130049) 2025-02-13 22:06:00 +08:00
Filipe Laíns 🇵🇸
1eb3ade6e5
GH-107956: install build-details.json (PEP 739) (#130069) 2025-02-13 13:58:00 +00:00
Yan Yanchii
140e69c4a8
gh-126835: Move const folding of lists & sets from ast_opt.c to flowgraph.c (#130032) 2025-02-13 12:11:07 +00:00
Kumar Aditya
c7a9d06e06
gh-128002: optimistically remove tasks from linked list when finished (#129995) 2025-02-13 13:19:53 +05:30
Russell Keith-Magee
625470a7d2
gh-130025: Correct handling of symlinks during iOS testbed framework installation. (#130026)
Correct handling of symlinks during iOS testbed framework installation.
2025-02-13 14:03:43 +08:00
Filipe Laíns 🇵🇸
2a0256f588
GH-127432: add cross-build-linux as a required CI job (#129459) 2025-02-13 02:41:13 +00:00
Ammar Askar
f9a7d41bac
gh-96092: Fix traceback.walk_stack(None) skipping too many frames (#129330)
As it says in its documentation, walk_stack was meant to just
follow `f.f_back` like other functions in the traceback module.
Instead it was previously doing `f.f_back.f_back` and then this
changed to `f_back.f_back.f_back.f_back' in Python 3.11 breaking
its behavior for external users.

This happened because the walk_stack function never really had
any good direct tests and its only consumer in the traceback module was
`extract_stack` which passed the result into `StackSummary.extract`.
As a generator, it was previously capturing the state of the stack
when it was first iterated over, rather than the stack when `walk_stack`
was called. Meaning when called inside the two method deep
`extract` and `extract_stack` calls, two `f_back`s were needed.
When 3.11 modified the sequence of calls in `extract`, two more
`f_back`s were needed to make the tests happy.

This changes the generator to capture the stack when `walk_stack` is
called, rather than when it is first iterated over. Since this is
technically a breaking change in behavior, there is a versionchanged
to the documentation. In practice, this is unlikely to break anyone,
you would have been needing to store the result of `walk_stack` and
expecting it to change.
2025-02-13 01:43:09 +00:00