Commit graph

124699 commits

Author SHA1 Message Date
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 023b7d2141, 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
Irit Katriel
89fa7ec74e
gh-119786: Add jit.md. Move adaptive.md to a section of interpreter.md. (#127175) 2024-12-06 16:36:06 +00:00
Victor Stinner
67b18a18b6
gh-59705: Add _thread.set_name() function (#127338)
On Linux, threading.Thread now sets the thread name to the operating
system.

* configure now checks if pthread_getname_np()
  and pthread_setname_np() functions are available.
* Add PYTHREAD_NAME_MAXLEN macro.
* Add _thread._NAME_MAXLEN constant for test_threading.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-12-06 16:27:12 +00:00
Peter Bierma
12680ec5bd
gh-127314: Don't mention the GIL when calling without a thread state on the free-threaded build (#127315)
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-06 16:58:19 +01:00
Sam Gross
a353455fca
gh-125610: Fix STORE_ATTR_INSTANCE_VALUE specialization check (GH-125612)
The `STORE_ATTR_INSTANCE_VALUE` opcode doesn't support objects with
non-NULL managed dictionaries, so don't specialize to that op in that case.
2024-12-06 10:48:24 -05:00
Bénédikt Tran
36c6178d37
gh-126024: fix UBSan failure in unicodeobject.c:find_first_nonascii (GH-127566) 2024-12-06 09:31:30 -05:00
Yuki Kobayashi
77a61c0465
gh-101100: amend references starting with !~ in gh-127054 (#127684) 2024-12-06 16:09:20 +02:00
Mark Shannon
023b7d2141
GH-126491: Lower heap size limit with faster marking (GH-127519)
* Faster marking of reachable objects

* Changes calculation of work to do and work done.

* Merges transitive closure calculations
2024-12-06 10:46:59 +00:00
Sergey B Kirpichev
8b7c194c7b
gh-120010: Fix invalid (nan+nanj) results in _Py_c_prod() (GH-120287)
In some cases, previously computed as (nan+nanj), we could recover
meaningful component values in the result, see e.g. the C11, Annex
G.5.1, routine _Cmultd():

>>> z = 1e300+1j
>>> z*(nan+infj)  # was (nan+nanj)
(-inf+infj)

That also fix some complex powers for small integer exponents, computed
with optimized algorithm (by squaring):

>>> z**5  # was (nan+nanj)
Traceback (most recent call last):
  File "<python-input-1>", line 1, in <module>
    z**5
    ~^^~
OverflowError: complex exponentiation
2024-12-06 12:28:32 +02:00
J. Nick Koston
e991ac8f20
gh-127655: Ensure _SelectorSocketTransport.writelines pauses the protocol if needed (#127656)
Ensure `_SelectorSocketTransport.writelines` pauses the protocol if it reaches the high water mark as needed. 

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-12-06 10:03:03 +05:30
Hood Chatham
25eee578c8
gh-127627: Add posix._emscripten_debugger function (#127628)
Add a posix._emscripten_debugger function to add an emscripten breakpoint.
2024-12-06 10:47:51 +08:00
Barney Gale
8b3cccf3f9
GH-125413: Revert addition of pathlib.Path.scandir() method (#127377)
Remove documentation for `pathlib.Path.scandir()`, and rename the method to
`_scandir()`. In the private pathlib ABCs, make `iterdir()` abstract and
call it from `_scandir()`.

It's not worthwhile to add this method at the moment - see discussion:
https://discuss.python.org/t/ergonomics-of-new-pathlib-path-scandir/71721

Co-authored-by: Steve Dower <steve.dower@microsoft.com>
2024-12-05 21:39:43 +00:00
Sam Gross
f4f530804b
gh-127582: Make object resurrection thread-safe for free threading. (GH-127612)
Objects may be temporarily "resurrected" in destructors when calling
finalizers or watcher callbacks. We previously undid the resurrection
by decrementing the reference count using `Py_SET_REFCNT`. This was not
thread-safe because other threads might be accessing the object
(modifying its reference count) if it was exposed by the finalizer,
watcher callback, or temporarily accessed by a racy dictionary or list
access.

This adds internal-only thread-safe functions for temporary object
resurrection during destructors.
2024-12-05 16:07:31 -05:00
Maciej Olko
657d0e99aa
[Docs] GDB howto: Fix block type of a cast example (#127621) 2024-12-05 22:52:58 +02:00
Hugo van Kemenade
23f2e8f13c
gh-127221: Add colour to unittest output (#127223)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-12-05 21:10:46 +02:00
Jakub Kulík
d958d9f4a1
GH-126727: Fix test_era_nl_langinfo with Japanese ERAs on Solaris (GH-127327)
Fix test_era_nl_langinfo with Japanese ERAs on Solaris
2024-12-05 20:43:19 +02:00