Commit graph

131247 commits

Author SHA1 Message Date
Maurycy Pawłowski-Wieroński
c266f0c375
gh-149009: Validate thread_count in profiling.sampling binary reader (#149147) 2026-05-05 00:50:06 +00:00
Maurycy Pawłowski-Wieroński
04ce318522
gh-146256: Add --jsonl collector to the profiling.sampling (#146257) 2026-05-05 00:44:37 +00:00
Maurycy Pawłowski-Wieroński
f025dba62e
gh-149230: _remote_debugging: Fix async-aware for tasks in non-main threads (#149235) 2026-05-05 01:33:56 +01:00
Maurycy Pawłowski-Wieroński
6f8c964dc0
gh-149342: _remote_debugging: Fix binary profile corruption when sampling a (temporarily) empty stack (#149343) 2026-05-05 00:32:06 +00:00
Maurycy Pawłowski-Wieroński
9dca1ff759
gh-149300: _remote_debugging: clean up magic and duplicate consts in the binary format helper (#149301) 2026-05-05 01:31:53 +01:00
Pablo Galindo Salgado
9a268e3e33
gh-98894: Restore function entry/exit DTrace probes (#142397)
The function__entry and function__return probes stopped working in Python 3.11
when the interpreter was restructured around the new bytecode system. This change
restores these probes by adding DTRACE_FUNCTION_ENTRY() at the start_frame label
in bytecodes.c and DTRACE_FUNCTION_RETURN() in the RETURN_VALUE and YIELD_VALUE
instructions. The helper functions are defined in ceval.c and extract the
filename, function name, and line number from the frame before firing the probe.

This builds on the approach from https://github.com/python/cpython/pull/125019
but avoids modifying the JIT template since the JIT does not currently support
DTrace. The macros are conditionally compiled with WITH_DTRACE and are no-ops
otherwise. The tests have been updated to use modern opcode names (CALL, CALL_KW,
CALL_FUNCTION_EX) and a new bpftrace backend was added for Linux CI alongside
the existing SystemTap tests. Line probe tests were removed since that probe
was never restored after 3.11.
2026-05-05 00:29:55 +00:00
Pablo Galindo Salgado
8c796782fc
gh-146462: Add dict introspection debug offsets (#148633) 2026-05-04 23:00:23 +00:00
Hugo van Kemenade
ffe050ad9b
gh-142389: Add support for backtick colorisation in argparse help text (#149375)
Co-authored-by: Savannah Ostrowski <savannah@python.org>
2026-05-04 22:58:04 +00:00
Hugo van Kemenade
ef6f0635ce
gh-142389: Add backticks to stdlib argparse help to display in colour (#149384)
Co-authored-by: Savannah Ostrowski <savannah@python.org>
2026-05-04 22:23:18 +00:00
Savannah Ostrowski
53a7f76501
GH-130750: Restore quoting of choices in argparse error messages to match documentation and improve clarity (#144983) 2026-05-04 21:51:48 +00:00
Matt Van Horn
7acee984e8
gh-146406: Add cross-language method suggestions for builtin AttributeError (#146407)
When Levenshtein-based suggestions find no match for an AttributeError
on list, str, or dict, check a static table of common method names from
JavaScript, Java, C#, and Ruby.

For example, [].push() now suggests .append(), "".toUpperCase() suggests
.upper(), and {}.keySet() suggests .keys().

The list.add() case suggests using a set instead of suggesting .append(),
since .add() is a set method and the user may have passed a list where
a set was expected (per discussion with Serhiy Storchaka, Terry Reedy,
and Paul Moore).

Design: flat (type, attr) -> suggestion text table, no runtime
introspection. Only exact builtin types are matched to avoid false
positives on subclasses.

Discussion: https://discuss.python.org/t/106632

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-04 21:38:07 +00:00
Sergey Miryanov
e89568f0cb
GH-148726: Add heap_size to generational GC (#149195) 2026-05-04 22:14:45 +01:00
Stéphane Bidoul
de66149f66
gh-149377: update bundled pip to 26.1.1 (#149378)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2026-05-04 19:58:28 +00:00
Pablo Galindo Salgado
12a20daee7
gh-149321: Fix stdlib imports with lazy imports disabled (#149338) 2026-05-04 19:03:21 +01:00
Serhiy Storchaka
bc285e5832
gh-138907: Support RFC 9309 in robotparser (GH-138908)
* empty lines are always ignored instead of separating groups
* the "user-agent" line after a rule starts a new group
* groups matching the same user agent are now merged
* the rule with the longest match wins instead of the first matching rule
* in case of equal matches, the “Allow” rule wins over “Disallow”
* special characters “$” and “*” are now supported in rules
* prefer full match for user agent
2026-05-04 18:03:11 +00:00
Charlie Lin
c74cba16a3
gh-145917: Add MIME types for TTC and Haptics formats (#145918)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Benedikt Johannes <benedikt.johannes.hofer@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2026-05-04 21:02:50 +03:00
Steve Dower
10f950c9bb
gh-148690: Build Windows freethreaded binaries into separate directory and include python3t.dll on GIL-enabled (GH-149218)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-05-04 17:45:08 +01:00
Neko Asakura
9846407eaf
gh-143732: add specialization for FOR_ITER (GH-148745) 2026-05-04 17:29:10 +01:00
Victor Stinner
952784af47
gh-137030: Fix YIELD_VALUE bytecode assertion (#149184)
Co-authored-by: Mark Shannon <mark@hotpy.org>
2026-05-04 18:09:57 +02:00
Petr Viktorin
6ca5cdba18
gh-149225: Expose Py_CriticalSection in Stable ABI (GH-149227) 2026-05-04 17:32:17 +02:00
Victor Stinner
5dd5c8b5a6
gh-148675: Remove F and D formats from array and memoryview (GH-149368) 2026-05-04 17:26:30 +02:00
Kit Dallege
b8ebd078f9
gh-137337: Clarify import statement namespace binding (GH-144607)
It is not always in the local namespace.
2026-05-04 17:45:00 +03:00
Victor Stinner
1e21cf6fee
gh-148292: Remove shutdown() test in test_ssl.test_got_eof() (#149366)
The shutdown() behavior depends too much on the operating system and
it's unrelated to the got_eof_error change.
2026-05-04 14:20:25 +00:00
Victor Stinner
6e6f9053e3
gh-148675: Add Zd/Zf formats to array, ctypes, memoryview, struct (#148676)
* Add Zd/Zf format support to array, memoryview and struct.
* ctypes: Replace F/D/G complex format with Zf/Zd/Zg.
* Modify array, ctypes and struct modules to support format strings
  longer than 1 character (such as "Zd").
* Change array.typecodes type from str to tuple.
2026-05-04 16:14:23 +02:00
Maurycy Pawłowski-Wieroński
72f29dc704
gh-147998: Fix possible memory leak in _pop_preserved (crossinterp.c) (GH-147999) 2026-05-04 16:45:31 +03:00
Alyssa Coghlan
5235467b91
gh-149010: Improve reliability of inspect CLI (#149357)
* Handle non-source modules more gracefully (and consistently)
* Improve handling of frozen modules (which may or may not have source)
* Avoid reporting misleading info when looking up objects via aliases
* Refactor CLI implementation to improve testability
* Add several more test cases

Closes #149010
2026-05-04 23:42:20 +10:00
Wulian233
c3972f2795
gh-148418: Fix a possible reference leak in a corrupted TYPE_CODE marshal stream (GH-148419) 2026-05-04 16:42:02 +03:00
Victor Stinner
ce51c18818
gh-146063: Add PyObject_CallFinalizerFromDealloc() to the limited C API (#146172)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-05-04 15:37:45 +02:00
Victor Stinner
fc96028191
gh-148600: Add OpenSSL 4.0.0 support to test configurations (#149356)
Co-authored-by: Charlie Lin <tuug@gmx.us>
2026-05-04 16:21:04 +03:00
wouter bolsterlee
7aedd0a6c6
gh-87245: Improve IPv6Address.ipv4_mapped documentation (#92572)
Avoid the phrasing ‘starting with ::FFFF/96’, which is confusing since
it seems to mix a prefix and a range. Instead, make it clear what the
actual range is, and refer to the relevant RFC.

Closes #87245.
2026-05-04 23:03:20 +10:00
Hugo van Kemenade
2ba0a81c91
gh-148352: Add more colour to calendar CLI output (#148354)
Co-authored-by: Rihaan Meher <sharktidedev@gmail.com>
2026-05-04 15:14:57 +03:00
Ned Deily
1504bd671e
gh-149351: Avoid possible broken macOS framework install names when DESTDIR is specified during builds (#149352) 2026-05-04 07:55:06 -04:00
Victor Stinner
7b7fa3f9bf
gh-148292: Update _ssl._SSLSocket for OpenSSL 4 (#149102)
The _SSLSocket object now remembers if it gets an EOF error. In this
case, read(), sendfile(), write() and do_handshake method calls fail
with SSLEOFError without calling the underlying OpenSSL function.

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2026-05-04 13:52:57 +02:00
Petr Viktorin
bc7c102f34
gh-149231: tomllib: Limit the number of parts in a key (GH-149233)
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-05-04 13:49:07 +02:00
kishorhange111
246fe14e7c
gh-148849: Deprecate http.cookies.BaseCookie.js_output() (GH-148978) 2026-05-04 12:51:17 +03:00
Maurycy Pawłowski-Wieroński
0c6d2f64c0
gh-148093: Raise binascii.Error from binascii.a2b_uu() on empty input (GH-149077)
Instead of reading past the end of the empty buffer.
2026-05-04 12:40:52 +03:00
Hugo van Kemenade
35061259cc
gh-146609: Use argparse for colour help timeit CLI (#149334)
Co-authored-by: Stan Ulbrych <stan@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-05-04 08:44:37 +00:00
Kumar Aditya
5847931d11
gh-143732: allow dict subclasses to be specialized (GH-148128) 2026-05-04 09:39:03 +01:00
Hugo van Kemenade
de1769f700
gh-142389: Add colour to regrtest and pdb's help descriptions (#149332) 2026-05-04 10:20:23 +03:00
Pablo Galindo Salgado
3efd2f4db6
gh-149296: Add dump subcommand to sampling profiler for one-shot stack snapshots (#149297)
Adds `python -m profiling.sampling dump <pid>`, which prints a single
traceback-style snapshot of a running process's Python stack via the
existing `_remote_debugging` unwinder. Supports per-thread status,
source line highlighting, optional bytecode opcodes, and async-aware
task reconstruction (`--async-aware`, default `--async-mode=all`).
2026-05-04 01:02:33 +01:00
Kai (Kazuya Ito)
2e94f14310
gh-145521: Add 'infer_variance' parameter to ParamSpec class (#145522) 2026-05-03 23:08:38 +00:00
Tamika Nomara
4144062387
gh-133956 fix bug where dataclass wouldn't detect ClassVar fields if ClassVar was re-exported from a module other than typing (#140541)
Co-authored-by: Dmitrii Zherbin <zherbin.dima@yandex.ru>
2026-05-03 15:59:18 -07:00
Zachary Ware
68fe899feb
gh-149254: Update CI to use latest OpenSSL and AWS-LC versions (GH-149330)
Also update Modules/_ssl_data_36.h to include an added symbol from OpenSSL 3.6.2.
2026-05-03 20:20:51 +00:00
Zachary Ware
d254d6ee49
gh-149254: Update Windows builds to use OpenSSL 3.5.6 (GH-149326) 2026-05-03 15:04:30 -05:00
Barry Warsaw
24c4aecc16
gh-148641: Implement PEP 829 - startup configuration files (#149109)
Implement PEP 829 - startup configuration files
Also add `pkgutil.resolve_name(..., strict=True)` 

Co-authored-by: Brett Cannon <brett@python.org>
2026-05-03 17:17:29 +00:00
Hugo van Kemenade
0bf6e31941
gh-135056: Fix teardown order for Windows in test_httpservers (#149320) 2026-05-03 19:42:42 +03:00
Anton Ian Sipos
836fbdaaf3
gh-135056: Add a --header CLI option to http.server (#135057)
Support custom headers in `python -m http.server` and `http.server.SimpleHTTPRequestHandler`.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-05-03 13:01:37 +02:00
sobolevn
726a17e265
gh-149243: Check for recursion limits in CALL_ALLOC_AND_ENTER_INIT (#149310) 2026-05-03 13:26:05 +03:00
Serhiy Storchaka
a3435d5ccc
gh-143231: Do not swallow not matched warnings in assertWarns*() (GH-149229)
unittest.TestCase methods assertWarns() and assertWarnsRegex() no longer
swallow warnings that do not match the specified category or regex.
Nested context managers are now supported.
2026-05-03 10:24:57 +00:00
Wulian233
8a7eddaa84
gh-149217: Avoid adding dependencies on immutable, immortal classes in the JIT (GH149256) 2026-05-03 11:06:39 +01:00