Commit graph

121121 commits

Author SHA1 Message Date
Gregory P. Smith
ea1803e608
gh-88118: Fix some test_multiprocessing flakiness. (#116434)
Fix some test_multiprocessing flakiness.

Potentially introduced by https://github.com/python/cpython/pull/25845

not joining that thread likely leads to recently observed "environment
changed" logically passing but overall failing tests seen on some
buildbots similar to:

```
1 test altered the execution environment (env changed):
    test.test_multiprocessing_fork.test_processes

2 re-run tests:
    test.test_multiprocessing_fork.test_processes
    test.test_multiprocessing_forkserver.test_processes
```
2024-03-06 13:39:06 -08:00
mpage
c62144a02c
gh-114271: Make _thread.lock thread-safe in free-threaded builds (#116433)
Previously, the `locked` field was set after releasing the lock. This reverses
the order so that the `locked` field is set while the lock is still held.

There is still one thread-safety issue where `locked` is checked prior to
releasing the lock, however, in practice that will only be an issue when
unlocking the lock is contended, which should be rare.
2024-03-06 15:46:36 -05:00
Jason Zhang
ce0ae1d784
gh-115957: Close coroutine if TaskGroup.create_task() raises an error (#116009) 2024-03-06 12:20:26 -08:00
Ken Jin
7114cf20c0
gh-116381: Specialize CONTAINS_OP (GH-116385)
* Specialize CONTAINS_OP

* 📜🤖 Added by blurb_it.

* Add PyAPI_FUNC for JIT

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2024-03-07 03:30:11 +08:00
Sebastian Pipping
73807eb634
gh-115398: Suggest use of hasattr with checking for 3.13 Expat API availability (GH-116278)
Suggest use of "hasattr" with checking for 3.13 Expat API availability
2024-03-06 11:08:25 -08:00
Sebastian Pipping
8a8e9204d1
gh-115398: Revert PyExpat_CAPI_MAGIC version bump (GH-116411)
Revert "gh-115398: Increment PyExpat_CAPI_MAGIC for SetReparseDeferralEnabled addition (GH-116301)"

This reverts part of commit eda2963378.  Why? this comment buried in an earlier code review explains:

I checked again how that value is used in practice, it's here:

0c80da4c14/Modules/_elementtree.c (L4363-L4372)

Based on that code my understanding is that loading bigger structs from the future is considered okay unless `PyExpat_CAPI_MAGIC` differs, which implies that (1) magic needs to stay the same to support loading the future from the past and (2) that `PyExpat_CAPI_MAGIC` should only ever change for changes that do not increase size (but keep it constant).

To summarize, that supports your argument.
I checked branches 3.8, 3.9, 3.10, 3.11, 3.12 now and they all have the same comparison code there so reverting that magic string bump will support seamless backporting.
2024-03-06 09:55:07 -08:00
Sam Gross
c012c8ab7b
gh-115103: Delay reuse of mimalloc pages that store PyObjects (#115435)
This implements the delayed reuse of mimalloc pages that contain Python
objects in the free-threaded build.

Allocations of the same size class are grouped in data structures called
pages. These are different from operating system pages. For thread-safety, we
want to ensure that memory used to store PyObjects remains valid as long as
there may be concurrent lock-free readers; we want to delay using it for
other size classes, in other heaps, or returning it to the operating system.

When a mimalloc page becomes empty, instead of immediately freeing it, we tag
it with a QSBR goal and insert it into a per-thread state linked list of
pages to be freed. When mimalloc needs a fresh page, we process the queue and
free any still empty pages that are now deemed safe to be freed. Pages
waiting to be freed are still available for allocations of the same size
class and allocating from a page prevent it from being freed. There is
additional logic to handle abandoned pages when threads exit.
2024-03-06 09:42:11 -05:00
Itamar Oren
02ee475ee3
gh-116143: Fix race condition in pydoc _start_server (#116144) 2024-03-06 07:39:51 -07:00
Prince Roshan
e800265aa1
gh-107625: configparser: Raise error if a missing value is continued (GH-107651)
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2024-03-06 14:05:54 +00:00
Mark Shannon
27858e2a17
GH-113710: Tier 2 optimizer: check the function instead of checking globals. (GH-116410) 2024-03-06 13:12:23 +00:00
Mark Shannon
33c0aa3bb9
GH-115687: Most comparisons create Booleans, so propagate that information (GH-116360)
Most comparisons create booleans
2024-03-06 10:46:42 +00:00
Victor Stinner
2b379968e5
gh-107954: Add PyConfig_MEMBER_BOOL type to PyConfigSpec (#116359)
_PyConfig_AsDict() now returns bool objects for options using the new
PyConfig_MEMBER_BOOL type.

Update tests for these changes.
2024-03-06 09:29:27 +00:00
Nikita Sobolev
22ccf13b33
gh-116404: Handle errors correctly in wait_helper in posixmodule (#116405) 2024-03-06 08:46:47 +00:00
Donghee Na
d2f1b0eb49
gh-112087: Update list_get_item_ref to optimistically avoid locking (gh-116353)
Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-03-06 08:21:33 +09:00
Nikita Sobolev
990a5f17d0
gh-116112: Fix ResourceWarning in test_asyncio.test_stream (#116371)
Co-authored-by: @CendioOssman
2024-03-06 01:08:18 +03:00
Kerim Kabirov
e205c5cd8f
gh-115986: Fix inaccuracies in pprint docs (#116104)
Amend wording after gh-116019 was merged.
2024-03-05 22:14:52 +01:00
Sam Gross
72714c0266
gh-115103: Enable internal mimalloc assertions in debug builds (#116343)
This sets `MI_DEBUG` to `2` in debug builds to enable `mi_assert_internal()`
calls. Expensive internal assertions are not enabled.

This also disables an assertion in free-threaded builds that would be
triggered by the free-threaded GC because we traverse heaps that are not
owned by the current thread.
2024-03-05 13:54:20 -05:00
Eric Snow
dab85e0189
gh-76785: Use PRId64 to Fix a Compiler Warning on Windows (gh-116369)
I accidentally introduced the warning in gh-116328.
2024-03-05 18:51:04 +00:00
Nikita Sobolev
edc9d85c68
gh-109653: Just import recursive_repr in dataclasses (gh-109822) 2024-03-05 13:12:00 -05:00
Guido van Rossum
d444dec09a
Fix debug output for optimized executor (#116337)
This adjusts `length` rather than using `length+1`
all over the place.
2024-03-05 10:05:29 -08:00
cui fliter
e7ba6e9dbe
chore: fix typos (#116345)
Signed-off-by: cui fliter <imcusg@gmail.com>
2024-03-05 09:05:52 -07:00
Eric Snow
4402b3cbcf
gh-76785: Minor Improvements to "interpreters" Module (gh-116328)
This includes adding pickle support to various classes, and small changes to improve the maintainability of the low-level _xxinterpqueues module.
2024-03-05 08:54:46 -07:00
Serhiy Storchaka
bdba8ef42b
gh-74668: Fix support of bytes in urllib.parse.parse_qsl() (GH-115771)
urllib.parse functions parse_qs() and parse_qsl() now support bytes
arguments containing raw and percent-encoded non-ASCII data.
2024-03-05 17:49:50 +02:00
Serhiy Storchaka
f97f25ef5d
gh-76511: Fix email.Message.as_string() for non-ASCII message with ASCII charset (GH-116125) 2024-03-05 17:49:01 +02:00
Serhiy Storchaka
df59401108
Fix the PyGetSetDef documentation (GH-116056)
closure is not a function pointer, it is a user data pointer.
2024-03-05 17:48:20 +02:00
Serhiy Storchaka
0064dfa091
gh-115777: Fix double versionadded directives (GH-116269) 2024-03-05 17:41:53 +02:00
Mark Shannon
23db9c6227
GH-115685: Split _TO_BOOL_ALWAYS_TRUE into micro-ops (GH-116352) 2024-03-05 15:23:08 +00:00
Mark Shannon
0c81ce1360
GH-115819: Eliminate Boolean guards when value is known (GH-116355) 2024-03-05 15:06:00 +00:00
Nikita Sobolev
c91bdf86ef
gh-116326: Handler errors correctly in getwindowsversion in sysmodule (#116339) 2024-03-05 12:31:04 +00:00
Mark Shannon
cbf3d38cbe
GH-115685: Optimize TO_BOOL and variants based on truthiness of input. (GH-116311) 2024-03-05 11:23:46 +00:00
Nikita Sobolev
a29998a06b
gh-116325: Raise SyntaxError rather than IndexError on ForwardRef with empty string arg (#116341) 2024-03-05 09:14:18 +00:00
Dino Viehland
ffcc450a9b
gh-112075: Enable freeing with qsbr and fallback to lock on key changed (GH-116336) 2024-03-05 09:08:18 +00:00
Brett Cannon
7af063d1d8
GH-116313: get WASI builds to run under wasmtime 18 w/ WASI 0.2/preview2 primitives (#116327)
* GH-116313: get WASI builds to run under wasmtime 18 w/ WASI 0.2/preview2 primitives

* Add the configure changes

* Update `wasm_build.py`
2024-03-05 09:18:53 +01:00
Donghee Na
6cddc731fb
gh-112087: Make list_{slice, ass_slice, subscript} to be threadsafe (gh-116233) 2024-03-05 04:58:14 +00:00
Sam Gross
58c7919d05
gh-116029: Fix unused function warning on macOS (#116340) 2024-03-04 22:06:21 -05:00
Terry Jan Reedy
88b5c665ee
gh-116265: Remove obsolete sentence. (#116284)
Remove sentence in Tools/c-analyzer/README referring to deleted
ignore-globals.txt.
2024-03-04 16:49:42 -05:00
Eric Snow
eb22e2b251
gh-115490: Make the interpreter.channels and interpreter.queues Modules Handle Reloading Properly (gh-115493)
The problem manifested when the .py module got reloaded and the corresponding extension module didn't. The .py module registers types with the extension and the extension was not allowing that to happen more than once. The solution: let it happen more than once.
2024-03-04 20:59:30 +00:00
Nikita Sobolev
207030f552
gh-115320: Refactor get_hash_info in sysmodule.c not to swallow errors (#115321) 2024-03-04 23:03:59 +03:00
Eric Snow
01440d3a39
gh-76785: Simplify Channels XID Types (gh-116318)
I had added an extra cleanup abstraction a while back that has turned out to be unnecessary.
2024-03-04 19:32:39 +00:00
Brandt Bucher
ffed8d985b
GH-116134: JIT aarch64-pc-windows-msvc (GH-116130) 2024-03-04 10:16:56 -08:00
Brandt Bucher
981f27dcc4
GH-115802: Don't JIT zero-length jumps (GH-116177) 2024-03-04 10:13:10 -08:00
Kirill Podoprigora
8a84eb75a9
gh-116316: Fix typo in UNARY_FUNC(PyNumber_Positive) macros (GH-116317) 2024-03-04 17:57:01 +00:00
Tobias Rautenkranz
60743a9a7e
gh-57141: Add dircmp shallow option (GH-109499)
Co-authored-by: Steve Ward <planet36@gmail.com>
Co-authored-by: Sanyam Khurana <8039608+CuriousLearner@users.noreply.github.com>
2024-03-04 17:27:43 +00:00
Sergey B Kirpichev
ea1b1c579f
gh-108562: Revert enabling -fstrict-overflow for libmpdec (GH-116302)
gh-108562: partial reversion of pr114751

Reverts -fstrict-overflow for libmpdec
2024-03-04 18:07:24 +01:00
Yuriy Chernyshov
9b9e819b51
gh-116116: Backport blake2 change to fix building with clang-cl on windows-i686 (GH-116117) 2024-03-04 16:59:57 +00:00
Brett Simmers
0adfa8482d
gh-115832: Fix instrumentation version mismatch during interpreter shutdown (#115856)
A previous commit introduced a bug to `interpreter_clear()`: it set
`interp->ceval.instrumentation_version` to 0, without making the corresponding
change to `tstate->eval_breaker` (which holds a thread-local copy of the
version). After this happens, Python code can still run due to object finalizers
during a GC, and the version check in bytecodes.c will see a different result
than the one in instrumentation.c causing an infinite loop.

The fix itself is straightforward: clear `tstate->eval_breaker` when clearing
`interp->ceval.instrumentation_version`.
2024-03-04 11:29:39 -05:00
Raymond Hettinger
15dc2979bc
Consistently spell out *predicate* instead of *pred*. (gh-116308) 2024-03-04 15:51:29 +00:00
pan324
0dfa7ce346
gh-115256: Remove refcycles from tarfile writing (GH-115257) 2024-03-04 13:26:32 +00:00
Erlend E. Aasland
cfbdce7208
gh-114258: Argument Clinic: refactor getset implementation (#116170)
* Move param guard to param state machine
* Override return converter during parsing
* Don't use a custom type slot return converter; instead
  special case type slot functions during generation.
2024-03-04 13:51:28 +01:00
Kerim Kabirov
45a92436c5
GH-116271 Docs: provide clarification for object assignments in the Tutorial section (#116283)
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-03-04 12:22:13 +00:00