summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* gh-115999: Add free-threaded specialization for `UNPACK_SEQUENCE` (#126600)Kirill Podoprigora2024-11-227-30/+103
| | | | | | | | | | | Add free-threaded specialization for `UNPACK_SEQUENCE` opcode. `UNPACK_SEQUENCE_TUPLE/UNPACK_SEQUENCE_TWO_TUPLE` are already thread safe since tuples are immutable. `UNPACK_SEQUENCE_LIST` is not thread safe because of nature of lists (there is nothing preventing another thread from adding items to or removing them the list while the instruction is executing). To achieve thread safety we add a critical section to the implementation of `UNPACK_SEQUENCE_LIST`, especially around the parts where we check the size of the list and push items onto the stack. --------- Co-authored-by: Matt Page <mpage@meta.com> Co-authored-by: mpage <mpage@cs.stanford.edu>
* gh-127117: Ensure the Correct Last Fields of PyInterpreterState and of ↵Eric Snow2024-11-222-7/+10
| | | | | _PyRuntimeState (gh-127118) We add some comments so contributors can be aware and we move one out-of-place field up.
* gh-86463: Fix a trailing space in argparse.rst (#127162)Serhiy Storchaka2024-11-221-1/+1
|
* gh-88110: Clear concurrent.futures.thread._threads_queues after fork to ↵Andrei Bodrov2024-11-223-0/+22
| | | | | | | | | avoid joining parent process' threads (GH-126098) Threads are gone after fork, so clear the queues too. Otherwise the child process (here created via multiprocessing.Process) crashes on interpreter exit. Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-126384: Add tests to verify the behavior of basic COM methods. (GH-126610)Jun Komoda2024-11-221-0/+188
|
* gh-109413: Fix libregrtest get_running() (#127153)Victor Stinner2024-11-221-1/+1
| | | Skip threads which are not running.
* gh-127001: Fix PATHEXT issues in shutil.which() on Windows (GH-127035)Serhiy Storchaka2024-11-224-248/+303
| | | | | | | | | * Name without a PATHEXT extension is only searched if the mode does not include X_OK. * Support multi-component PATHEXT extensions (e.g. ".foo.bar"). * Support files without extensions in PATHEXT contains dot-only extension (".", "..", etc). * Support PATHEXT extensions that end with a dot (e.g. ".foo.").
* Fix broken XML in Visual Studio project file (GH-127142)Sergey Muraviov2024-11-221-0/+2
|
* gh-86463: Fix default prog in subparsers if usage is used in the main parser ↵Serhiy Storchaka2024-11-224-5/+60
| | | | | | | | | | (GH-125891) The usage parameter of argparse.ArgumentParser no longer affects the default value of the prog parameter in subparsers. Previously the full custom usage of the main parser was used as the prog prefix in subparsers.
* gh-127076: Ignore memory mmap in FileIO testing (#127088)Cody Maloney2024-11-223-7/+37
| | | | | | | | | | | | | `mmap`, `munmap`, and `mprotect` are used by CPython for memory management, which may occur in the middle of the FileIO tests. The system calls can also be used with files, so `strace` includes them in its `%file` and `%desc` filters. Filter out the `mmap` system calls related to memory allocation for the file tests. Currently FileIO doesn't do `mmap` at all, so didn't add code to track from `mmap` through `munmap` since it wouldn't be used. For now if an `mmap` on a fd happens, the call will be included (which may cause test to fail), and at that time support for tracking the address throug `munmap` could be added.
* gh-126700: pygettext: Support more gettext functions (GH-126912)Tomas R.2024-11-227-90/+260
| | | | Support multi-argument gettext functions: ngettext(), pgettext(), dgettext(), etc.
* gh-127065: Make `methodcaller` thread-safe in free threading build (#127109)Sam Gross2024-11-222-0/+11
| | | | | | | The `methodcaller` C vectorcall implementation uses an arguments array that is shared across calls. The first argument is modified on every invocation. This isn't thread-safe in the free threading build. I think it's also not safe in general, but for now just disable it in the free threading build.
* gh-127082: Replace "Windows only" with the `availability: Windows` in ↵Jun Komoda2024-11-221-15/+48
| | | | `ctypes` doc (#127099)
* Allow local use of `static PyMutex` in the C analyzer (#127102)Peter Bierma2024-11-222-1/+14
|
* GH-127078: `url2pathname()`: handle extra slash before UNC drive in URL path ↵Barney Gale2024-11-223-1/+6
| | | | | | | (#127132) Decode a file URI like `file://///server/share` as a UNC path like `\\server\share`. This form of file URI is created by software the simply prepends `file:///` to any absolute Windows path.
* GH-126766: `url2pathname()`: handle 'localhost' authority (#127129)Barney Gale2024-11-224-5/+15
| | | | | Discard any 'localhost' authority from the beginning of a `file:` URI. As a result, file URIs like `//localhost/etc/hosts` are correctly decoded as `/etc/hosts`.
* GH-122679: Add `register()` to argparse docs (#126939)Savannah Ostrowski2024-11-221-3/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add register() to argparse docs * Add newline * Formatting * Fix codeblock * Move section * Add signature * Add newline * Fix indent * Fix indent take 2 * Rephrase * Simplify language * Address PR comments * Add references to register in type and action * Remove unnecessary reference * Rephrase and add success case
* GH-126601: `pathname2url()`: handle NTFS alternate data streams (#126760)Barney Gale2024-11-224-14/+21
| | | | | | Adjust `pathname2url()` to encode embedded colon characters in Windows paths, rather than bailing out with an `OSError`. Co-authored-by: Steve Dower <steve.dower@microsoft.com>
* gh-126091: Always link generator frames when propagating a thrown-in ↵Jacob Bower2024-11-213-7/+35
| | | | | exception through a yield-from chain (#126092) Always link generator frames when propagating a thrown-in exception through a yield-from chain.
* Improve comment for co_nlocalsplus (#126993)Jacob Bower2024-11-211-1/+2
|
* gh-115999: Add free-threaded specialization for ``TO_BOOL`` (gh-126616)Donghee Na2024-11-217-69/+168
|
* gh-115999: Specialize `LOAD_GLOBAL` in free-threaded builds (#126607)mpage2024-11-2111-69/+222
| | | | | | | | | | | | | | Enable specialization of LOAD_GLOBAL in free-threaded builds. Thread-safety of specialization in free-threaded builds is provided by the following: A critical section is held on both the globals and builtins objects during specialization. This ensures we get an atomic view of both builtins and globals during specialization. Generation of new keys versions is made atomic in free-threaded builds. Existing helpers are used to atomically modify the opcode. Thread-safety of specialized instructions in free-threaded builds is provided by the following: Relaxed atomics are used when loading and storing dict keys versions. This avoids potential data races as the dict keys versions are read without holding the dictionary's per-object lock in version guards. Dicts keys objects are passed from keys version guards to the downstream uops. This ensures that we are loading from the correct offset in the keys object. Once a unicode key has been stored in a keys object for a combined dictionary in free-threaded builds, the offset that it is stored in will never be reused for a different key. Once the version guard passes, we know that we are reading from the correct offset. The dictionary read fast-path is used to read values from the dictionary once we know the correct offset.
* gh-114940: Add _Py_FOR_EACH_TSTATE_UNLOCKED(), and Friends (gh-127077)Eric Snow2024-11-219-87/+79
| | | This is a precursor to the actual fix for gh-114940, where we will change these macros to use the new lock. This change is almost entirely mechanical; the exceptions are the loops in codeobject.c and ceval.c, which now hold the "head" lock. Note that almost all of the uses of _Py_FOR_EACH_TSTATE_UNLOCKED() here will change to _Py_FOR_EACH_TSTATE_BEGIN() once we add the new per-interpreter lock.
* gh-124470: Fix crash when reading from object instance dictionary while ↵Dino Viehland2024-11-217-85/+289
| | | | | replacing it (#122489) Delay free a dictionary when replacing it
* gh-127020: Make `PyCode_GetCode` thread-safe for free threading (#127043)Sam Gross2024-11-213-27/+85
| | | | Some fields in PyCodeObject are lazily initialized. Use atomics and critical sections to make their initializations and accesses thread-safe.
* gh-118761: Improve import time of `mimetypes` (#126979)Hugo van Kemenade2024-11-212-6/+18
|
* gh-124873: Tolerate 100 ms in TimerfdTests on Android (#127101)Victor Stinner2024-11-211-2/+2
| | | | On Android, TimerfdTests of test_os now uses 100 ms accuracy instead of 10 ms.
* gh-126316: Make grp.getgrall() thread-safe: add a mutex (#127055)Victor Stinner2024-11-218-22/+107
| | | | grpmodule.c is no longer built with the limited C API, since PyMutex is excluded from the limited C API.
* gh-126780: Fix `ntpath.normpath()` for drive-relative paths (GH-126801)Nice Zombies2024-11-214-25/+34
|
* gh-112136: Remove unused #include "pycore_lock.h" (#127093)Victor Stinner2024-11-211-2/+0
| | | pycore_modsupport.h no longer needs pycore_lock.h.
* gh-126727: Fix locale.nl_langinfo(locale.ERA) (GH-126730)Serhiy Storchaka2024-11-214-28/+95
| | | | | It now returns multiple era description segments separated by semicolons. Previously it only returned the first segment on platforms with Glibc.
* gh-126997: Fix support of non-ASCII strings in pickletools (GH-127062)Serhiy Storchaka2024-11-213-4/+92
| | | | | * Fix support of STRING and GLOBAL opcodes with non-ASCII arguments. * dis() now outputs non-ASCII bytes in STRING, BINSTRING and SHORT_BINSTRING arguments as escaped (\xXX).
* gh-127076: Disable strace tests under LD_PRELOAD (#127086)Cody Maloney2024-11-212-0/+9
| | | | | | | | Distribution tooling (ex. sandbox on Gentoo and fakeroot on Debian) uses LD_PRELOAD to intercept system calls and potentially modify them when building. These tools can change the set of system calls, so disable system call testing under these cases. Co-authored-by: Michał Górny <mgorny@gentoo.org>
* gh-126898: Emscripten support: Use es6 modules (#126903)Hood Chatham2024-11-216-30/+60
| | | | Modify Emscripten support to use ES6 modules.
* gh-115999: Don't take a reason in unspecialize (#127030)mpage2024-11-201-4/+9
| | | | | | | Don't take a reason in unspecialize We only want to compute the reason if stats are enabled. Optimizing compilers should optimize this away for us (gcc and clang do), but it's better to be safe than sorry.
* Run `apt update` before `apt install git` in autoconf CI job (GH-127066)Zachary Ware2024-11-201-1/+1
|
* Move NEWS entries out of directories with spaces (GH-127067)Zachary Ware2024-11-203-0/+0
| | | Cleanup after GH-126063, including moving the `README.rst` files to the new directories.
* gh-121058: Warn if `PyThreadState_Clear` is called with an exception set ↵Peter Bierma2024-11-202-0/+7
| | | | (gh-121343)
* GH-127010: Don't lazily track and untrack dicts (GH-127027)Mark Shannon2024-11-2012-283/+44
|
* gh-97514: Authenticate the forkserver control socket. (GH-99309)Gregory P. Smith2024-11-206-16/+141
| | | | | | | | | | | | | | | | | | | This adds authentication to the forkserver control socket. In the past only filesystem permissions protected this socket from code injection into the forkserver process by limiting access to the same UID, which didn't exist when Linux abstract namespace sockets were used (see issue) meaning that any process in the same system network namespace could inject code. We've since stopped using abstract namespace sockets by default, but protecting our control sockets regardless of type is a good idea. This reuses the HMAC based shared key auth already used by `multiprocessing.connection` sockets for other purposes. Doing this is useful so that filesystem permissions are not relied upon and trust isn't implied by default between all processes running as the same UID with access to the unix socket. ### pyperformance benchmarks No significant changes. Including `concurrent_imap` which exercises `multiprocessing.Pool.imap` in that suite. ### Microbenchmarks This does _slightly_ slow down forkserver use. How much so appears to depend on the platform. Modern platforms and simple platforms are less impacted. This PR adds additional IPC round trips to the control socket to tell forkserver to spawn a new process. Systems with potentially high latency IPC are naturally impacted more. Typically a 1-4% slowdown on a very targeted process creation microbenchmark, with a worst case overloaded system slowdown of 20%. No evidence that these slowdowns appear in practical sense. See the PR for details.
* GH-126892: Reset warmup counters when JIT compiling code (GH-126893)Brandt Bucher2024-11-206-39/+48
|
* gh-126991: Add tests for unpickling bad object state (GH-127031)Serhiy Storchaka2024-11-201-0/+35
| | | This catches a memory leak in loading the BUILD opcode.
* gh-126615: `ctypes`: Make `COMError` public (GH-126686)Jun Komoda2024-11-205-10/+51
| | | Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* GH-84850: Improve whatsnew entry for `[Fancy]URLopener` removal (#127032)Barney Gale2024-11-201-0/+7
|
* gh-123299: Copyedit "What's New in Python 3.14" (#127028)Hugo van Kemenade2024-11-201-17/+17
|
* Doc: C API: `PyThreadState::on_delete` was removed in v3.13 (#126536)Richard Hansen2024-11-201-0/+3
|
* GH-85168: Use filesystem encoding when converting to/from `file` URIs (#126852)Barney Gale2024-11-194-10/+26
| | | | | | | | Adjust `urllib.request.url2pathname()` and `pathname2url()` to use the filesystem encoding when quoting and unquoting file URIs, rather than forcing use of UTF-8. No changes are needed in the `nturl2path` module because Windows always uses UTF-8, per PEP 529.
* Merge remote-tracking branch 'upstream/main'Hugo van Kemenade2024-11-1926-172/+224
|\
| * gh-126914: Store the Preallocated Thread State's Pointer in a ↵Eric Snow2024-11-194-48/+82
| | | | | | | | | | PyInterpreterState Field (gh-126989) This approach eliminates the originally reported race. It also gets rid of the deadlock reported in gh-96071, so we can remove the workaround added then.
| * gh-109413: Enable mypy's `disallow_any_generics` setting when checking ↵sobolevn2024-11-194-4/+7
| | | | | | | | `libregrtest` (#127033)