]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
16 months agoDocs: fix typo and duplicate word in configure.rst (#121410)
Rafael Fontenelle [Tue, 9 Jul 2024 12:24:37 +0000 (09:24 -0300)] 
Docs: fix typo and duplicate word in configure.rst (#121410)

16 months agoGH-118926: Better distinguish between pointer and arrays in interpreter generator...
Mark Shannon [Tue, 9 Jul 2024 10:33:56 +0000 (11:33 +0100)] 
GH-118926: Better distinguish between pointer and arrays in interpreter generator (GH-121496)

16 months agogh-121333: Clarify what is the default executor for asyncio.run_in_executor (#121335)
AN Long [Tue, 9 Jul 2024 09:22:07 +0000 (17:22 +0800)] 
gh-121333: Clarify what is the default executor for asyncio.run_in_executor (#121335)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
16 months agogh-121110: Fix Extension Module Tests Under Py_TRACE_REFS Builds (gh-121503)
Eric Snow [Mon, 8 Jul 2024 21:10:00 +0000 (15:10 -0600)] 
gh-121110: Fix Extension Module Tests Under Py_TRACE_REFS Builds (gh-121503)

The change in gh-118157 (b2cd54a) should have also updated clear_singlephase_extension() but didn't.  We fix that here.  Note that clear_singlephase_extension() (AKA _PyImport_ClearExtension()) is only used in tests.

16 months agogh-121018: Fix typo in NEWS entry (#121510)
Sam Gross [Mon, 8 Jul 2024 20:44:56 +0000 (16:44 -0400)] 
gh-121018: Fix typo in NEWS entry (#121510)

16 months agoNEWS: Fix Sphinx warnings and increase threshold for new news nits (#121482)
Hugo van Kemenade [Mon, 8 Jul 2024 20:30:05 +0000 (14:30 -0600)] 
NEWS: Fix Sphinx warnings and increase threshold for new news nits (#121482)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
16 months agogh-121404: remove direct accesses to u_private from codegen functions (#121500)
Irit Katriel [Mon, 8 Jul 2024 20:02:01 +0000 (21:02 +0100)] 
gh-121404: remove direct accesses to u_private from codegen functions (#121500)

16 months agogh-121368: Fix seq lock memory ordering in _PyType_Lookup (#121388)
Sam Gross [Mon, 8 Jul 2024 18:52:07 +0000 (14:52 -0400)] 
gh-121368: Fix seq lock memory ordering in _PyType_Lookup (#121388)

The `_PySeqLock_EndRead` function needs an acquire fence to ensure that
the load of the sequence happens after any loads within the read side
critical section. The missing fence can trigger bugs on macOS arm64.

Additionally, we need a release fence in `_PySeqLock_LockWrite` to
ensure that the sequence update is visible before any modifications to
the cache entry.

16 months agogh-121487: Fix deprecation warning for ATOMIC_VAR_INIT in mimalloc (gh-121488)
Marc Mueller [Mon, 8 Jul 2024 18:32:30 +0000 (20:32 +0200)] 
gh-121487: Fix deprecation warning for ATOMIC_VAR_INIT in mimalloc (gh-121488)

16 months agoGH-119169: Simplify `os.walk()` exception handling (#121435)
Barney Gale [Mon, 8 Jul 2024 16:41:01 +0000 (17:41 +0100)] 
GH-119169: Simplify `os.walk()` exception handling (#121435)

Handle errors from `os.scandir()` and `ScandirIterator` similarly, which
lets us loop over directory entries with `for`.

16 months agogh-121374: Correct docstrings in `_interpchannels` (gh-121418)
Max Muoto [Mon, 8 Jul 2024 16:32:17 +0000 (11:32 -0500)] 
gh-121374: Correct docstrings in `_interpchannels` (gh-121418)

16 months agoGH-121012: Set index to -1 when list iterators become exhausted in tier 2 (GH-121483)
Mark Shannon [Mon, 8 Jul 2024 13:20:13 +0000 (14:20 +0100)] 
GH-121012: Set index to -1 when list iterators become exhausted in tier 2 (GH-121483)

16 months agogh-121338: Remove #pragma optimize (#121340)
Michael Droettboom [Mon, 8 Jul 2024 12:48:42 +0000 (08:48 -0400)] 
gh-121338: Remove #pragma optimize (#121340)

16 months agogh-108297: Update crashers README for test_crashers removal (#121475)
Alyssa Coghlan [Mon, 8 Jul 2024 05:24:31 +0000 (15:24 +1000)] 
gh-108297: Update crashers README for test_crashers removal (#121475)

Update Lib/test/crashers/README for test_crashers removal

16 months agogh-121461: Fix os.path.normpath documentation indentation (#121466)
CBerJun [Mon, 8 Jul 2024 03:51:03 +0000 (23:51 -0400)] 
gh-121461: Fix os.path.normpath documentation indentation (#121466)

16 months agogh-121467: Fix makefile to include mimalloc headers (#121469)
Marc Mueller [Mon, 8 Jul 2024 00:45:21 +0000 (02:45 +0200)] 
gh-121467: Fix makefile to include mimalloc headers (#121469)

16 months agoFix sphinx reference target (#121470)
Shantanu [Mon, 8 Jul 2024 00:18:28 +0000 (17:18 -0700)] 
Fix sphinx reference target (#121470)

This was introduced in https://github.com/python/cpython/pull/121164
and appears to be causing test failures on main

16 months agoGH-73991: Fix "Operation not supported" on Fedora buildbot. (#121444)
Barney Gale [Sun, 7 Jul 2024 16:27:52 +0000 (17:27 +0100)] 
GH-73991: Fix "Operation not supported" on Fedora buildbot. (#121444)

Follow-up to #120806. Use `os_helper.skip_unless_xattr` to skip testing
xattr preservation when unsupported.

16 months agoAdd Fidget-Spinner to stackrefs CODEOWNERS (GH-121455)
Ken Jin [Sun, 7 Jul 2024 13:45:06 +0000 (21:45 +0800)] 
Add Fidget-Spinner to stackrefs CODEOWNERS (GH-121455)

16 months agogh-121351: Skip test_not_wiping_history_file() if no readline (#121422)
Sergey B Kirpichev [Sat, 6 Jul 2024 22:53:54 +0000 (01:53 +0300)] 
gh-121351: Skip test_not_wiping_history_file() if no readline (#121422)

16 months agogh-119909: Fix ``NameError`` in ``asyncio`` REPL (#121341)
Kirill Podoprigora [Sat, 6 Jul 2024 20:49:33 +0000 (23:49 +0300)] 
gh-119909: Fix ``NameError`` in ``asyncio`` REPL (#121341)

16 months agoRegen ``Doc/requirements-oldest-sphinx.txt`` (#121437)
Kirill Podoprigora [Sat, 6 Jul 2024 18:04:41 +0000 (21:04 +0300)] 
Regen ``Doc/requirements-oldest-sphinx.txt`` (#121437)

regen dependencies

16 months ago[docs] fix a Sphinx directive in `c-api/object.rst` (#121430)
Bénédikt Tran [Sat, 6 Jul 2024 17:57:26 +0000 (19:57 +0200)] 
[docs] fix a Sphinx directive in `c-api/object.rst` (#121430)

16 months agoGH-73991: Support preserving metadata in `pathlib.Path.copy()` (#120806)
Barney Gale [Sat, 6 Jul 2024 16:18:39 +0000 (17:18 +0100)] 
GH-73991: Support preserving metadata in `pathlib.Path.copy()` (#120806)

Add *preserve_metadata* keyword-only argument to `pathlib.Path.copy()`, defaulting to false. When set to true, we copy timestamps, permissions, extended attributes and flags where available, like `shutil.copystat()`. The argument has no effect on Windows, where metadata is always copied.

Internally (in the pathlib ABCs), path types gain `_readable_metadata` and `_writable_metadata` attributes. These sets of strings describe what kinds of metadata can be retrieved and stored. We take an intersection of `source._readable_metadata` and `target._writable_metadata` to minimise reads/writes. A new `_read_metadata()` method accepts a set of metadata keys and returns a dict with those keys, and a new `_write_metadata()` method accepts a dict of metadata. We *might* make these public in future, but it's hard to justify while the ABCs are still private.

16 months agogh-121359: Run test_pyrepl in isolated mode (#121414)
Victor Stinner [Fri, 5 Jul 2024 20:30:08 +0000 (22:30 +0200)] 
gh-121359: Run test_pyrepl in isolated mode (#121414)

run_repl() now pass the -I option (isolated mode) to Python if the
'env' parameter is not set.

16 months agoUpdate example of str.split, bytes.split (#121287)
Yuxin Wu [Fri, 5 Jul 2024 20:08:29 +0000 (13:08 -0700)] 
Update example of str.split, bytes.split (#121287)

In `{str,bytes}.strip(chars)`, multiple characters are not treated as a
prefix/suffix, but as individual characters. This may make users confuse
whether `split` has similar behavior.
Users may incorrectly expect that
`'Good morning, John.'.split(', .') == ['Good', 'morning', 'John']`

Adding a bit of clarification in the doc.

Co-authored-by: Yuxin Wu <ppwwyyxx@users.noreply.github.com>
16 months agogh-121288: Make error message for index() methods consistent (GH-121395)
Serhiy Storchaka [Fri, 5 Jul 2024 17:50:45 +0000 (20:50 +0300)] 
gh-121288: Make error message for index() methods consistent (GH-121395)

Make error message for index() methods consistent

Remove the repr of the searched value (which can be arbitrary large)
from ValueError messages for list.index(), range.index(), deque.index(),
deque.remove() and ShareableList.index().  Make the error messages
consistent with error messages for other index() and remove()
methods.

16 months agoFixed regenerating files in a checkout path with spaces (GH-121384)
AraHaan [Fri, 5 Jul 2024 16:33:52 +0000 (12:33 -0400)] 
Fixed regenerating files in a checkout path with spaces (GH-121384)

16 months agogh-121149: improve accuracy of builtin sum() for complex inputs (gh-121176)
Sergey B Kirpichev [Fri, 5 Jul 2024 15:01:05 +0000 (18:01 +0300)] 
gh-121149: improve accuracy of builtin sum() for complex inputs (gh-121176)

16 months agogh-59110: Fix a debug output for implicit directories (GH-121375)
Serhiy Storchaka [Fri, 5 Jul 2024 08:44:07 +0000 (11:44 +0300)] 
gh-59110: Fix a debug output for implicit directories (GH-121375)

16 months agogh-121390: tracemalloc: Fix tracebacks memory leak (#121391)
Josh Brobst [Fri, 5 Jul 2024 06:39:48 +0000 (02:39 -0400)] 
gh-121390: tracemalloc: Fix tracebacks memory leak (#121391)

The tracemalloc_tracebacks hash table has traceback keys and NULL
values, but its destructors do not reflect this -- key_destroy_func is
NULL while value_destroy_func is raw_free. Swap these to free the
traceback keys instead.

16 months agogh-90437: Fix __main__.py documentation wording (GH-116309)
Ali Tavallaie [Thu, 4 Jul 2024 22:49:14 +0000 (02:19 +0330)] 
gh-90437: Fix __main__.py documentation wording (GH-116309)

Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Frank Dana <ferdnyc@gmail.com>
16 months agogh-121084: Fix test_typing random leaks (#121360)
Victor Stinner [Thu, 4 Jul 2024 17:38:30 +0000 (19:38 +0200)] 
gh-121084: Fix test_typing random leaks (#121360)

Clear typing ABC caches when running tests for refleaks (-R option):
call _abc_caches_clear() on typing abstract classes and their
subclasses.

16 months agogh-106597: Remove unnecessary CFrame offsets (#121369)
Gabriele N. Tornetta [Thu, 4 Jul 2024 17:28:23 +0000 (18:28 +0100)] 
gh-106597: Remove unnecessary CFrame offsets (#121369)

16 months agogh-59110: zipimport: support namespace packages when no directory entry exists (GH...
Serhiy Storchaka [Thu, 4 Jul 2024 15:04:24 +0000 (18:04 +0300)] 
gh-59110: zipimport: support namespace packages when no directory entry exists (GH-121233)

16 months agogh-118507: Amend news entry to mention ntpath.isfile bugfix (GH-120817)
Nice Zombies [Thu, 4 Jul 2024 14:56:06 +0000 (16:56 +0200)] 
gh-118507: Amend news entry to mention ntpath.isfile bugfix (GH-120817)

16 months agogh-121272: move async for/with validation from compiler to symtable (#121361)
Irit Katriel [Thu, 4 Jul 2024 13:47:21 +0000 (14:47 +0100)] 
gh-121272: move async for/with validation from compiler to symtable (#121361)

16 months agogh-121355: Fix incorrect word in simple_stmts.rst (#121356)
Jongbum Won [Thu, 4 Jul 2024 13:34:34 +0000 (22:34 +0900)] 
gh-121355: Fix incorrect word in simple_stmts.rst (#121356)

16 months agogh-120754: Update estimated_size in C truncate (#121357)
Cody Maloney [Thu, 4 Jul 2024 12:59:18 +0000 (05:59 -0700)] 
gh-120754: Update estimated_size in C truncate (#121357)

Sometimes a large file is truncated (test_largefile). While
estimated_size is used as a estimate (the read will stil get the number
of bytes in the file), that it is much larger than the actual size of
data can result in a significant over allocation and sometimes lead to
a MemoryError / running out of memory.

This brings the C implementation to match the Python _pyio
implementation.

16 months agogh-121352: use _Py_SourceLocation in symtable (#121353)
Irit Katriel [Thu, 4 Jul 2024 10:28:44 +0000 (11:28 +0100)] 
gh-121352: use _Py_SourceLocation in symtable (#121353)

16 months agogh-120754: Reduce system calls in full-file FileIO.readall() case (#120755)
Cody Maloney [Thu, 4 Jul 2024 07:17:00 +0000 (00:17 -0700)] 
gh-120754: Reduce system calls in full-file FileIO.readall() case (#120755)

This reduces the system call count of a simple program[0] that reads all
the `.rst` files in Doc by over 10% (5706 -> 4734 system calls on my
linux system, 5813 -> 4875 on my macOS)

This reduces the number of `fstat()` calls always and seek calls most
the time. Stat was always called twice, once at open (to error early on
directories), and a second time to get the size of the file to be able
to read the whole file in one read. Now the size is cached with the
first call.

The code keeps an optimization that if the user had previously read a
lot of data, the current position is subtracted from the number of bytes
to read. That is somewhat expensive so only do it on larger files,
otherwise just try and read the extra bytes and resize the PyBytes as
needeed.

I built a little test program to validate the behavior + assumptions
around relative costs and then ran it under `strace` to get a log of the
system calls. Full samples below[1].

After the changes, this is everything in one `filename.read_text()`:

```python3
openat(AT_FDCWD, "cpython/Doc/howto/clinic.rst", O_RDONLY|O_CLOEXEC) = 3`
fstat(3, {st_mode=S_IFREG|0644, st_size=343, ...}) = 0`
ioctl(3, TCGETS, 0x7ffdfac04b40)        = -1 ENOTTY (Inappropriate ioctl for device)
lseek(3, 0, SEEK_CUR)                   = 0
read(3, ":orphan:\n\n.. This page is retain"..., 344) = 343
read(3, "", 1)                          = 0
close(3)                                = 0
```

This does make some tradeoffs
1. If the file size changes between open() and readall(), this will
still get all the data but might have more read calls.
2. I experimented with avoiding the stat + cached result for small files
in general, but on my dev workstation at least that tended to reduce
performance compared to using the fstat().

[0]

```python3
from pathlib import Path

nlines = []
for filename in Path("cpython/Doc").glob("**/*.rst"):
    nlines.append(len(filename.read_text()))
```

[1]
Before small file:

```
openat(AT_FDCWD, "cpython/Doc/howto/clinic.rst", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=343, ...}) = 0
ioctl(3, TCGETS, 0x7ffe52525930)        = -1 ENOTTY (Inappropriate ioctl for device)
lseek(3, 0, SEEK_CUR)                   = 0
lseek(3, 0, SEEK_CUR)                   = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=343, ...}) = 0
read(3, ":orphan:\n\n.. This page is retain"..., 344) = 343
read(3, "", 1)                          = 0
close(3)                                = 0
```

After small file:

```
openat(AT_FDCWD, "cpython/Doc/howto/clinic.rst", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=343, ...}) = 0
ioctl(3, TCGETS, 0x7ffdfac04b40)        = -1 ENOTTY (Inappropriate ioctl for device)
lseek(3, 0, SEEK_CUR)                   = 0
read(3, ":orphan:\n\n.. This page is retain"..., 344) = 343
read(3, "", 1)                          = 0
close(3)                                = 0
```

Before large file:

```
openat(AT_FDCWD, "cpython/Doc/c-api/typeobj.rst", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=133104, ...}) = 0
ioctl(3, TCGETS, 0x7ffe52525930)        = -1 ENOTTY (Inappropriate ioctl for device)
lseek(3, 0, SEEK_CUR)                   = 0
lseek(3, 0, SEEK_CUR)                   = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=133104, ...}) = 0
read(3, ".. highlight:: c\n\n.. _type-struc"..., 133105) = 133104
read(3, "", 1)                          = 0
close(3)                                = 0
```

After large file:

```
openat(AT_FDCWD, "cpython/Doc/c-api/typeobj.rst", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=133104, ...}) = 0
ioctl(3, TCGETS, 0x7ffdfac04b40)        = -1 ENOTTY (Inappropriate ioctl for device)
lseek(3, 0, SEEK_CUR)                   = 0
lseek(3, 0, SEEK_CUR)                   = 0
read(3, ".. highlight:: c\n\n.. _type-struc"..., 133105) = 133104
read(3, "", 1)                          = 0
close(3)                                = 0
```

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
16 months agogh-121141: add support for `copy.replace` to AST nodes (#121162)
Bénédikt Tran [Thu, 4 Jul 2024 03:10:54 +0000 (05:10 +0200)] 
gh-121141: add support for `copy.replace` to AST nodes (#121162)

16 months agogh-117983: Defer import of threading for lazy module loading (#120233)
Chris Markiewicz [Wed, 3 Jul 2024 20:50:46 +0000 (16:50 -0400)] 
gh-117983: Defer import of threading for lazy module loading (#120233)

As noted in gh-117983, the import importlib.util can be triggered at
interpreter startup under some circumstances, so adding threading makes
it a potentially obligatory load.
Lazy loading is not used in the stdlib, so this removes an unnecessary
load for the majority of users and slightly increases the cost of the
first lazily loaded module.

An obligatory threading load breaks gevent, which monkeypatches the
stdlib. Although unsupported, there doesn't seem to be an offsetting
benefit to breaking their use case.

For reference, here are benchmarks for the current main branch:

```
❯ hyperfine -w 8 './python -c "import importlib.util"'
Benchmark 1: ./python -c "import importlib.util"
  Time (mean ± σ):       9.7 ms ±   0.7 ms    [User: 7.7 ms, System: 1.8 ms]
  Range (min … max):     8.4 ms …  13.1 ms    313 runs
```

And with this patch:

```
❯ hyperfine -w 8 './python -c "import importlib.util"'
Benchmark 1: ./python -c "import importlib.util"
  Time (mean ± σ):       8.4 ms ±   0.7 ms    [User: 6.8 ms, System: 1.4 ms]
  Range (min … max):     7.2 ms …  11.7 ms    352 runs
```

Compare to:

```
❯ hyperfine -w 8 './python -c pass'
Benchmark 1: ./python -c pass
  Time (mean ± σ):       7.6 ms ±   0.6 ms    [User: 5.9 ms, System: 1.6 ms]
  Range (min … max):     6.7 ms …  11.3 ms    390 runs
```

This roughly halves the import time of importlib.util.

16 months agogh-118714: Make the pdb post-mortem restart/quit behavior more reasonable (#118725)
Tian Gao [Wed, 3 Jul 2024 18:30:20 +0000 (11:30 -0700)] 
gh-118714: Make the pdb post-mortem restart/quit behavior more reasonable (#118725)

16 months agogh-112136: Restore removed _PyArg_Parser (#121262)
Victor Stinner [Wed, 3 Jul 2024 16:36:57 +0000 (18:36 +0200)] 
gh-112136: Restore removed _PyArg_Parser (#121262)

Restore the private _PyArg_Parser structure and the private
_PyArg_ParseTupleAndKeywordsFast() function, previously removed
in Python 3.13 alpha 1.

Recreate Include/cpython/modsupport.h header file.

16 months agogh-121300: Add `replace` to `copy.__all__` (#121302)
Max Muoto [Wed, 3 Jul 2024 15:03:56 +0000 (10:03 -0500)] 
gh-121300: Add `replace` to `copy.__all__` (#121302)

16 months agogh-121201: Disable perf_trampoline on riscv64 for now (#121328)
Stefano Rivera [Wed, 3 Jul 2024 14:44:34 +0000 (07:44 -0700)] 
gh-121201: Disable perf_trampoline on riscv64 for now (#121328)

Disable perf_trampoline on riscv64 for now

Until support is added in perf_jit_trampoline.c

gh-120089 was incomplete.

16 months agoGH-119726: Emit AArch64 trampolines out-of-line (GH-121280)
Diego Russo [Wed, 3 Jul 2024 13:22:21 +0000 (14:22 +0100)] 
GH-119726: Emit AArch64 trampolines out-of-line (GH-121280)

16 months agogh-121035: Update PNG image for logging flow diagram. (GH-121323)
Vinay Sajip [Wed, 3 Jul 2024 11:33:28 +0000 (12:33 +0100)] 
gh-121035: Update PNG image for logging flow diagram. (GH-121323)

16 months agogh-121245: a regression test for site.register_readline() (#121259)
Sergey B Kirpichev [Wed, 3 Jul 2024 10:45:43 +0000 (13:45 +0300)] 
gh-121245: a regression test for site.register_readline() (#121259)

16 months agogh-121263: Macro-ify most stackref functions for MSVC (GH-121270)
Ken Jin [Wed, 3 Jul 2024 09:49:31 +0000 (17:49 +0800)] 
gh-121263: Macro-ify most stackref functions for MSVC (GH-121270)

Macro-ify most stackref functions for MSVC

16 months agogh-121272: set ste_coroutine during symtable construction (#121297)
Irit Katriel [Wed, 3 Jul 2024 09:18:34 +0000 (10:18 +0100)] 
gh-121272: set ste_coroutine during symtable construction (#121297)

compiler no longer modifies the symtable after this.

16 months agogh-61103: Support float and long double complex types in ctypes module (#121248)
Sergey B Kirpichev [Wed, 3 Jul 2024 09:08:11 +0000 (12:08 +0300)] 
gh-61103: Support float and long double complex types in ctypes module (#121248)

This amends 6988ff02a5: memory allocation for
stginfo->ffi_type_pointer.elements in PyCSimpleType_init() should be
more generic (perhaps someday fmt->pffi_type->elements will be not a
two-elements array).

It should finally resolve #61103.

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
16 months agogh-106597: Add more offsets to _Py_DebugOffsets (#121311)
Gabriele N. Tornetta [Wed, 3 Jul 2024 08:53:44 +0000 (09:53 +0100)] 
gh-106597: Add more offsets to _Py_DebugOffsets (#121311)

Add more offsets to _Py_DebugOffsets

We add a few more offsets that are required by some out-of-process
tools, such as [Austin](https://github.com/p403n1x87/austin).

16 months agoDocs: Add `os.splice` flags argument (#109847)
Amin Alaee [Wed, 3 Jul 2024 08:10:57 +0000 (10:10 +0200)] 
Docs: Add `os.splice` flags argument (#109847)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Blaise Pabon <blaise@gmail.com>
16 months agodocs: Fix "Py_TPFLAGS_MANAGED_WEAKREF is set in tp_flags" (#112237)
da-woods [Wed, 3 Jul 2024 08:05:02 +0000 (09:05 +0100)] 
docs: Fix "Py_TPFLAGS_MANAGED_WEAKREF is set in tp_flags" (#112237)

16 months agobuild(deps): bump hypothesis from 6.100.2 to 6.104.2 in /Tools (#121218)
dependabot[bot] [Wed, 3 Jul 2024 07:52:59 +0000 (13:22 +0530)] 
build(deps): bump hypothesis from 6.100.2 to 6.104.2 in /Tools (#121218)

Bumps [hypothesis](https://github.com/HypothesisWorks/hypothesis) from 6.100.2 to 6.104.2.
- [Release notes](https://github.com/HypothesisWorks/hypothesis/releases)
- [Commits](https://github.com/HypothesisWorks/hypothesis/compare/hypothesis-python-6.100.2...hypothesis-python-6.104.2)

---
updated-dependencies:
- dependency-name: hypothesis
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
16 months agoupdated tp_flags initialization to use inplace or (#120625)
byundojin [Wed, 3 Jul 2024 07:51:25 +0000 (16:51 +0900)] 
updated tp_flags initialization to use inplace or (#120625)

16 months agogh-111872: Document the max_children attribute for `socketserver.ForkingMixIn` (...
AN Long [Wed, 3 Jul 2024 07:46:57 +0000 (15:46 +0800)] 
gh-111872: Document the max_children attribute for `socketserver.ForkingMixIn` (#118134)

16 months agogh-116181: Remove Py_BUILD_CORE_BUILTIN and Py_BUILD_CORE_MODULE in rotatingtree...
AN Long [Wed, 3 Jul 2024 07:35:05 +0000 (15:35 +0800)] 
gh-116181: Remove Py_BUILD_CORE_BUILTIN and Py_BUILD_CORE_MODULE in rotatingtree.c (#121260)

16 months agogh-121027: Make the functools.partial object a method descriptor (GH-121089)
Serhiy Storchaka [Wed, 3 Jul 2024 06:02:15 +0000 (09:02 +0300)] 
gh-121027: Make the functools.partial object a method descriptor (GH-121089)

Co-authored-by: d.grigonis <dgrigonis@users.noreply.github.com>
16 months agoGH-73991: Support copying directory symlinks on older Windows (#120807)
Barney Gale [Wed, 3 Jul 2024 03:30:29 +0000 (04:30 +0100)] 
GH-73991: Support copying directory symlinks on older Windows (#120807)

Check for `ERROR_INVALID_PARAMETER` when calling `_winapi.CopyFile2()` and
raise `UnsupportedOperation`. In `Path.copy()`, handle this exception and
fall back to the `PathBase.copy()` implementation.

16 months agogh-121035: Further improve logging flow diagram with respect to dark/light modes...
Vinay Sajip [Tue, 2 Jul 2024 17:57:34 +0000 (18:57 +0100)] 
gh-121035: Further improve logging flow diagram with respect to dark/light modes. (GH-121265)

16 months agogh-115773: Add sizes to debug offset structure (#120112)
Pablo Galindo Salgado [Tue, 2 Jul 2024 17:54:33 +0000 (18:54 +0100)] 
gh-115773: Add sizes to debug offset structure (#120112)

16 months agogh-117139: Add _PyTuple_FromStackRefSteal and use it (#121244)
Sam Gross [Tue, 2 Jul 2024 16:30:14 +0000 (12:30 -0400)] 
gh-117139: Add _PyTuple_FromStackRefSteal and use it (#121244)

Avoids the extra conversion from stack refs to PyObjects.

16 months agogh-121272: move __future__ import validation from compiler to symtable (#121273)
Irit Katriel [Tue, 2 Jul 2024 16:22:08 +0000 (17:22 +0100)] 
gh-121272: move __future__ import validation from compiler to symtable (#121273)

16 months agogh-121165: protect macro expansion of `ADJUST_INDICES` with do-while(0) (#121166)
Bénédikt Tran [Tue, 2 Jul 2024 10:57:51 +0000 (12:57 +0200)] 
gh-121165: protect macro expansion of `ADJUST_INDICES` with do-while(0) (#121166)

16 months agogh-121210: handle nodes with missing attributes/fields in `ast.compare` (#121211)
Bénédikt Tran [Tue, 2 Jul 2024 10:53:17 +0000 (12:53 +0200)] 
gh-121210: handle nodes with missing attributes/fields in `ast.compare` (#121211)

16 months agogh-121245: Amend d611c4c8e9 (correct import) (#121255)
Sergey B Kirpichev [Tue, 2 Jul 2024 09:40:01 +0000 (12:40 +0300)] 
gh-121245: Amend d611c4c8e9 (correct import) (#121255)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
16 months agoMove get_signal_name() to test.support (#121251)
Victor Stinner [Tue, 2 Jul 2024 08:34:13 +0000 (10:34 +0200)] 
Move get_signal_name() to test.support (#121251)

* Move get_signal_name() from test.libregrtest to test.support.
* Use get_signal_name() in support.script_helper.
* support.script_helper now decodes stdout and stderr from UTF-8,
  instead of ASCII, if a command failed.

16 months agogh-121035: Improve logging flow diagram for dark/light modes. (GH-121254)
Vinay Sajip [Tue, 2 Jul 2024 08:13:37 +0000 (09:13 +0100)] 
gh-121035: Improve logging flow diagram for dark/light modes. (GH-121254)

16 months agoFix phrasing in paragraphs with leading "similar" (#121135)
Rafael Fontenelle [Tue, 2 Jul 2024 00:36:27 +0000 (21:36 -0300)] 
Fix phrasing in paragraphs with leading "similar" (#121135)

16 months agoGH-119726: Use LDR for AArch64 trampolines (GH-121001)
Diego Russo [Mon, 1 Jul 2024 22:52:33 +0000 (23:52 +0100)] 
GH-119726: Use LDR for AArch64 trampolines (GH-121001)

16 months agogh-121196: Document `dict.fromkeys` params as pos-only (#121197)
sobolevn [Mon, 1 Jul 2024 20:27:04 +0000 (23:27 +0300)] 
gh-121196: Document `dict.fromkeys` params as pos-only (#121197)

16 months agoGH-116017: Get rid of _COLD_EXITs (GH-120960)
Brandt Bucher [Mon, 1 Jul 2024 20:17:40 +0000 (13:17 -0700)] 
GH-116017: Get rid of _COLD_EXITs (GH-120960)

16 months agogh-117657: Fix data races reported by TSAN in some set methods (#120914)
AN Long [Mon, 1 Jul 2024 19:11:39 +0000 (03:11 +0800)] 
gh-117657: Fix data races reported by TSAN in some set methods (#120914)

Refactor the fast Unicode hash check into `_PyObject_HashFast` and use relaxed
atomic loads in the free-threaded build.

After this change, the TSAN doesn't report data races for this method.

16 months agogh-121110: Temporarily Skip test_basic_multiple_interpreters_reset_each (gh-121236)
Eric Snow [Mon, 1 Jul 2024 17:58:25 +0000 (11:58 -0600)] 
gh-121110: Temporarily Skip test_basic_multiple_interpreters_reset_each (gh-121236)

This will allow Py_TRACE_REFS builds to pass the test suite, until the underlying issue can be resolved.

16 months agogh-114104: clarify asynchronous comprehension docs to match runtime behavior (#121175)
Danny Yang [Mon, 1 Jul 2024 16:34:39 +0000 (12:34 -0400)] 
gh-114104: clarify asynchronous comprehension docs to match runtime behavior (#121175)

16 months agogh-120743: Soft deprecate os.popen() function (#120744)
Victor Stinner [Mon, 1 Jul 2024 16:27:50 +0000 (18:27 +0200)] 
gh-120743: Soft deprecate os.popen() function (#120744)

Soft deprecate os.popen() and os.spawn*() functions.

16 months agogh-121200: Fix test_expanduser_pwd2() of test_posixpath (#121228)
Victor Stinner [Mon, 1 Jul 2024 15:49:03 +0000 (17:49 +0200)] 
gh-121200: Fix test_expanduser_pwd2() of test_posixpath (#121228)

Call getpwnam() to get pw_dir, since it can be different than
getpwall() pw_dir.

16 months agogh-117657: Use critical section to make _socket.socket.close thread safe (GH-120490)
AN Long [Mon, 1 Jul 2024 14:38:30 +0000 (22:38 +0800)] 
gh-117657: Use critical section to make _socket.socket.close thread safe (GH-120490)

16 months agogh-121220: Mark test_threaded_weak_value_dict_copy() as CPU-heavy (#121221)
Kirill Podoprigora [Mon, 1 Jul 2024 13:33:02 +0000 (16:33 +0300)] 
gh-121220: Mark test_threaded_weak_value_dict_copy() as CPU-heavy (#121221)

Mark test_threaded_weak_value_dict_copy() and
test_threaded_weak_key_dict_copy() of test_weakref as
CPU-heavy tests

16 months agogh-117784: Only reference PHA functions ifndef SSL_VERIFY_POST_HANDSHAKE (GH-117785)
Will Childs-Klein [Mon, 1 Jul 2024 13:28:35 +0000 (09:28 -0400)] 
gh-117784: Only reference PHA functions ifndef SSL_VERIFY_POST_HANDSHAKE (GH-117785)

With this change, builds with OpenSSL forks that don't have this functionalty
(like AWS-LC or BoringSSL) will require less patching.

16 months agobuild(deps-dev): bump types-setuptools from 70.0.0.20240524 to 70.1.0.20240627 in...
dependabot[bot] [Mon, 1 Jul 2024 10:42:46 +0000 (10:42 +0000)] 
build(deps-dev): bump types-setuptools from 70.0.0.20240524 to 70.1.0.20240627 in /Tools (#121217)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
16 months agobuild(deps-dev): bump mypy from 1.10.0 to 1.10.1 in /Tools (#121216)
dependabot[bot] [Mon, 1 Jul 2024 10:15:53 +0000 (10:15 +0000)] 
build(deps-dev): bump mypy from 1.10.0 to 1.10.1 in /Tools (#121216)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
16 months agobuild(deps-dev): bump types-psutil from 5.9.5.20240516 to 6.0.0.20240621 in /Tools...
dependabot[bot] [Mon, 1 Jul 2024 10:15:25 +0000 (10:15 +0000)] 
build(deps-dev): bump types-psutil from 5.9.5.20240516 to 6.0.0.20240621 in /Tools (#121215)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
16 months agogh-121200: Log pwd entry in test_expanduser_pwd2() (#121207)
Victor Stinner [Mon, 1 Jul 2024 09:43:59 +0000 (11:43 +0200)] 
gh-121200: Log pwd entry in test_expanduser_pwd2() (#121207)

Use subTest() to log the pwd entry in test_expanduser_pwd2() of
test_posixpath to help debugging.

16 months agogh-121084: Call _abc_registry_clear() when checking refleaks (#121191)
Victor Stinner [Mon, 1 Jul 2024 09:03:33 +0000 (11:03 +0200)] 
gh-121084: Call _abc_registry_clear() when checking refleaks (#121191)

dash_R_cleanup() now calls _abc_registry_clear() before calling again
register().

16 months agogh-61103: Support double complex (_Complex) type in ctypes (#120894)
Sergey B Kirpichev [Mon, 1 Jul 2024 08:54:33 +0000 (11:54 +0300)] 
gh-61103: Support double complex (_Complex) type in ctypes (#120894)

Example:

```pycon
>>> import ctypes
>>> ctypes.__STDC_IEC_559_COMPLEX__
1
>>> libm = ctypes.CDLL('libm.so.6')
>>> libm.clog.argtypes = [ctypes.c_double_complex]
>>> libm.clog.restype = ctypes.c_double_complex
>>> libm.clog(1+1j)
(0.34657359027997264+0.7853981633974483j)
```

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
16 months agogh-121199: Use _Py__has_attribute() in timemodule.c (#121203)
Victor Stinner [Mon, 1 Jul 2024 08:49:33 +0000 (10:49 +0200)] 
gh-121199: Use _Py__has_attribute() in timemodule.c (#121203)

Use the _Py__has_attribute() macro in timemodule.c and
bootstrap_hash.c to fix a build error on old GCC versions (GCC 4.8.5
on s390x).

16 months agogh-121188: Sanitize invalid XML characters in regrtest (#121195)
Victor Stinner [Mon, 1 Jul 2024 08:30:33 +0000 (10:30 +0200)] 
gh-121188: Sanitize invalid XML characters in regrtest (#121195)

When creating the JUnit XML file, regrtest now escapes characters
which are invalid in XML, such as the chr(27) control character used
in ANSI escape sequences.

16 months agogh-113565: Improve and harden detection of curses dependencies (#119816)
Erlend E. Aasland [Mon, 1 Jul 2024 08:10:03 +0000 (10:10 +0200)] 
gh-113565: Improve and harden detection of curses dependencies (#119816)

1. Use pkg-config to check for ncursesw/panelw. If that fails, use
   pkg-config to check for ncurses/panel.
2. Regardless of pkg-config output, search for curses/panel headers, so
   we're sure we have all defines in pyconfig.h.
3. Regardless of pkg-config output, check if libncurses or libncursesw
   contains the 'initscr' symbol; if it does _and_ pkg-config failed
   earlier, add the resulting -llib linker option to CURSES_LIBS.
   Ditto for 'update_panels' and PANEL_LIBS.
4. Wrap the rest of the checks with WITH_SAVE_ENV and make sure we're
   using updated LIBS and CPPFLAGS for those.

Add the PY_CHECK_CURSES convenience macro.

16 months agogh-87744: fix waitpid race while calling send_signal in asyncio (#121126)
Kumar Aditya [Mon, 1 Jul 2024 04:47:36 +0000 (10:17 +0530)] 
gh-87744: fix waitpid race while calling send_signal in asyncio (#121126)

asyncio earlier relied on subprocess module to send signals to the process, this has some drawbacks one being that subprocess module unnecessarily calls waitpid on child processes and hence it races with asyncio implementation which internally uses child watchers. To mitigate this, now asyncio sends signals directly to the process without going through the subprocess on non windows systems. On Windows it fallbacks to subprocess module handling but on windows there are no child watchers so this issue doesn't exists altogether.

16 months agogh-121163: Add "all" as an valid alias for "always" in warnings.simplefilter() (...
Kirill Podoprigora [Sun, 30 Jun 2024 17:48:00 +0000 (20:48 +0300)] 
gh-121163: Add "all" as an valid alias for "always" in warnings.simplefilter() (#121164)

Add support for ``all`` as an valid alias for ``always`` in ``warnings.simplefilter()``
and ``warnings.filterswarnings()``.

16 months ago[doc] Update element positions and styles in logging flow diagram. (GH-121182)
Vinay Sajip [Sun, 30 Jun 2024 13:38:49 +0000 (14:38 +0100)] 
[doc] Update element positions and styles in logging flow diagram. (GH-121182)

Update element positions and styles.

16 months agogh-119447: Fix build with _PY_SHORT_FLOAT_REPR == 0 (#121178)
Yureka [Sun, 30 Jun 2024 09:40:40 +0000 (11:40 +0200)] 
gh-119447: Fix build with _PY_SHORT_FLOAT_REPR == 0 (#121178)

16 months agogh-120522: Add a `--with-app-store-compliance` configure option to patch out problema...
Russell Keith-Magee [Sun, 30 Jun 2024 00:34:35 +0000 (08:34 +0800)] 
gh-120522: Add a `--with-app-store-compliance` configure option to patch out problematic code (#120984)

* Add --app-store-compliance configuration option.

* Added blurb.

* Correct tab-vs-spaces formatting issue.

* Correct source file name in docs.

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
* Correct source code reference in Mac docs

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
* Only apply the patch forward, and ensure the working directory is correct.

* Make patching reslient to multiple builds.

* Documentation fixes found during review

Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
* Documentation and configure.ac syntax improvements

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* Regenerate configure script.

* Silence the patch echo output.

---------

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
16 months agoGH-119054: Add alt text to pathlib inheritance diagram (#121158)
Barney Gale [Sat, 29 Jun 2024 17:46:53 +0000 (18:46 +0100)] 
GH-119054: Add alt text to pathlib inheritance diagram (#121158)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
16 months agoGH-119054: Add "Expanding and resolving paths" section to pathlib docs. (#120970)
Barney Gale [Sat, 29 Jun 2024 15:09:47 +0000 (16:09 +0100)] 
GH-119054: Add "Expanding and resolving paths" section to pathlib docs. (#120970)

Add dedicated subsection for `home()`, `expanduser()`, `cwd()`,
`absolute()`, `resolve()` and `readlink()`. The position of this section
keeps all the `Path` constructors (`Path()`, `Path.from_uri()`,
`Path.home()` and `Path.cwd()`) near the top. Within the section, closely
related methods are kept adjacent. Specifically:

-.`home()` and `expanduser()` (the former calls the latter)
- `cwd()` and `absolute()` (the former calls the latter)
- `absolute()` and `resolve()` (both make paths absolute)
- `resolve()` and `readlink()` (both read symlink targets)
- Ditto `cwd()` and `absolute()`
- Ditto `absolute()` and `resolve()`

The "Other methods" section is removed.

16 months agogh-119372: Recover inf's and zeros in _Py_c_quot (GH-119457)
Sergey B Kirpichev [Sat, 29 Jun 2024 08:00:48 +0000 (11:00 +0300)] 
gh-119372: Recover inf's and zeros in _Py_c_quot (GH-119457)

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.2, routine _Cdivd().