Commit graph

34674 commits

Author SHA1 Message Date
Sam Gross
71126ab19c
gh-129441: Fix some flakiness in test_instrumentation (gh-141881)
Most of the `self.assertTrue(self.called)` checks are flaky because
the worker threads may sometimes finish before the main thread calls
`self.during_threads()`.
2025-11-24 11:19:07 -05:00
Pablo Galindo Salgado
04e3670f6b
gh-138122: Fix permission error detection in tachyon's test (#141897) 2025-11-24 14:32:17 +00:00
Petr Viktorin
bf66bce4ee
gh-141780: Make PyModule_FromSlotsAndSpec enable GIL if needed (GH-141785) 2025-11-24 13:26:35 +01:00
Pablo Galindo Salgado
3eec46d3c3
gh-138122: Refactor the CLI of profiling.sampling into subcommands (#141813) 2025-11-24 11:45:08 +00:00
Duane Griffin
425f24e4fa
gh-135335: Simplify preload regression test using __main__ (GH-138686)
Simplify preload regression test using `__main__`

With the fix for gh-126631 `__main__` modules can be preloaded and the regression
test for gh-135335 can be simplified to just use a self-contained script rather
than requiring a module.

Note this assumes and implicitly tests that `__main__` is preloaded by default.
2025-11-23 15:37:15 -08:00
Sam Gross
e457d60daa
gh-120158: Fix inconsistent monitoring state when setting events too frequently (gh-141845)
If we overflowed the global version counter (i.e., after 2*24 calls to
`_PyMonitoring_SetEvents`), we bailed out after setting global monitoring
events but before instrumenting code objects, which led to assertion errors
later on.

Also add a `time.sleep()` to `test_free_threading.test_monitoring` to avoid
overflowing the global version counter.
2025-11-23 10:07:17 -05:00
Hugo van Kemenade
e73fbbacbb
gh-141679: Add colour to defaults in argparse help (#141680)
Co-authored-by: Savannah Ostrowski <savannah@python.org>
2025-11-23 00:26:50 +00:00
Brandt Bucher
227b9d326e
GH-140638: Add a GC "candidates" stat (GH-141814) 2025-11-22 21:59:14 +00:00
Serhiy Storchaka
425fd85ca3
gh-138525: Support single-dash long options and prefix_chars in BooleanOptionalAction (GH-138692)
-nofoo is generated for -foo.
++no-foo is generated for ++foo.
/nofoo is generated for /foo.
2025-11-22 20:54:02 +00:00
Andrew J. Hesford
08477dbf30
gh-141600: Fix musl version detection on Void Linux (GH-141602) 2025-11-22 12:17:40 -06:00
Semyon Moroz
5c25bc5763
gh-131178: Add tests for pickletools command-line interface (#131287) 2025-11-22 19:17:06 +02:00
Yongzi Li
dc9d2eea58
gh-141833: Remove the bad lines in test_attr_promotion_failure (GH-141841) 2025-11-23 00:27:05 +08:00
Pablo Galindo Salgado
92972aea0f
gh-140381: Make test_profiling tests deterministic to fix flakiness (#141731) 2025-11-21 21:36:30 +00:00
Sam Gross
2d50dd242e
gh-137422: Fix race condition in PyImport_AddModuleRef (gh-141822) 2025-11-21 13:30:33 -05:00
Cody Maloney
019c315a8e
gh-129559: add bytearray.resize thread safety test for free-threading (#141739) 2025-11-21 23:42:22 +05:30
Mikhail Efimov
a3b78a3ade
gh-141498: Change backoff counter to use prime numbers instead of powers of 2 (GH-141591) 2025-11-21 17:00:25 +00:00
Alper
fb26d9c2ef
gh-116738: Make csv module thread-safe (gh-141365)
Added a critical section to protect the states of `ReaderObj` and `WriterObj` in the free-threading build. Without the critical sections, both new free-threading tests were crashing.
2025-11-21 11:22:31 -05:00
Paresh Joshi
f15f6d0ba3
gh-141612: improve test_trampoline_works_with_forks coverage (#141613) 2025-11-21 16:01:26 +00:00
Pablo Galindo Salgado
07410da204
gh-141645: Refactor tachyon's live TUI tests to not use private fields (#141806) 2025-11-21 00:35:37 +00:00
Serhiy Storchaka
77cb39e0c7
gh-138697: Fix inferring dest from a single-dash long option in argparse (#138699)
* gh-138697: Fix inferring dest from a single-dash long option in argparse

If a short option and a single-dash long option are passed to add_argument(),
dest is now inferred from the single-dash long option.

* Make double-dash options taking priority over single-dash long options.

---------

Co-authored-by: Savannah Ostrowski <savannah@python.org>
2025-11-20 18:41:58 +00:00
Pablo Galindo Salgado
b3383085f9
gh-141645: Add a TUI mode to the new tachyon profiler (#141646) 2025-11-20 18:27:17 +00:00
Cody Maloney
e90061f5f1
gh-60107: Remove a copy from RawIOBase.read (#141532)
If the underlying I/O class keeps a reference to the memory, raise BufferError.

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-11-20 17:37:04 +00:00
Arseny Boykov
41b9ad5b38
gh-141757: Comply with pickle protocol in test_reduce_5tuple (GH-141759)
The 5th element of the __reduce__ tuple should be an iterator.
2025-11-20 10:57:05 +02:00
Cody Maloney
e265ce8a56
gh-139871: Optimize small takes in bytearray.take_bytes (GH-141741)
When less than half the buffer is taken just copy that small part out
rather than doing a big alloc + memmove + big shrink.
2025-11-20 08:49:05 +01:00
Tian Gao
bc9b9d47f9
gh-141615: Check stdin instead of stdout for use_rawinput in pdb (#141616) 2025-11-19 18:41:25 -08:00
Alex Crichton
9b69a55be3
gh-141172: Update to wasi-sdk-29 (GH-141684)
This commit updates CI and configuration from wasi-sdk-25 to wasi-sdk-29
which was released recently. This notably includes stubs for pthreads
which all return errors, so some adjustment in logic is necessary to
retain knowledge that WASI cannot yet spawn threads for example.

This additionally increases the wasm stack allowance to 32MiB from 16MiB
to accomodate the `test_recursive_pickle` test in the
`test_functools.py` file. It looks like the Clang/LLVM update that
happened in wasi-sdk-29 relative to wasi-sdk-25 is likely the cause of
this where presumably functions have more locals than before and/or a
slightly adjusted stack space requirement which overflows the stack.
2025-11-19 10:03:30 -08:00
Serhiy Storchaka
4bcab461c2
gh-41779: Allow defining the __dict__ and __weakref__ __slots__ for any class (GH-141755) 2025-11-19 17:11:37 +00:00
Brandt Bucher
598d4c64de
GH-140638: Add a GC "duration" stat (GH-141720) 2025-11-19 08:51:39 -08:00
Miro Hrončok
96f496a949
gh-141570: can_colorize: Expect fileno() to raise OSError, as documented (#141716)
In Fedora, we've been given a slightly incomplete reproducer for a problematic
Python 3.14 color-related change in argparse that leads to an exception when
Python is used from mod_wsgi: https://bugzilla.redhat.com/2414940

mod_wsgi replaces sys.stdout with a custom object that raises OSError on .fileno():

8460dbfcd5/src/server/wsgi_logger.c (L434-L440)

This should be supported, as the documentation of fileno explicitly says:

> An OSError is raised if the IO object does not use a file descriptor.

https://docs.python.org/3.14/library/io.html#io.IOBase.fileno

The previously expected exception inherits from OSError,
so it is still expected.

Fixes https://github.com/python/cpython/issues/141570

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-11-19 15:02:52 +01:00
Petr Viktorin
e2178743fe
gh-135953: Avoid BytesWarning when sampling profiler tests fail (GH-141719)
With `-bb`, this failed on BytesWarning: str() on a bytes instance
2025-11-19 14:43:42 +01:00
Serhiy Storchaka
95296a9d40
gh-140875: Fix handling of unclosed charrefs before EOF in HTMLParser (GH-140904) 2025-11-19 13:55:10 +02:00
da-woods
afa0badcc5
gh-141726: Add PyDict_SetDefaultRef() to the Stable ABI (#141727)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-19 11:38:10 +00:00
Thierry Martos
652c764a59
gh-140381: Increase slow_fibonacci call frequency in test_profiling (#140673) 2025-11-19 00:01:09 +00:00
Victor Stinner
600f3feb23
gh-141070: Add PyUnstable_Object_Dump() function (#141072)
* Promote _PyObject_Dump() as a public function.
* Keep _PyObject_Dump() alias to PyUnstable_Object_Dump()
  for backward compatibility.
* Replace _PyObject_Dump() with PyUnstable_Object_Dump().

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-11-18 16:13:13 +00:00
Pablo Galindo Salgado
a52c39e260
gh-135953: Refactor test_sampling_profiler into multiple files (#141689) 2025-11-18 15:14:16 +00:00
Cody Maloney
58f3fe0d9b
gh-129005: Remove copies from _pyio using take_bytes (#141539)
Memory usage now matches that of _io for large files.
2025-11-18 10:10:32 +01:00
Pablo Galindo Salgado
4867f717e2
gh-140729: Fix subprocess handling in test_process_pool_executor_pickle (#141688) 2025-11-18 02:26:40 +00:00
Krishna Chaitanya
6b1bdf6c7a
gh-141497: Make ipaddress.IP{v4,v6}Network.hosts() always returning an iterator (GH-141547) 2025-11-17 19:29:06 +02:00
Pablo Galindo Salgado
274a26cca8
gh-135953: Simplify GC markers in the tachyon profiler (#141666) 2025-11-17 16:32:08 +00:00
R.C.M
3d14805947
gh-130693: Support more options for search in tkinter.Text (GH-130848)
* Add parameters nolinestop and strictlimits in the tkinter.Text.search() method.
* Add the tkinter.Text.search_all() method.
* Add more tests for tkinter.Text.search().
* stopindex is now only ignored if it is None.
2025-11-17 14:42:26 +00:00
Stefano Rivera
f6dd9c12a8
GH-139914: Handle stack growth direction on HPPA (GH-140028)
Adapted from a patch for Python 3.14 submitted to the Debian BTS by John
https://bugs.debian.org/1105111#20

Co-authored-by: John David Anglin <dave.anglin@bell.net>
2025-11-17 14:41:22 +01:00
Brandt Bucher
336366fd7c
GH-140643: Add <native> and <GC> frames to the sampling profiler (#141108)
- Introduce a new field in the GC state to store the frame that initiated garbage collection.
- Update RemoteUnwinder to include options for including "<native>" and "<GC>" frames in the stack trace.
- Modify the sampling profiler to accept parameters for controlling the inclusion of native and GC frames.
- Enhance the stack collector to properly format and append these frames during profiling.
- Add tests to verify the correct behavior of the profiler with respect to native and GC frames, including options to exclude them.

Co-authored-by: Pablo Galindo Salgado <pablogsal@gmail.com>
2025-11-17 13:39:00 +00:00
Pablo Galindo Salgado
89a914c58d
gh-135953: Add GIL contention markers to sampling profiler Gecko format (#139485)
This commit enhances the Gecko format reporter in the sampling profiler
to include markers for GIL acquisition events.
2025-11-17 12:46:26 +00:00
yihong
994ab5c922
gh-140729: Add __mp_main__ as a duplicate for __main__ for pickle to work (#140735) 2025-11-17 12:43:14 +00:00
Stan Ulbrych
31ea3f3c76
gh-141018: Update .exe, .dll, .rtf and .jpg mime types in mimetypes (#141023) 2025-11-17 13:32:00 +02:00
Tian Gao
8be3b2f479
gh-136057: Allow step and next to step over for loops (#136160) 2025-11-16 13:57:07 -08:00
Tian Gao
5348c200f5
gh-125115 : Refactor the pdb parsing issue so positional arguments can pass through (#140933) 2025-11-16 10:58:28 -08:00
Ken Jin
ed73c909f2
gh-139109: JIT _EXIT_TRACE to ENTER_EXECUTOR rather than _DEOPT (GH-141573) 2025-11-15 20:19:41 +00:00
Pablo Galindo Salgado
4ceb077c5c
gh-141579: Fix perf_jit backend in sys.activate_stack_trampoline() (#141580) 2025-11-15 02:23:54 +00:00
Takuya UESHIN
53d65c840e
gh-136442: Fix unittest to return exit code 5 when setUpClass raises an exception (#136487) 2025-11-14 16:59:51 -08:00