Commit Graph

121232 Commits

Author SHA1 Message Date
Michael Droettboom cef0ec1a3c
gh-116760: Fix pystats for trace attempts (GH-116761)
There are now at least two bytecodes that may attempt to optimize,
JUMP_BACK, and more recently, COLD_EXIT.

Only the JUMP_BACK was counting the attempt in the stats.
This moves that counter to uop_optimize itself so it should
always happen no matter where it is called from.
2024-03-13 22:13:33 +00:00
Serhiy Storchaka 8c6db45ce3
gh-90300: Document equivalent -X options for envvars in the Python CLI help (GH-116756) 2024-03-13 22:59:16 +02:00
Brett Cannon 61733a2fb9
GH-115979: update test_importlib to work under WASI SDK 21 (GH-116754) 2024-03-13 13:24:28 -07:00
Raymond Hettinger 5ff012a449
Better presentation order for recipes. (gh-116755) 2024-03-13 15:02:56 -05:00
Serhiy Storchaka e54bdeab9c
gh-90300: Sort the -X options and some envvars in the Python CLI help (GH-116739) 2024-03-13 21:15:44 +02:00
Sam Gross 98ab21cce6
gh-116631: Fix race condition in `test_shutdown_immediate_put_join` (#116670)
The test case had a race condition: if `q.task_done()` was executed
after `shutdown(immediate=True)`, then it would raise an exception
because the immediate shutdown already emptied the queue. This happened
rarely with the GIL (due to the switching interval), but frequently in
the free-threaded build.
2024-03-13 14:56:28 -04:00
Nikita Sobolev 25684e7131
gh-100746: Improve `test_named_expressions.py` (#116713) 2024-03-13 21:12:40 +03:00
Nir Friedman 7f418fb111
gh-98731: Improvements to the logging documentation (GH-101618)
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
2024-03-13 15:58:30 +00:00
Sam Gross 8e2aab7ad5
gh-116604: Fix test_gc on free-threaded build (#116662)
The free-threaded GC only does full collections, so it uses a threshold that
is a maximum of a fixed value (default 2000) and proportional to the number of
live objects. If there were many live objects after the previous collection,
then the threshold may be larger than 10,000 causing
`test_indirect_calls_with_gc_disabled` to fail.

This manually sets the threshold to `(1000, 0, 0)` for the test. The `0`
disables the proportional scaling.
2024-03-13 13:27:36 +00:00
Vinay Sajip 186af3cf21
[doc]: Update cookbook recipe for Qt6. (GH-116719) 2024-03-13 13:22:47 +00:00
Victor Stinner 612f1ec988
gh-110918: Fix side effects of regrtest test_match_tests() (#116718)
test_match_tests now saves and restores patterns.

Add get_match_tests() function to libregrtest.filter.

Previously, running test_regrtest multiple times in a row only ran
tests once: "./python -m test test_regrtest -R 3:3.
2024-03-13 14:20:33 +01:00
Serhiy Storchaka 33662d4e01
gh-90300: Fix cmdline.rst (GH-116721)
* Fix the description of the "-b" option.
* Add references to environment variables for "-s" and "-X dev" options.
2024-03-13 15:03:13 +02:00
Ken Jin 617aca9e74
gh-115419: Change default sym to not_null (GH-116562) 2024-03-13 20:57:48 +08:00
Nikita Sobolev fcd49b4f47
gh-116714: Handle errors correctly in `PyFloat_GetInfo` (#116715)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-03-13 12:38:03 +00:00
Serhiy Storchaka aa7bcf284f
gh-116401: Fix blocking os.fwalk() and shutil.rmtree() on opening a named pipe (GH-116421) 2024-03-13 11:40:28 +02:00
Tian Gao 8332e85b2f
gh-116626: Emit `CALL` events for all `INSTRUMENTED_CALL_FUNCTION_EX` (GH-116627) 2024-03-13 08:28:01 +00:00
Laurie O ba82a241ac
gh-96471: Add ShutDown to queue.py '__all__' (#116699) 2024-03-13 07:21:30 +00:00
Raymond Hettinger e82f6dfae5
Modernize roundrobin() recipe and improve variable names (gh-116710) 2024-03-13 02:12:30 -05:00
Nikita Sobolev ee0dbbc045
gh-116491: Improve `test_win32_ver` (#116506) 2024-03-13 09:46:48 +03:00
Nikita Sobolev 27df81d564
gh-115264: Fix `test_functools` with `-00` mode (#115276) 2024-03-13 09:41:37 +03:00
Terry Jan Reedy 43986f5567
gh-111307: Update design FAQ 'switch' entry (#115899) 2024-03-13 01:30:39 -04:00
Mariusz Felisiak 3f1b6efee9
Docs: fix broken links (#116651) 2024-03-12 21:19:33 -07:00
Raymond Hettinger 93a687a373
Minor clarity improvement for the iter_index() recipe. Also add value subsequence tests. (gh-116696) 2024-03-12 21:33:42 -05:00
Tim Peters bf121d6a69
GH-116554: Relax list.sort()'s notion of "descending" runs (#116578)
* GH-116554: Relax list.sort()'s notion of "descending" run

Rewrote `count_run()` so that sub-runs of equal elements no longer end a descending run. Both ascending and descending runs can have arbitrarily many sub-runs of arbitrarily many equal elements now. This is tricky, because we only use ``<`` comparisons, so checking for equality doesn't come "for free". Surprisingly, it turned out there's a very cheap (one comparison) way to determine whether an ascending run consisted of all-equal elements. That sealed the deal.

In addition, after a descending run is reversed in-place, we now go on to see whether it can be extended by an ascending run that just happens to be adjacent. This succeeds in finding at least one additional element to append about half the time, and so appears to more than repay its cost (the savings come from getting to skip a binary search, when a short run is artificially forced to length MIINRUN later, for each new element `count_run()` can add to the initial run).

While these have been in the back of my mind for years, a question on StackOverflow pushed it to action:

https://stackoverflow.com/questions/78108792/

They were wondering why it took about 4x longer to sort a list like:

[999_999, 999_999, ..., 2, 2, 1, 1, 0, 0]

than "similar" lists. Of course that runs very much faster after this patch.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
2024-03-12 19:59:42 -05:00
Sam Gross 7d1abe9502
gh-116682: stdout may be empty in test_cancel_futures_wait_false (#116683)
If the `shutdown()` call happens before the worker thread starts executing
the task, then nothing will be printed to stdout.
2024-03-12 20:11:58 -04:00
Thomas Wouters 3f54d1cfe7 Merge branch 'main' of https://github.com/python/cpython 2024-03-13 00:46:31 +01:00
Thomas Wouters 128fbdf97b Post 3.13.0a5 2024-03-13 00:46:17 +01:00
Tian Gao a53cc3f494
GH-116098: Remove dead frame object creation code (GH-116687) 2024-03-12 23:35:28 +00:00
Tushar Sadhwani 149f7f7ae2
Add `typing.NamedTuple` in glossary section for named tuples (#108327) 2024-03-12 15:46:42 -07:00
Donghee Na 3325699ffa
gh-116621: Set manual critical section for list.extend (gh-116657) 2024-03-13 07:28:23 +09:00
Raymond Hettinger 126186674e
Beef-up tests for the itertool docs. (gh-116679) 2024-03-12 17:19:58 -05:00
Jelle Zijlstra 290330714b
gh-89547: typing.rst: Add note about change in behavior with ClassVar/Final (#116686) 2024-03-12 15:17:53 -07:00
Jason R. Coombs a254807761
gh-116307: Proper fix for 'mod' leaking across importlib tests (#116680)
gh-116307: Create a new import helper 'isolated modules' and use that instead of 'Clean Import' to ensure that tests from importlib_resources don't leave modules in sys.modules.
2024-03-12 21:36:21 +00:00
Thomas Wouters 076d169ebb Python 3.13.0a5 2024-03-12 21:11:08 +01:00
Hugo van Kemenade bb66600558
CI: Process stale issues twice per day (#116636) 2024-03-12 19:49:26 +02:00
Victor Stinner f6e7a6ce65
gh-116656: Fix test_capi test_py_config_isoloated_per_interpreter() (#116658)
Don't parse argv when setting the configuration, to avoid SystemExit if parsing argv fails.
2024-03-12 18:31:35 +01:00
Sam Gross 5d72b75388
gh-116604: Check for `gcstate->enabled` in _Py_RunGC in free-threaded build (#116663)
This isn't strictly necessary because the implementation of `gc_should_collect`
already checks `gcstate->enabled` in the free-threaded build, but it seems
like a good idea until the common pieces of gc.c and gc_free_threading.c are
refactored out.
2024-03-12 17:12:02 +00:00
Nikita Sobolev df4784b3b7
gh-116127: PEP-705: Add `ReadOnly` support for `TypedDict` (#116350)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-03-12 07:49:39 -07:00
Matthias Diener 3265087c07
Fix code comment regarding DK_ENTRIES (GH-113960)
fix code comment regarding dict entries
2024-03-12 15:05:30 +01:00
Erlend E. Aasland 3b7fe117fa
gh-116616: Use relaxed atomic ops to access socket module defaulttimeout (#116623)
Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-03-12 14:44:39 +01:00
Pablo Galindo Salgado 02918aa961
gh-116604: Correctly honor the gc status when calling _Py_RunGC (#116628) 2024-03-12 12:00:49 +00:00
Nikita Sobolev eb947cdc13
gh-110819: Fix ‘kind’ may be used uninitialized warning in `longobject` (#116599) 2024-03-12 13:50:06 +03:00
Nikita Sobolev f8147d01da
gh-116541: Handle errors correctly in `_pystatvfs_fromstructstatvfs` (#116542) 2024-03-12 13:10:00 +03:00
Mehdi Drissi d308d33e09
gh-89547: Support for nesting special forms like Final (#116096) 2024-03-11 23:11:56 -07:00
Christopher Chavez 4fa95c6ec3
gh-116145: Update macOS installer to Tcl/Tk 8.6.14 (GH-116151) 2024-03-12 01:37:07 -04:00
Victor Stinner 3cc5ae5c2c
gh-85283: Convert grp extension to the limited C API (#116611)
posixmodule.h: remove check on the limited C API, since these helpers
are not part of the public C API.
2024-03-12 00:46:53 +00:00
Guido van Rossum ba13215eb1
gh-113538: Revert "gh-113538: Add asycio.Server.{close,abort}_clients (#114432)" (#116632)
Revert "gh-113538: Add asycio.Server.{close,abort}_clients (#114432)"

Reason: The new test doesn't always pass:
https://github.com/python/cpython/pull/116423#issuecomment-1989425489

This reverts commit 1d0d49a7e8.
2024-03-12 00:31:49 +00:00
Victor Stinner 2b67fc57f6
gh-108494: Fix Argument Clinic LIMITED_CAPI_REGEX (#116610)
Accept spaces in "#  define Py_LIMITED_API 0x030d0000".
2024-03-11 22:42:18 +00:00
Ethan Furman 06e29a224f
gh-116600: [Enum] fix global Flag repr (GH-116615)
* and fix global flag repr

* Update Misc/NEWS.d/next/Library/2024-03-11-12-11-10.gh-issue-116600.FcNBy_.rst

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-03-11 15:41:53 -07:00
Terry Jan Reedy 3e45030076
gh-116563: Update tutorial error example (#116569)
There now may be multiple carets pointing at a token
rather than just a character.  Fix the sentence about
possible causes.
2024-03-11 18:01:08 -04:00