Commit graph

127268 commits

Author SHA1 Message Date
Neil Schemenauer
fbbbc10055
gh-127266: avoid data races when updating type slots (gh-133177)
In the free-threaded build, avoid data races caused by updating type
slots or type flags after the type was initially created.  For those
(typically rare) cases, use the stop-the-world mechanism.  Remove the
use of atomics when reading or writing type flags.
2025-05-27 18:27:41 -07:00
Wulian233
7ca6d79fa3
gh-134580: Modernizing difflib.HtmlDiff for HTML Output (#134581)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-05-28 03:46:41 +03:00
Sam Gross
a4d37f88b6
gh-134679: Fix assertion failure in QSBR (gh-134811)
This is the same underlying bug as gh-130519. The destructor may call
arbitrary code, changing the `tstate->qsbr pointer` and invalidating the
old `struct _qsbr_thread_state`.
2025-05-27 16:21:16 -04:00
Rishabh Singh
967f361993
gh-134789: Document del s[i] operation for mutable sequences (#134804)
[main] Update stdtypes.rst

- Added explicit mention of `del s[i]` (item deletion by index) to the Mutable Sequence Types section.
- Clarified that this operation removes the item at the specified index from the sequence.
- Addresses issue #134789.
2025-05-27 14:48:04 -04:00
Noam Cohen
79d81f7cba
gh-131798: Optimize _ITER_CHECK_TUPLE (GH-134803) 2025-05-28 02:30:17 +08:00
Kumar Aditya
ac539e7e0d
gh-132917: fix data race on last_mem in free-threading gc (#134692) 2025-05-27 22:42:08 +05:30
Kumar Aditya
a380d57873
gh-134043: use stackrefs in vectorcalling methods (#134044)
Adds `_PyObject_GetMethodStackRef` which uses stackrefs and takes advantage of deferred reference counting in free-threading while calling method objects in vectorcall.
2025-05-27 22:28:27 +05:30
Emma Smith
3f9eb55e09
gh-134262: increase retries in Tools/build/generate_sbom.py (#134558) 2025-05-27 19:02:17 +03:00
Eric Snow
9b5e80000e
gh-132775: Always Set __builtins__ In _PyFunction_FromXIData() (gh-134758)
This is a small follow-up to gh-133481.  There's a corner case
in the behavior of PyImport_ImportModuleAttrString(), where
it expects __builtins__ to be set if __globals__ is set.
2025-05-27 15:42:24 +00:00
Victor Stinner
c3c88064f5
gh-133678: Document C API third party tools (#134526)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Steve Dower <steve.dower@python.org>
2025-05-27 17:38:30 +02:00
Mark Shannon
f6f4e8a662
GH-132554: "Virtual" iterators (GH-132555)
* FOR_ITER now pushes either the iterator and NULL or leaves the iterable and pushes tagged zero

* NEXT_ITER uses the tagged int as the index into the sequence or, if TOS is NULL, iterates as before.
2025-05-27 15:59:45 +01:00
Victor Stinner
9300a596d3
gh-134744: Fix fcntl error handling (#134748)
Fix also reference leak on buffer overflow.
2025-05-27 15:09:46 +02:00
Wulian233
176b059fa0
Update README.rst informations from 3.14 to 3.15 (#134649)
Co-authored-by: Wulian233 <1055917385@qq.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-05-27 12:45:54 +00:00
Bénédikt Tran
30dde1eeb3
gh-133579: consistently report C curses function failures (#134327)
Some curses module-level functions and window methods now raise
a `curses.error` when a call to a C curses function fails:

- Module-level functions: assume_default_colors, baudrate, cbreak,
  echo, longname, initscr, nl, raw, termattrs, termname, and unctrl.
- Window methods: addch, addnstr, addstr, border, box, chgat,
  getbkgd, inch, insstr, and insnstr.

In addition, `curses.window.refresh` and `curses.window.noutrefresh`
now raise a `TypeError` instead of a `curses.error` when called with an
incorrect number of arguments for pads.

See also ee36db5500 for similar
changes.
2025-05-27 10:15:16 +00:00
Bénédikt Tran
604f83550b
gh-134210: refactor signal handling in _curses.window.{get_wch,getkey} (#134646) 2025-05-27 10:57:41 +02:00
Bénédikt Tran
51762b6cad
gh-134210: handle signals in _curses.window.getch (#134326) 2025-05-27 10:51:05 +02:00
Eric V. Smith
579686d9fb
gh-134752: Improve speed of test_tokenize.StringPrefixTest.test_prefixes. (#134766) 2025-05-27 04:49:28 -04:00
Bénédikt Tran
737b4ba020
gh-134635: add zlib.{adler32,crc32}_combine to combine checksums (#134650) 2025-05-27 10:48:34 +02:00
Miro Hrončok
8704d6b391
gh-62824: Adjust test_alias_modules_exist test to use imports instead of file checks (#134777) 2025-05-27 10:25:12 +02:00
Shamil
92ea1eb38f
gh-134664: document cleanup_socket parameter in asyncio.start_unix_server (#134750) 2025-05-27 08:23:06 +00:00
Emma Smith
9bf03c6c30
gh-134583: Update devcontainer reference to include image with libzstd-devel (gh-134765)
Update devcontainer reference
2025-05-27 10:24:38 +09:00
neonene
96905bdd27
gh-134160: Use multi-phase init in documentation examples (#134296)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-26 21:43:35 +00:00
Kumar Aditya
3c0525126e
gh-134637: Fix performance regression in calling ctypes function pointer in free threading. (#134702)
Fix performance regression in calling `ctypes` function pointer in `free threading`.
2025-05-26 18:26:40 +00:00
Eric Snow
56743afe87
gh-132775: Unrevert "Use _PyCode GetScriptXIData()" (gh-134735)
This reverts commit 8a793c4a36, AKA gh-134599.

This effectively re-applies commit 09e72cf (gh-134511)
2025-05-26 11:50:10 -06:00
Eric V. Smith
08c78e02fa
gh-134675: Add t-string prefixes to tokenizer module, lexical analysis doc, and add a test to make sure we catch this error in the future. (#134734)
* Add t-string prefixes to _all_string_prefixes, and add a test to make sure we catch this error in the future.

* Update lexical analysis docs for t-string prefixes.
2025-05-26 13:49:39 -04:00
neonene
c60f39ada6
gh-134557: Suppress immortalization in _PyCode_GetScriptXIData under free-threading (gh-134686)
Disable immortalization around Py_CompileString*().

The same approach as 332356b that fixed the refleaks in compile() and eval().

E: 09e72cf can pass test_capi, test_sys and test__interpchannels with this patch for me.
2025-05-26 11:46:49 -06:00
Hugo van Kemenade
b8a885ce63
Add CODEOWNERS and YAML to end-of-file-fixer and trailing-whitespace (#134730)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-26 18:42:38 +01:00
Jelle Zijlstra
7291eaba8b
gh-119180: Updates to PEP 649/749 docs (#134640)
- Mention (again) that `type.__annotations__` is unsafe. It is now safe
  when using only classes defined under PEP 649 semantics, but not with
  classes defined using `from __future__ import annotations`.
- Mention that annotations on instances no longer work. There was already
  an issue about this.
- Mention the general changes in the "Porting to Python 3.14" section.
- `annotationlib` was proposed by PEP-749, not PEP-649.

Co-authored-by: Emma Smith <emma@emmatyping.dev>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2025-05-26 08:35:04 -07:00
sobolevn
806107d7a2
gh-134693: Fix [-Wmaybe-uninitialized] warning in _remote_debugging_module.c (#134694) 2025-05-26 16:06:33 +01:00
Adam Turner
f2ce4bbdfd
gh-132983: Convert dict_content to take Py_buffer in `ZstdDict()` (#133924) 2025-05-26 14:48:41 +00:00
Pablo Galindo Salgado
7774869b1b
Add trailing line to CODEOWNERS (#134722) 2025-05-26 15:47:09 +01:00
Pablo Galindo Salgado
ce0561fa59
Add CODEOWNERS for remote debugging (#134720) 2025-05-26 14:36:30 +00:00
Pablo Galindo Salgado
0909d6d8e8
gh-91048: Add better error messages for remote debugging for CI builds (#134682) 2025-05-26 15:31:47 +01:00
Russell Keith-Magee
965662ee4a
gh-91048: Correct Apple platform includes for iOS. (#134712)
Correct Apple platform includes for iOS.
2025-05-26 12:44:41 +00:00
Bénédikt Tran
9eb84d83e0
gh-132710: add missing NEWS entry for GH-132901 (#134705) 2025-05-26 10:38:16 +00:00
Bénédikt Tran
cb8045e86c
gh-134531: cleanup _hashopenssl.c to support EVP_MAC (#134626)
Rename components related to `_hashlib.{HASH,HASHXOF}` objects.

- The `EVPobject` structure is renamed `HASHobject`.
- Non-clinic `HASH` methods are now prefixed by `_hashlib_HASH_*`.
  A similar change is made for non-clinic `HASHXOF` methods.
- Functions extracting information from `EVP_MD` objects and functions
  constructing `EVP_MD` objects now include `openssl_evp_md` in their name.

This change allows us to avoid future ambiguities between the `EVP_MD`
and the `EVP_MAC` APIs (currently, we only use `EVP_MD` for hash functions
and rely on the legacy interface for HMAC instead of using `EVP_MAC`).
2025-05-26 10:12:32 +00:00
tmlnv
71290a6fbe
gh-134559: Add versionadded for `object.__replace__()` (#134672) 2025-05-26 10:39:04 +01:00
Bénédikt Tran
3bffada467
gh-132710: only use stable _uuid.generate_time_safe() to deduce MAC address (#132901) 2025-05-26 10:56:31 +02:00
Bénédikt Tran
29e8115964
gh-134208: remove dead AC directives for _curses.window.{chgat,getstr,instr} (#134325) 2025-05-26 10:52:19 +02:00
Pieter Eendebak
fb09db1b93
gh-129594: Remove redundant check on varargs in _PyArg_CheckPositional (#129595) 2025-05-26 10:51:12 +02:00
Sergey B Kirpichev
cf8941c603
gh-132876: workaround broken ldexp() on Windows 10 (#133135)
* gh-132876: workaround broken ldexp() on Windows 10

ldexp() fails to round subnormal results before Windows 11,
so hide their bug.

Co-authored-by: Tim Peters <tim.peters@gmail.com>
2025-05-25 21:44:33 -05:00
Loïc Simon
0e3bc962c6
gh-69605: Disable PyREPL module autocomplete fallback on regular completion (gh-134181)
Co-authored-by: Loïc Simon <loic.simon@napta.io>
2025-05-26 01:05:08 +02:00
R. David Murray
a32ea45699
gh-134152: Fix UnboundLocalError in email._header_value_parser _get_ptext_to_endchars (#134233)
Fix an UnboundLocalError that can occur when parsing certain delimited constructs in headers (domain literals, quoted strings, comments). After the fix the _get_ptext_to_endchars returns an empty string if there is no content after the opening delimiter. The calling code is responsible for handling the lack of the trailing delimiter, which it already does; this edge case was the header ending immediately after the opening delimiter.
2025-05-25 18:09:32 -04:00
Pablo Galindo Salgado
7b1a700231
Heavily comment Python/perf_jit_trampoline.c to improve maintainability (#134527)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2025-05-25 21:37:15 +01:00
Pablo Galindo Salgado
42b25ad4d3
gh-91048: Refactor and optimize remote debugging module (#134652)
Completely refactor Modules/_remote_debugging_module.c with improved
code organization, replacing scattered reference counting and error
handling with centralized goto error paths. This cleanup improves
maintainability and reduces code duplication throughout the module while
preserving the same external API.

Implement memory page caching optimization in Python/remote_debug.h to
avoid repeated reads of the same memory regions during debugging
operations. The cache stores previously read memory pages and reuses
them for subsequent reads, significantly reducing system calls and
improving performance.

Add code object caching mechanism with a new code_object_generation
field in the interpreter state that tracks when code object caches need
invalidation. This allows efficient reuse of parsed code object metadata
and eliminates redundant processing of the same code objects across
debugging sessions.

Optimize memory operations by replacing multiple individual structure
copies with single bulk reads for the same data structures. This reduces
the number of memory operations and system calls required to gather
debugging information from the target process.

Update Makefile.pre.in to include Python/remote_debug.h in the headers
list, ensuring that changes to the remote debugging header force proper
recompilation of dependent modules and maintain build consistency across
the codebase.

Also, make the module compatible with the free threading build as an extra :)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-25 20:19:29 +00:00
Hugo van Kemenade
328a778db8
gh-134357: Remove unused imports in tests (#134340) 2025-05-25 20:09:02 +00:00
Julien Palard
24a47155d2
Fix sphinx-lint warnings (default-role used). (GH-134647) 2025-05-25 21:22:52 +02:00
Chris Eibl
1000283694
GH-130328: Fix WindowsConsoleGetEventTests after gh-133728 (gh-134660) 2025-05-25 20:17:13 +02:00
Jelle Zijlstra
57fef27cfc
gh-133960: Improve typing.evaluate_forward_ref (#133961)
As explained in #133960, this removes most of the behavior differences with ForwardRef.evaluate.
The remaining difference is about recursive evaluation of forwardrefs; this is practically useful
in cases where an annotation refers to a type alias that itself is string-valued.

This also improves several edge cases that were previously not handled optimally. For example,
the function now takes advantage of the partial evaluation behavior of ForwardRef.evaluate() to
evaluate more ForwardRefs in the FORWARDREF format.

This also fixes #133959 as a side effect, because the buggy behavior in #133959 derives from
evaluate_forward_ref().
2025-05-25 17:26:39 +00:00
Jelle Zijlstra
b51b08a0a5
annotationlib docs: note that ForwardRef.evaluate eventually defaults to empty globals (#134661) 2025-05-25 17:23:28 +00:00