Commit graph

131499 commits

Author SHA1 Message Date
Sergey B Kirpichev
0851700a9d
gh-119949: Refactor test_exc() helper in test_format.py (GH-135452)
Use assertRaisesRegex() context and fix
https://github.com/python/cpython/pull/119781#pullrequestreview-2088240959

* address review: minimize diff
2026-05-24 10:24:59 +00:00
siliconforks
a38804bb98
gh-148444: Use "zero of any numeric type" instead of "numeric zero of all types" (#148455) 2026-05-24 12:52:13 +05:30
Eduardo Villalpando Mello
55718cb6ed
gh-150244: Fix test_create_subprocess_env_shell to handle PATH with spaces (#150281) 2026-05-24 12:15:56 +05:30
Eduardo Villalpando Mello
fad0674605
gh-150258: Show relative percentage on Tachyon flamegraph (#150266)
When running profiling, users rarely care about the global percentage of
the runtime. Often, they want to select a function and measure child
percentages relative to that.

This PR updates the flamegraph tooltips to show both "Percentage" and
"Relative Percentage" when the user clicks a specific function.
2026-05-23 08:31:26 -04:00
stratakis
b0a149a8c6
gh-149800: Split perf trampoline assembly into per-architecture files (#149894) 2026-05-23 08:03:52 -04:00
Pieter Eendebak
dfeeee990b
gh-145192: improve performance of PySequence_GetSlice (#145193) 2026-05-23 15:45:50 +05:30
Kumar Aditya
e8545ed3ea
gh-149816: add missing critical section on self in buffered_iternext (#150295) 2026-05-23 08:57:13 +00:00
deadlovelll
1b20d1933f
gh-150116 Remove dead try/except in asyncio.Lock._wake_up_first (#150117) 2026-05-23 14:16:52 +05:30
pengyu lee
32823af153
gh-150178: Fix refcount leaks in hamt allocation failure paths (#150179) 2026-05-23 14:03:40 +05:30
Hai Zhu
e7eaed5614
gh-148450: abc.register needs to update type_version when tp_flags is changed (#148623) 2026-05-23 13:55:44 +05:30
My-ABC
82191c6d2c
gh-150232: update Thread group parameter doc (#150283) 2026-05-23 13:52:44 +05:30
Victor Stinner
a7d5a6cc17
gh-150114: Log the memory usage in regrtest on Windows (#150267)
Add _winapi.GetProcessMemoryInfo() function.

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
2026-05-23 00:04:51 +02:00
Omkar Kabde
9df2b6ccc7
gh-82907: Document mtime=0 for reproducible tarfile gzip output (GH-150269) 2026-05-22 21:02:56 +00:00
Victor Stinner
4e3ead92ca
gh-150114: Log the memory usage in regrtest in sequential mode (#150264) 2026-05-22 22:26:15 +02:00
Victor Stinner
b770b2350e
Revert "gh-146452: Improve locking granularity in pickle's batch_dict_exact and fix race condition (#150025)" (#150261)
This reverts commit 57a0e570d3.
2026-05-22 22:22:47 +02:00
Hugo van Kemenade
de7c3bfd5b
gh-149189: Revert "Modern defaults for pprint (#149190)" (#150249) 2026-05-22 23:22:03 +03:00
Victor Stinner
e020836fd4
gh-149879: Fix test_capi on Cygwin (#150252)
Fix Test_Pep523AllowSpecialization tests of test_capi.test_misc.

On Cygwin, _PyEval_EvalFrameDefault in _testinternalcapi is not the
same as _PyEval_EvalFrameDefault in python.exe. So pass NULL
explicitly to use the default function (_PyEval_EvalFrameDefault).
2026-05-22 21:47:32 +02:00
Victor Stinner
8115360153
gh-149879: Fix test_c_stack_unwind on Cygwin (#150084)
On Cygwin, the Python library is called "cygpython3.16.dll".
2026-05-22 21:32:44 +02:00
Victor Stinner
00c80df8cc
gh-149879: Fix test__locale on Cygwin (#150248)
On Cygwin with the LC_TIME locale "ja_JP", nl_langinfo(ALT_DIGITS)
returns 101 items instead of 100.
2026-05-22 21:31:12 +02:00
Victor Stinner
1d28f9aade
gh-150114: Log the memory usage in regrtest (#150255)
On Linux, log the total memory usage of all Python test processes.
Read the private memory in /proc/pid/smaps.
2026-05-22 19:05:45 +02:00
Brett Cannon
c7cab734ee
Remove 'expat' dependency for Linux in Misc/Brewfile (#150118) 2026-05-22 17:21:16 +03:00
Victor Stinner
55561b5f86
gh-149879: Fix test_c_locale_coercion on Cygwin (#150250) 2026-05-22 15:47:38 +02:00
Marin Misur
cf5c8c5698
gh-91372: Add mtime to gzip.open() (GH-32310) 2026-05-22 15:14:25 +03:00
Mia Albert
9604fa8c00
gh-149902: Remove dead packaging docs link and add a new section for external resources (#150030)
Co-authored-by: Stan Ulbrych <stan@python.org>
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-05-22 14:32:14 +03:00
Serhiy Storchaka
28eac9a726
gh-137571: Protect against possible UnboundLocalError in gzip._GzipReader.read() (GH-150222)
This has not been observed in practice, but we cannot be 100% sure that
it will not happen with some weird gzip data.
2026-05-22 12:17:34 +03:00
adang1345
1daad8a163
gh-133998: Fix gzip file creation when time is out of range (GH-134278)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-22 10:20:08 +03:00
Jelle Zijlstra
f159419ae2
gh-149995: Update typing.py docstrings and documentation (#149996)
Some of these docstrings read as if they were written when typing.py was
first written, and things have evolved since then.

A few motivations:
- Call protocols protocols instead of ABCs. They are also ABCs, but the fact
  they are protocols is more relevant to typing.
- Avoid recommending direct use of .__annotations__ and steer users to
  annotationlib instead.
- For TypedDict, mention NotRequired before total=False since it is more
  general and probably more frequently useful.
- For overloads, mention runtime use first instead of stub use. I think early on
  there was talk of allowing overload only in stubs, but it is now heavily used at
  runtime too and that's more likely to be relevant to users.
2026-05-21 21:06:42 -07:00
sendaoYan
c613f72eee
gh-148294: Make configure find g++ correctly (GH-148298)
The `AC_PATH_TOOL` calls had included a duplicated argument, causing a "`PATH`"
consisting of `notfound` to be searched instead of `$PATH`.
2026-05-22 01:46:41 +00:00
Barry Warsaw
3c298e2e38
gh-149819: fix .pth and .start file processing in subprocess when inheriting PYTHONPATH (#150177)
* gh-149819: Fix .pth files not loaded in Python subprocesses

After PR gh-149583 (Fix double evaluation of .pth and .site files in
venvs), .pth files are no longer loaded in subprocesses started with
subprocess.run([sys.executable, ...]).  The root cause: main() seeds
known_paths from removeduppaths() with all sys.path entries inherited
from the parent process.  addsitedir() then skips .pth processing for
every directory already in known_paths.

Fix:
- main(): call removeduppaths() for dedup but start known_paths as a
  fresh empty set, so that addsitedir() processes .pth files in every
  site-packages directory regardless of inherited sys.path.
- addsitedir(): move known_paths.add() before the sys.path.append and
  guard the append with 'sitedir not in sys.path' to avoid creating
  duplicate entries when called with a fresh known_paths.

This preserves the gh-75723 dedup guarantee while allowing subprocesses
to load .pth files.

* Fill out the tests for GH#149888

* Extend _make_start() and _make_pth() to take an optional `basedir` which is used instead of
 `site.tmpdir` if given.
* Add test_pth_processed_when_sitedir_already_on_path() to test the core GH#149819 bug: .pth files
  in subprocesses aren't handled if PYTHONPATH pointing to the .pth directory is inherited.
* Similarly add test_start_processed_when_sitedir_already_on_path() to verify that .start files in
  the same circumstances are also now processed.

* Update Lib/site.py

Co-authored-by: scoder <stefan_ml@behnel.de>

* Oops!  Remove redundant code

---------

Co-authored-by: BugBounty Mind <bugbounty-mind@deepseek.tui>
Co-authored-by: scoder <stefan_ml@behnel.de>
2026-05-21 21:44:13 +00:00
Nadeshiko Manju
65f99329ed
gh-107398: Fix tarfile stream mode exception when process the file with the gzip extra field (GH-126304)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-21 19:12:09 +00:00
Stan Ulbrych
32104a11e3
Remove accidentally added Python/deepfreeze/deepfreeze.c (gh-150192) 2026-05-21 12:37:49 -04:00
Hai Zhu
0828782773
gh-149358: Generating JIT recorder transformers and stabilizing family layouts (GH-149359) 2026-05-21 17:06:52 +01:00
Hai Zhu
441af3a934
gh-149335: Avoid JIT trace buffer asserts with overhead above FITNESS_INITIAL (GH-149633) 2026-05-21 15:57:31 +01:00
Pieter Eendebak
f2fa291db8
gh-148871: Add CONSTANT_EMPTY_TUPLE to LOAD_COMMON_CONSTANT (GH-149688) 2026-05-21 15:54:46 +01:00
sobolevn
c35b0f2b62
gh-149219: Test frozendict in Lib/test/test_crossinterp.py (#149220) 2026-05-21 12:28:38 +03:00
sobolevn
6dbf4ba403
gh-149981: Test lazy import corner cases with module-level __getattr__ (#149982) 2026-05-21 12:21:45 +03:00
saisneha196
388e023fe1
gh-150175: Fix ThreadingMock call_count race condition (#150176)
ThreadingMock._increment_mock_call() was not thread-safe.
Multiple threads calling the mock simultaneously could lose
increments due to race conditions on call_count and other
attributes.

Fix by overriding _increment_mock_call in ThreadingMixin
and wrapping it with the existing _mock_calls_events_lock.
2026-05-21 08:38:07 +01:00
Jason R. Coombs
cb3b4b98d8
gh-143387: Add news blurb for importlib.metadata highlighting the change. (#150169) 2026-05-20 12:40:15 -07:00
Stan Ulbrych
87a879f4d0
Add summary table to the unicodedata doc (#149957) 2026-05-20 16:04:10 +01:00
sobolevn
f621ba16b7
gh-150146: Fix NULL dereference in _Py_subs_parameters (#150147) 2026-05-20 16:27:55 +03:00
Pablo Galindo Salgado
661df25692
gh-149584: Fix excessive overhead in the Tachyon profiler regarding the cache behavior (#149649)
Use exact remote reads for interpreter state, thread state, and
interpreter frame structs instead of pulling full remote pages into the
profiler page cache. This matches the core change from
python/cpython#149585.

The profiler clears the page cache between samples, so live entries are
always packed at the front. Track the live count and only clear/search
that prefix instead of scanning all 1024 slots on the hot path.

Use the frame cache to predict the next thread state and top frame
address, then batch interpreter/thread/frame reads with process_vm_readv
when profiling a Linux target. Reuse prefetched frame buffers in the
frame walker when the prediction is valid.

Cache the last FrameInfo tuple per code object/instruction offset, reuse
cached thread id objects, and append cached parent frames directly on
full frame-cache hits. This cuts Python allocation churn in the
steady-state profiler path.
2026-05-20 04:32:08 -07:00
László Kiss Kollár
06a2830aa8
gh-150034: Print JSONL filename when profiling finishes (#150035) 2026-05-20 04:29:48 -07:00
Victor Stinner
244300162d
gh-149807: Fix hash(frozendict): compute (key, value) pair hash (#149841) 2026-05-20 13:22:57 +02:00
Victor Stinner
df6c157e51
gh-148260: Use at least 1 MiB stack size on musl (#149993)
On Linux when Python is linked to the musl C library, use a thread
stack size of at least 1 MiB instead of musl default which is 128
kiB.
2026-05-20 13:21:59 +02:00
Matt Van Horn
d948eaa366
gh-146406: add clear() cross-language hint for immutable types (GH-149927) 2026-05-19 23:01:15 -04:00
Caleb
9dcf94e906
gh-134261: ZipFile - Don't rely on local time for reproducible builds & tests (#134264)
---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Emma Smith <emma@emmatyping.dev>
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2026-05-20 01:36:19 +00:00
Tim Stumbaugh
de9c32fc34
PEP 810 - Update some error strings (#150126) 2026-05-20 00:47:44 +00:00
Pablo Galindo Salgado
1f3c2679f1
gh-149321: Remove lazy_imports=none startup mode (#149389) 2026-05-19 16:01:15 -07:00
larryhastings
79088e0d82
gh-150042: queue.SimpleQueue.put: fix minor refleak. (GH-150043)
If queue.SimpleQueue.put can't handoff the item to a
waiting thread, and fails to allocate memory when adding
the item to a ringbuf, it would leak a reference.  Fixed.
2026-05-20 00:27:04 +02:00
Alexey Katsman
d095ceb0f4
gh-149816: Fix UAF in Modules/_pickle.c (GH-150024)
Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2026-05-20 00:11:17 +02:00