124714 Commits

Author SHA1 Message Date
mpage
c84928ed6d
gh-115999: Specialize CALL_KW in free-threaded builds (#127713)
* Enable specialization of CALL_KW

* Fix bug pushing frame in _PY_FRAME_KW

`_PY_FRAME_KW` pushes a pointer to the new frame onto the stack for
consumption by the next uop. When pushing the frame fails, we do not
want to push the result, `NULL`, to the stack because it is not
a valid stackref. This works in the default build because `PyStackRef_NULL`
 and `NULL` are the same value, so the `PyStackRef_XCLOSE()` in the error
handler ignores it. In the free-threaded build the values are not the same;
`PyStackRef_XCLOSE()` will attempt to decref a null pointer.
2024-12-11 15:18:22 -08:00
Nice Zombies
e8f4e272cc
gh-111609: Test end_offset in SyntaxError subclass (#127830)
Test `end_offset` in SyntaxError subclass
2024-12-11 19:32:54 +01:00
Mark Shannon
bc262de06b
GH-125174: Mark objects as statically allocated. (#127797)
* Set a bit in the unused part of the refcount on 64 bit machines and the free-threaded build.

* Use the top of the refcount range on 32 bit machines
2024-12-11 17:37:38 +00:00
Peter Bierma
dd9da738ad
gh-118915: C API: Document frame locals proxies. (#127720)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-12-11 17:28:44 +01:00
Pieter Eendebak
b0f278ff05
gh-127065: Make methodcaller thread-safe and re-entrant (GH-127746)
The function `operator.methodcaller` was not thread-safe since the additional
of the vectorcall method in gh-89013. In the free threading build the issue
is easy to trigger, for the normal build harder.

This makes the `methodcaller` safe by:

* Replacing the lazy initialization with initialization in the constructor.
* Using a stack allocated space for the vectorcall arguments and falling back
  to `tp_call` for calls with more than 8 arguments.
2024-12-11 10:06:07 -05:00
Mark Shannon
5a23994a3d
GH-127058: Make PySequence_Tuple safer and probably faster. (#127758)
* Use a small buffer, then list when constructing a tuple from an arbitrary sequence.
2024-12-11 14:02:59 +00:00
Nano
359389ed51
gh-123401: Fix http.cookies module to support obsolete RFC 850 date format (#123405)
Co-authored-by: Wulian <1055917385@qq.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-11 13:28:19 +00:00
Hugo van Kemenade
b2ad7e0a2c
CI: Use bash to properly expand variable (#127822) 2024-12-11 12:57:51 +00:00
Justin Applegate
ce76b547f9
gh-126992: Change pickle code to base 10 for load_long and load_int (GH-127042)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-12-11 12:37:59 +00:00
Peter Bierma
d5d84c3f13
gh-127791: Fix, document, and test PyUnstable_AtExit (#127793) 2024-12-11 12:14:04 +01:00
Peter Hawkins
2cdeb61b57
Add extern "C" around PyTraceMalloc_ functions. (#127772)
Pretty much everything else exported by Python.h has an extern "C"
annotation, yet this header appears to be missing one.
2024-12-11 10:27:07 +01:00
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి)
db9bea0386
gh-127740: For odd-length input to bytes.fromhex(...) change the error message to ValueError: fromhex() arg must be of even length (#127756) 2024-12-11 08:35:17 +01:00
Barney Gale
12b4f1a5a1
GH-127381: pathlib ABCs: remove PathBase.samefile() and rarer is_*() (#127709)
Remove `PathBase.samefile()`, which is fairly specific to the local FS, and
relies on `stat()`, which we're aiming to remove from `PathBase`.

Also remove `PathBase.is_mount()`, `is_junction()`, `is_block_device()`,
`is_char_device()`, `is_fifo()` and `is_socket()`. These rely on POSIX
file type numbers that we're aiming to remove from the `PathBase` API.
2024-12-11 00:09:55 +00:00
Russell Keith-Magee
51216857ca
gh-126821: Add versionadded annotation to use_system_logger feature. (#127755)
Add versionadded annotation to use_system_logger feature.
2024-12-11 05:32:04 +08:00
Yuki Kobayashi
035f512046
Docs: Fix indents in xmlrpc.client.rst (#127782) 2024-12-10 19:35:00 +02:00
Victor Stinner
c91ccbe4ac
gh-59705: Set OS thread name when Thread.name is changed (#127702)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-12-10 17:33:11 +01:00
Bénédikt Tran
9af96f4406
gh-127563: use dk_log2_index_bytes=3 in empty dicts (GH-127568)
This fixes a UBSan failure (unaligned zero-size memcpy) in `dictobject.c`.
2024-12-10 16:58:17 +01:00
Melissa0x1f992
cef0a90d8f
gh-126937: ctypes: fix TypeError when a field's size is >65535 bytes (GH-126938)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-12-10 13:13:11 +01:00
Petr Viktorin
f4b31edf2d
gh-127257: ssl: Raise OSError for ERR_LIB_SYS (GH-127361)
From the ERR_raise manpage:

    ERR_LIB_SYS

        This "library code" indicates that a system error is
        being reported.  In this case, the reason code given
        to `ERR_raise()` and `ERR_raise_data()` *must* be
        `errno(3)`.


This PR only handles ERR_LIB_SYS for the high-lever error types
SSL_ERROR_SYSCALL and SSL_ERROR_SSL, i.e., not the ones where
OpenSSL indicates it has some more information about the issue.
2024-12-10 11:56:24 +01:00
Petr Viktorin
690fe077f6
gh-126491: Revert "GH-126491: Lower heap size limit with faster marking (GH-127519)" (GH-127770)
Revert "GH-126491: Lower heap size limit with faster marking (GH-127519)"

This reverts commit 023b7d2141467017abc27de864f3f44677768cb3, which introduced
a refleak.
2024-12-10 11:53:56 +01:00
Hugo van Kemenade
ae31df354d
Add zizmor to pre-commit and fix most findings (#127749)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-12-10 12:51:12 +02:00
Yuki Kobayashi
8dbdbad6e0
gh-101100: Fix sphinx warnings in whatsnew/3.0.rst (#127662) 2024-12-10 12:22:37 +02:00
Bénédikt Tran
4331832db0
gh-125420: implement Sequence.count API on memoryview objects (#125443) 2024-12-10 10:12:33 +00:00
Skip Montanaro
050d59bd17
add help blurb for "extralargefile" (#127710) 2024-12-10 09:17:25 +01:00
Hugo van Kemenade
212448b162
gh-127718: Add colour to test.regrtest output (#127719) 2024-12-10 09:44:15 +02:00
Thomas Grainger
2233c303e4
gh-126775: make linecache.checkcache threadsafe and GC re-entrency safe (#126776)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Bartosz Sławecki <bartoszpiotrslawecki@gmail.com>
2024-12-10 08:40:54 +01:00
Shantanu
3983527c3a
gh-127651: Use __file__ in diagnostics if origin is missing (#127660)
See the left hand side in https://github.com/python/cpython/pull/123929/files#diff-c22186367cbe20233e843261998dc027ae5f1f8c0d2e778abfa454ae74cc59deL2840-L2849

---------

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-12-09 20:55:20 -08:00
Bénédikt Tran
58c753827a
gh-125420: implement Sequence.index API on memoryview objects (#125446) 2024-12-09 18:48:38 -08:00
Hood Chatham
3b18af964d
gh-127629: Add ctypes to the Emscripten build (#127683)
Adds tooling to build libffi and add ctypes to the stdlib for Emscripten.
2024-12-10 10:32:58 +08:00
Barney Gale
5c89adf385
GH-127456: pathlib ABCs: add protocol for path parser (#127494)
Change the default value of `PurePathBase.parser` from `ParserBase()` to
`posixpath`. As a result, user subclasses of `PurePathBase` and `PathBase`
use POSIX path syntax by default, which is very often desirable.

Move `pathlib._abc.ParserBase` to `pathlib._types.Parser`, and convert it
to a runtime-checkable protocol.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-12-09 18:31:22 +00:00
Bénédikt Tran
e85f2f1703
gh-127637: add tests for dis command-line interface (#127759) 2024-12-09 18:02:22 +00:00
Wulian
5eb7fd4d0f
gh-127732: Add Windows Server 2025 detection to platform module (GH-127733) 2024-12-09 12:24:26 +00:00
Russell Keith-Magee
2041a95e68
gh-126925: Modify how iOS test results are gathered (#127592)
Adds a `use_system_log` config item to enable stdout/stderr redirection for
Apple platforms. This log streaming is then used by a new iOS test runner
script, allowing the display of test suite output at runtime. The iOS test
runner script can be used by any Python project, not just the CPython test
suite.
2024-12-09 13:28:57 +08:00
Hood Chatham
d8d12b37b5
gh-127503: Fix realpath handling in emscripten cli (#127632)
Corrects the handling of realpath on Linux.
2024-12-09 10:03:11 +08:00
Hood Chatham
5876063d06
gh-127503 Don't propagate native PATH to Emscripten Python (#127633)
Modifies the handling of PATH to ensure that native executables aren't picked
up when running under node.
2024-12-09 10:01:37 +08:00
Hood Chatham
be07edf511
gh-127111: Emscripten Move link flags from LDFLAGS_NODIST to LINKFORSHARED (#127666)
Corrects the usage of linking flags to avoid compilation errors related to the
use of `-sEXPORTED_FUNCTIONS` when linking shared libraries.
2024-12-09 09:34:28 +08:00
Stephen Morton
a03efb533a
gh-127734: improve signature of urllib.request.HTTPPasswordMgrWithPriorAuth.__init__ (#127735)
improve signature of urllib.request.HTTPPasswordMgrWithPriorAuth.__init__
2024-12-08 10:46:34 -08:00
Barney Gale
7f8ec52302
GH-127381: pathlib ABCs: remove PathBase.unlink() and rmdir() (#127736)
Virtual filesystems don't always make a distinction between deleting files
and empty directories, and sometimes support deleting non-empty directories
in a single operation. Here we remove `PathBase.unlink()` and `rmdir()`,
leaving `_delete()` as the sole deletion method, now made abstract. I hope
to drop the underscore prefix later on.
2024-12-08 18:45:09 +00:00
Stan Ulbrych
2367759212
[doc] Fix typos in interpreter_definition.md (#127742) 2024-12-08 18:01:55 +00:00
Bénédikt Tran
3b78409878
gh-87138: convert SHA-3 object type to heap type (GH-127670) 2024-12-08 09:31:10 -08:00
Bénédikt Tran
8fa5ecec01
gh-123378: fix post-merge typos in comments and NEWS (#127739) 2024-12-08 13:47:22 +00:00
Apostol Fet
1503fc8f88
gh-127610: Added validation for more than one var-positional and var-keyword parameters in inspect.Signature (GH-127657) 2024-12-08 12:05:15 +02:00
Filipe Laíns 🇵🇸
70154855cf
GH-126789: fix some sysconfig data on late site initializations (#127729) 2024-12-08 05:57:22 +00:00
Barney Gale
79b7cab50a
GH-127090: Fix urllib.response.addinfourl.url value for opened file: URIs (#127091)
The canonical `file:` URL (as generated by `pathname2url()`) is now used as the `url` attribute of the returned `addinfourl` object. The `addinfourl.url` attribute reflects the resolved URL for both `file:` or `http[s]:` URLs now.
2024-12-07 17:58:42 +00:00
Stan Ulbrych
27d0d21413
Give poplib.POP3.rpop a proper docstring (#127370)
Previously `poplib.POP3.rpop` had a "Not sure what this does" docstring, now it has been fixed.
2024-12-07 18:13:49 +02:00
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి)
72dca6c4ed
gh-119786: fix typo in InternalDocs/garbage_collector.md (#127687) 2024-12-07 15:42:45 +05:30
Barney Gale
31c9f3ced2
GH-127381: pathlib ABCs: remove PathBase.resolve() and absolute() (#127707)
Remove our implementation of POSIX path resolution in `PathBase.resolve()`.
This functionality is rather fragile and isn't necessary in most cases. It
depends on `PathBase.stat()`, which we're looking to remove.

Also remove `PathBase.absolute()`. Many legitimate virtual filesystems lack
the notion of a 'current directory', so it's wrong to include in the basic
interface.
2024-12-06 21:39:45 +00:00
Brett Cannon
0fc4063747
GH-127652: stop using --wasi preview2 in wasi.py (GH-127704)
It's only to use WASI 0.2 code to back preview1 APIs and is considered experimental anyway.
2024-12-06 18:42:05 +00:00
Barney Gale
5b6635f772
GH-127381: pathlib ABCs: remove PathBase.rename() and replace() (#127658)
These methods are obviated by `PathBase.move()`, which can move directories
and supports any `PathBase` object as a target.
2024-12-06 18:10:00 +00:00
Stan Ulbrych
e59caf67cd
Fix typo in Lib/_android_support.py (#127699) 2024-12-06 19:50:58 +02:00