Commit Graph

124525 Commits

Author SHA1 Message Date
Gregory P. Smith
d46d3f2ec7
Cleanup multiprocessing comment and unusual import error message (#126532)
Define constants as constants rather than calling `list(range(2))`.
Explain which values must remain in sync via comments.
2024-11-07 00:06:14 -08:00
Serhiy Storchaka
dbb6e22cb1
gh-125926: Fix urllib.parse.urljoin() for base URI with undefined authority (GH-125989)
Although this goes beyond the application of RFC 3986, urljoin()
should support relative base URIs for backward compatibility.
2024-11-07 09:09:59 +02:00
Serhiy Storchaka
223d3dc554
gh-125631: Enable setting persistent_id and persistent_load of pickler and unpickler (GH-125752)
pickle.Pickler.persistent_id and pickle.Unpickler.persistent_load can
again be overridden as instance attributes.
2024-11-07 08:53:02 +02:00
Brett Cannon
2a6b6b33df
GH-126458: disable SIMD for HACL under WASI (#126512)
Requires an extra `-msimd128` flag and the `*mmintrin.h` header files are exclusive to x86-family CPUs.
2024-11-06 14:33:46 -08:00
Stephen Morton
5dc36dc565
gh-126451: Register contextvars.Context to collections.abc.Mapping (#126452)
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-11-07 01:12:45 +03:00
Valerii
b9082958ef
gh-126509: Update link to CPython's grammar docs in InternalDocs/parser.md (#126510) 2024-11-06 22:11:48 +00:00
Kirill Podoprigora
6e03ff2419
gh-126513: Use helpers for _Py_Specialize_ConstainsOp (#126517)
* Use helpers for _Py_Specialize_ConstainsOp

* Remove unnecessary variable
2024-11-06 13:52:15 -08:00
Serhiy Storchaka
8fa4dc4ba8
gh-126489: Do not call persistent_id() for a persistent id in Python pickle (GH-126490) 2024-11-06 22:25:14 +02:00
Donghee Na
e56fd449fb
gh-115999: Move specializer test from test_dis to test_opcache (gh-126498) 2024-11-07 05:23:47 +09:00
mpage
9ce4fa0719
gh-115999: Introduce helpers for (un)specializing instructions (#126414)
Introduce helpers for (un)specializing instructions

Consolidate the code to specialize/unspecialize instructions into
two helper functions and use them in `_Py_Specialize_BinaryOp`.
The resulting code is more concise and keeps all of the logic at
the point where we decide to specialize/unspecialize an instruction.
2024-11-06 12:04:04 -08:00
Victor Stinner
a1c57bcfd2
gh-126461: Fix _Unpickler_ReadFromFile() error handling (#126485)
Handle _Unpickler_SetStringInput() failure.
2024-11-06 14:24:46 +01:00
Kamil Turek
9cba47d9f1
gh-122838: Document missing opcodes (#123073) 2024-11-06 12:16:13 +00:00
Victor Stinner
b1c4ffc205
gh-126455: Disallow _ssl.SSLSocket instantiation (#126481)
Prevent creation of incomplete/invalid _ssl.SSLSocket objects when
created directly.
2024-11-06 11:59:39 +01:00
Victor Stinner
09d7083962
gh-126433: Change channel_info.count to int64_t (#126447)
Fix compiler warnings on 32-bit Windows: change channel_info.count
type from Py_ssize_t to int64_t in _interpchannelsmodule.c.
2024-11-06 15:50:17 +05:30
Cody Maloney
6431f379b8
gh-120754: Add to io optimization to what's new (#126466) 2024-11-06 07:54:40 +01:00
Donghee Na
4ea214ea98
gh-115999: Add free-threaded specialization for CONTAINS_OP (gh-126450)
- The specialization logic determines the appropriate specialization using only the operand's type, which is safe to read non-atomically (changing it requires stopping the world). We are guaranteed that the type will not change in between when it is checked and when we specialize the bytecode because the types involved are immutable (you cannot assign to `__class__` for exact instances of `dict`, `set`, or `frozenset`). The bytecode is mutated atomically using helpers.
- The specialized instructions rely on the operand type not changing in between the `DEOPT_IF` checks and the calls to the appropriate type-specific helpers (e.g. `_PySet_Contains`). This is a correctness requirement in the default builds and there are no changes to the opcodes in the free-threaded builds that would invalidate this.
2024-11-06 03:35:10 +00:00
Brandt Bucher
a204c63919
GH-126464: Temporarily disable aarch64-apple-darwin JIT CI jobs (gh-126465)
* Temporarily disable aarch64-apple-darwin JIT CI jobs

* Also up here
2024-11-06 12:09:04 +09:00
blhsing
83ba8c2bba
gh-70764: inspect.getclosurevars now identifies global variables with LOAD_GLOBAL (#120143) 2024-11-05 15:53:54 -08:00
Damien
fc233f46d3
gh-122544: Change OS image in GitHub Actions to Ubuntu 24.04 (#122566) 2024-11-05 23:29:21 +00:00
Savannah Ostrowski
c3a12ae13e
GH-125911: Rename big trampoline to "shim" (GH-126339) 2024-11-05 15:26:46 -08:00
Damien
478a1c09c4
gh-122544: Change OS image in Azure pipeline to Ubuntu 24.04 (#125344) 2024-11-06 00:10:12 +01:00
Barney Gale
5e9168492f
pathlib ABCs: defer path joining (#126409)
Defer joining of path segments in the private `PurePathBase` ABC. The new
behaviour matches how the public `PurePath` class handles path segments.

This removes a hard-to-grok difference between the ABCs and the main
classes. It also slightly reduces the size of `PurePath` objects by
eliminating a `_raw_path` slot.
2024-11-05 21:19:36 +00:00
Steve Dower
f51fd84034
gh-126074: Removes unnecessary DLLs from embeddable package (GH-126143) 2024-11-05 20:43:52 +00:00
Barney Gale
ff8349979c
GH-124985: Document that pathlib.Path.copy() uses copy-on-write. (#125861) 2024-11-05 18:43:43 +00:00
Valery Fedorenko
8525c9375f
gh-126238: Fix possible null pointer dereference of freevars in _PyCompile_LookupArg (#126239)
* Replace Py_DECREF by Py_XDECREF

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-11-05 20:34:33 +03:00
Victor Stinner
0b67ce930a
gh-126433: Fix compiler warnings on 32-bit Windows (#126444) 2024-11-05 16:05:13 +01:00
T. Wouters
bbfd9c92fa
gh-115999: Fix gdb support for libpython.so after thread-local bytecode change (#126440)
Fix the gdb pretty printer in the face of --enable-shared by delaying the attempt to load the _PyInterpreterFrame definition until after .so files are loaded.
2024-11-05 15:49:27 +01:00
sobolevn
75872605aa
gh-126425: Refactor _lsprof_Profiler_enable (#126426)
- Explicit memory management for `None` objects (since we still try to treat immortal objects as regular objects)
- Respect possible errors of `sys.monitoring.register_callback` call
2024-11-05 15:23:24 +03:00
Stephen Morton
78842e4a98
gh-126417: Register multiprocessing proxy types to an appropriate collections.abc class (#126419) 2024-11-05 15:35:45 +05:30
Peter Bierma
1371295e67
gh-126366: Fix crash if __iter__ raises an exception during yield from (#126369) 2024-11-05 15:26:36 +05:30
Richard Hansen
407c0366d9
Doc: C API: Delete claim that PyObject_Init is GC-aware (#126418) 2024-11-05 15:18:46 +05:30
Lukas Geiger
3d4fda2165
gh-119793: Prefer map(..., strict=True) over starmap/zip in examples (#126407) 2024-11-05 08:53:32 +01:00
Victor Stinner
4a0d574273
gh-120057: Add os.reload_environ() function (#126268)
Replace the os.environ.refresh() method with a new
os.reload_environ() function.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-11-05 08:43:34 +01:00
Serhiy Storchaka
d3840503b0
gh-126303: Fix pickling and copying of os.sched_param objects (GH-126336) 2024-11-05 08:23:17 +02:00
lit
d960226547
gh-125436: Doc: Add missing `allow_unnamed_section parameter to ConfigParser` documentation (#125437)
Add missing ``allow_unnamed_section`` parameter to ``ConfigParser`` doc, as well as to it's parent ``RawConfigParser``.
Split too long line on ``ConfigParser`` signature.
Add some sections about when some of ``RawConfigParser`` parameters were added.
2024-11-05 02:58:15 +00:00
Kirill Podoprigora
78015818c2
gh-126415: Fix conversion warning in Python/bytecodes.c (#126416)
Fix conversion warning in bytecodes

Co-authored-by: mpage <mpage@cs.stanford.edu>
2024-11-05 04:12:31 +02:00
Erlend E. Aasland
532fc08102
gh-89640: Hardcode WASM float word ordering as little endian (#126387) 2024-11-04 21:48:09 +01:00
Barney Gale
9b7294c3a5
GH-126363: Speed up pattern parsing in pathlib.Path.glob() (#126364)
The implementation of `Path.glob()` does rather a hacky thing: it calls
`self.with_segments()` to convert the given pattern to a `Path` object, and
then peeks at the private `_raw_path` attribute to see if pathlib removed a
trailing slash from the pattern.

In this patch, we make `glob()` use a new `_parse_pattern()` classmethod
that splits the pattern into parts while preserving information about any
trailing slash. This skips the cost of creating a `Path` object, and avoids
some path anchor normalization, which makes `Path.glob()` slightly faster.
But mostly it's about making the code less naughty.

Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
2024-11-04 19:29:57 +00:00
mpage
2e95c5ba3b
gh-115999: Implement thread-local bytecode and enable specialization for BINARY_OP (#123926)
Each thread specializes a thread-local copy of the bytecode, created on the first RESUME, in free-threaded builds. All copies of the bytecode for a code object are stored in the co_tlbc array on the code object. Threads reserve a globally unique index identifying its copy of the bytecode in all co_tlbc arrays at thread creation and release the index at thread destruction. The first entry in every co_tlbc array always points to the "main" copy of the bytecode that is stored at the end of the code object. This ensures that no bytecode is copied for programs that do not use threads.

Thread-local bytecode can be disabled at runtime by providing either -X tlbc=0 or PYTHON_TLBC=0. Disabling thread-local bytecode also disables specialization.

Concurrent modifications to the bytecode made by the specializing interpreter and instrumentation use atomics, with specialization taking care not to overwrite an instruction that was instrumented concurrently.
2024-11-04 11:13:32 -08:00
Mikhail Efimov
e5a4b402ae
Doc: Fix typo in documentation for `MAKE_FUNCTION` opcode (#126396) 2024-11-04 19:28:05 +02:00
Hugo van Kemenade
eac41c5ddf
gh-101865: Docs: Keep co_lnotab deprecation for at least 3.14 (#126392) 2024-11-04 18:49:59 +02:00
sobolevn
c806cd5af6
gh-126220: Adapt _lsprof to Argument Clinic (#126233)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-11-04 19:18:21 +03:00
Nice Zombies
3032fcd90e
gh-119793: Add optional length-checking to map() (GH-120471)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2024-11-04 15:00:19 +01:00
sobolevn
bfc1d2504c
gh-109413: Add more type hints to libregrtest (#126352) 2024-11-04 13:15:57 +03:00
Kumar Aditya
fe5a6ab7be
gh-126353: remove implicit creation of loop from asyncio.get_event_loop (#126354)
Remove implicit creation of loop from `asyncio.get_event_loop`. This is a step forward of deprecating the policy system of asyncio.
2024-11-04 14:21:20 +05:30
Erlend E. Aasland
0d80777981
Docs: turn getopt examples into doctests (#126377) 2024-11-04 09:27:25 +01:00
Zhikang Yan
081706f873
gh-126165: Improve docs of function math.isclose (#126215)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-11-03 23:08:15 -05:00
Hugo van Kemenade
9441993f27
Docs: Delist sqlite3 deprecation from "Pending removal in 3.14" (#126370) 2024-11-03 21:22:49 +00:00
Tomas R.
ac556a2ad1
gh-126357: Remove gettext import guards (GH-126358) 2024-11-03 18:54:42 +02:00
Bénédikt Tran
19d9358437
gh-126313: Fix a crash in curses.napms() due to incorrect error handling (GH-126351) 2024-11-03 15:08:34 +00:00