Commit Graph

124345 Commits

Author SHA1 Message Date
Serhiy Storchaka 061e50f196
gh-122943: Add the varpos parameter in _PyArg_UnpackKeywords (GH-126564)
Remove _PyArg_UnpackKeywordsWithVararg.
Add comments for integer arguments of _PyArg_UnpackKeywords.
2024-11-08 14:23:50 +02:00
Serhiy Storchaka ee0746af7d
gh-122943: Move code generation for var-positional parameter to converters (GH-126575) 2024-11-08 14:12:15 +02:00
Hood Chatham 403410fa1b
gh-89640: Restore configure error message on failure to detect float word order (#126569)
Before #126387, if we didn't detect float word order we'd raise the following
configure error:

    Unknown float word ordering. You need to manually preset
    ax_cv_c_float_words_bigendian=no (or yes) according to your system.

This puts it back (except for ARM or WASM, which as hardcoded).
2024-11-08 11:57:17 +00:00
Valery Fedorenko 9ecd8f7f40
gh-126171: fix possible null dereference in _imp_find_frozen_impl (#126566) 2024-11-08 15:49:15 +05:30
Serhiy Storchaka 06a8b0bb5e
gh-122943: Remove the object converter for var-positional parameter (GH-126560) 2024-11-08 05:41:54 +00:00
Bénédikt Tran c222441fa7
gh-120017: use 'do-while(0)' in some `{codegen,compile}.c` multi-line macros (#120018) 2024-11-07 23:03:11 +00:00
Brett Cannon bbe9b21d06
GH-123877: default to `wasm32-wasip1` instead of `wasm32-wasi` to be more specific (GH-126552)
Eventually wasm32-wasi will represent WASI 1.0, and so it's currently deprecated so it can be used for that eventual purpose. wasm32-wasip1 is also more specific to what version of WASI is currently supported.

---------

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-11-07 13:40:56 -08:00
Serhiy Storchaka 1f777396f5
gh-122943: Rework support of var-positional parameter in Argument Clinic (GH-122945)
Move creation of a tuple for var-positional parameter out of
_PyArg_UnpackKeywordsWithVararg().
Merge _PyArg_UnpackKeywordsWithVararg() with _PyArg_UnpackKeywords().
Add a new parameter in _PyArg_UnpackKeywords().

The "parameters" and "converters" attributes of ParseArgsCodeGen no
longer contain the var-positional parameter. It is now available as the
"varpos" attribute. Optimize code generation for var-positional
parameter and reuse the same generating code for functions with and without
keyword parameters.

Add special converters for var-positional parameter. "tuple" represents it as
a Python tuple and "array" represents it as a continuous array of PyObject*.
"object" is a temporary alias of "tuple".
2024-11-07 23:40:03 +02:00
alm 09d6f5dc78
GH-126464 Fix JIT CI on aarch64-apple-darwin (GH-126494) 2024-11-07 10:55:31 -08:00
Michael Droettboom a38e82bd8c
gh-126298: Don't deduplicate slice constants based on equality (#126398)
* gh-126298: Don't deduplicated slice constants based on equality

* NULL check for PySlice_New

* Fix refcounting

* Fix refcounting some more

* Fix refcounting

* Make tests more complete

* Fix tests
2024-11-07 16:39:23 +00:00
Eric Snow 9357fdcaf0
gh-76785: Minor Cleanup of "Cross-interpreter" Code (gh-126457)
The primary objective here is to allow some later changes to be cleaner. Mostly this involves renaming things and moving a few things around.

* CrossInterpreterData -> XIData
* crossinterpdatafunc -> xidatafunc
* split out pycore_crossinterp_data_registry.h
* add _PyXIData_lookup_t
2024-11-07 09:32:42 -07:00
Aditya Borikar 3d9f9ae5a7
Chore: Fix typo in `pyarena.c` (#126527) 2024-11-07 16:37:41 +01:00
Valerii 19c2481853
gh-126529: Update devguide links to relative filenames in InternalDocs (#126530)
Update devguide links to relative filenames in InternalDocs/parser.md
and InternalDocs/compiler.md.
2024-11-07 16:35:29 +01:00
Richard Hansen e3510bd3dd
Doc: C API: Demote sections to subsections for consistency (#126535)
The entire file should be a single section; the headings below the
first heading should be subsections.
2024-11-07 16:29:31 +01:00
Mark Shannon 85036c8d61
GH-126222: Fix `_PyUop_num_popped` (GH-126507) 2024-11-07 10:48:27 +00:00
Petr Viktorin c9cda1608e
gh-126500: test_ssl: Don't stop ThreadedEchoServer on OSError in ConnectionHandler; rely on __exit__ (GH-126503)
If `read()` in the ConnectionHandler thread raises `OSError` (except `ConnectionError`),
the ConnectionHandler shuts down the entire ThreadedEchoServer,
preventing further connections.
It also does that for `EPROTOTYPE` in `wrap_conn`.

As far as I can see, this is done to avoid the server thread getting stuck,
forgotten, in its accept loop. However, since 2011 (5b95eb90a7)
the server is used as a context manager, and its `__exit__` does `stop()` and `join()`.
(I'm not sure if we *always* used `with` since that commit, but currently we do.)

Make sure that the context manager *is* used, and remove the `server.stop()`
calls from ConnectionHandler.
2024-11-07 11:07:02 +01:00
Petr Viktorin 78ad7e6322
gh-126499: test_ssl: Don't assume err.reason is a string (GH-126501)
The skipping machinery called `getattr(err, "reason", "")` on an arbitrary
exception. As intermittent Buildbot failures show, sometimes it's set
to None.

Convert it to string for this specific check.
2024-11-07 11:06:27 +01:00
Gregory P. Smith 1fe67df8e3
gh-48020: [docs] Remove the logging howto suggested future FileHandler multiprocessing support (GH-126531)
Docs: Remove the logging howto potential promise of multiprocessing support in the future.

Stick to the facts and suggestions, don't provide hope where we're not going to
implement complexity that we'd rather the user implement themselves when
needed.
2024-11-07 01:57:01 -08:00
Erlend E. Aasland a5b94d0660
gh-96398: Improve accuracy of compiler checks in configure.ac (#117815)
The following variables are now used in compiler checks:
- $ac_cv_gcc_compat is set to 'yes' for GCC compatible compilers
  (the C preprocessor defines the __GNUC__ macro)
- for compiler basename checks, use $CC_BASENAME
  (may contain platform triplets)
- for the rest, use $ac_cv_cc_name
  (does not contain platform triplets)
2024-11-07 10:49:58 +01:00
Duprat 75f7cf91ec
gh-125679: multiprocessing Lock and RLock - fix invalid representation string on MacOSX. (#125680) 2024-11-07 08:10:57 +00:00
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