Commit Graph

121219 Commits

Author SHA1 Message Date
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
Tian Gao 44f9a84b67
gh-90095: Make .pdbrc work properly and add some reasonable tests (#110496) 2024-03-11 21:27:00 +00:00
Ethan Furman 3c0dcef980
gh-116040: [Enum] fix test_empty_names test (GH-116508)
* and fix _not_given usage
2024-03-11 13:42:01 -07:00
Malcolm Smith 34920f3691
gh-71052: Use `raise_signal` in `ThreadSignals.test_signals` (#116423)
Use `raise_signal` rather than `kill` in `ThreadSignals.test_signals`
2024-03-11 21:39:17 +01:00
Pierre Ossman (ThinLinc team) 1d0d49a7e8
gh-113538: Add asycio.Server.{close,abort}_clients (#114432)
These give applications the option of more forcefully terminating client
connections for asyncio servers. Useful when terminating a service and
there is limited time to wait for clients to finish up their work.
2024-03-11 12:43:30 -07:00
Malcolm Smith 872c0714fc
gh-71052: Change Android's `sys.platform` from "linux" to "android"
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-03-11 19:25:39 +00:00
Sam Gross 9f983e00ec
gh-116515: Clear thread-local state before tstate_delete_common() (#116517)
This moves `current_fast_clear()` up so that the current thread state is
`NULL` while running `tstate_delete_common()`.

This doesn't fix any bugs, but it means that we are more consistent that
`_PyThreadState_GET() != NULL` means that the thread is "attached".
2024-03-11 15:14:20 -04:00
Brett Cannon 05070f40bb
GH-115976: Add WASI to CI (GH-116516)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-03-11 11:59:09 -07:00
Victor Stinner 113053a070
gh-110850: Fix _PyTime_FromSecondsDouble() API (#116606)
Return 0 on success. Set an exception and return -1 on error.

Fix os.timerfd_settime(): properly report exceptions on
_PyTime_FromSecondsDouble() failure.

No longer export _PyTime_FromSecondsDouble().
2024-03-11 16:35:29 +00:00
Brett Simmers 2731913dd5
gh-116167: Allow disabling the GIL with `PYTHON_GIL=0` or `-X gil=0` (#116338)
In free-threaded builds, running with `PYTHON_GIL=0` will now disable the
GIL. Follow-up issues track work to re-enable the GIL when loading an
incompatible extension, and to disable the GIL by default.

In order to support re-enabling the GIL at runtime, all GIL-related data
structures are initialized as usual, and disabling the GIL simply sets a flag
that causes `take_gil()` and `drop_gil()` to return early.
2024-03-11 11:02:58 -04:00
Victor Stinner 546eb7a3be
gh-116417: Build _testinternalcapi with limited C API version 3.5 (#116598) 2024-03-11 15:20:04 +01:00
Mark Shannon b6ae6da1bd
GH-116596: Better determination of escaping uops. (GH-116597) 2024-03-11 13:37:48 +00:00
Donghee Na 6c4fc209e1
gh-112536: Define MI_TSAN to 1 for --with-mimalloc and --with-thread-sanitizer (gh-116558) 2024-03-11 22:25:55 +09:00
Nikita Sobolev 817fe33a1d
gh-116590: Fix unused `current_thread_holds_gil` function warning (#116591) 2024-03-11 16:25:04 +03:00