summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* gh-111495: Add more tests on PyEval C APIs (#122789)Victor Stinner2024-08-085-22/+100
| | | | * Add Lib/test/test_capi/test_eval.py * Add Modules/_testlimitedcapi/eval.c
* gh-105201: Add PyIter_NextItem() (#122331)Erlend E. Aasland2024-08-071-0/+29
| | | | | | | | | Return -1 and set an exception on error; return 0 if the iterator is exhausted, and return 1 if the next item was fetched successfully. Prefer this API to PyIter_Next(), which requires the caller to use PyErr_Occurred() to differentiate between iterator exhaustion and errors. Co-authered-by: Irit Katriel <iritkatriel@yahoo.com>
* gh-118814: Fix the TypeVar constructor when name is passed by keyword ↵Serhiy Storchaka2024-08-072-1/+93
| | | | | | | | (GH-122664) Fix _PyArg_UnpackKeywordsWithVararg for the case when argument for positional-or-keyword parameter is passed by keyword. There was only one such case in the stdlib -- the TypeVar constructor.
* gh-100256: Skip inaccessible registry keys in the WinAPI mimetype ↵Lucas Esposito2024-08-071-1/+1
| | | | implementation (GH-122047)
* gh-122728: Fix SystemError in PyEval_GetLocals() (#122735)Victor Stinner2024-08-061-0/+7
| | | | | | | Fix PyEval_GetLocals() to avoid SystemError ("bad argument to internal function"). Don't redefine the 'ret' variable in the if block. Add an unit test on PyEval_GetLocals().
* gh-122681: merge m_atan2() and c_atan2() helper functions (#122682)Sergey B Kirpichev2024-08-063-69/+41
|
* gh-122704: Fix reference leak in Modules/_pickle.c (GH-122705)Kirill Podoprigora2024-08-061-0/+4
|
* gh-122459: Optimize pickling by name objects without __module__ (GH-122460)Serhiy Storchaka2024-08-051-127/+122
|
* gh-122637: fix tanh(±0+infj) and tanh(±0+nanj) to return ±0+nanj (#122638)Sergey B Kirpichev2024-08-041-2/+2
| | | | | | | | | As per C11 DR#471, ctanh (0 + i NaN) and ctanh (0 + i Inf) should return 0 + i NaN (with "invalid" exception in the second case). This has corresponding implications for ctan(z), as its errors and special cases are handled as if the operation is implemented by -i*ctanh(i*z). This patch fixes cmath's code to do same. Glibs patch: https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=d15e83c5f5231d971472b5ffc9219d54056ca0f1
* gh-121889: cmath.acosh(0+nanj) returns nan+pi/2j (#121892)Sergey B Kirpichev2024-08-041-2/+2
| | | | | As per C11 DR#471 (adjusted resolution accepted for C17), cacosh (0 + iNaN) should return NaN ± i pi/2, not NaN + iNaN. This patch fixes cmath's code to do same.
* gh-120974: Make asyncio `swap_current_task` safe in free-threaded build ↵Sam Gross2024-08-021-14/+23
| | | | | (#122317) * gh-120974: Make asyncio `swap_current_task` safe in free-threaded build
* Update PyObject_Del() documentation (#122597)Victor Stinner2024-08-022-9/+9
| | | Replace PyMem_Del() with PyMem_Free().
* Replace PyObject_Del with PyObject_Free (#122453)Victor Stinner2024-08-012-4/+4
| | | | PyObject_Del() is just a alias to PyObject_Free() kept for backward compatibility. Use directly PyObject_Free() instead.
* gh-116622: Don't expose `FICLONE` ioctl on Android (#122522)Malcolm Smith2024-08-011-0/+5
| | | | | Don't expose `FICLONE` ioctl on Android Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
* gh-121381 Remove subprocess._USE_VFORK escape hatch (#121383)Cody Maloney2024-07-312-14/+8
| | | | | | | | | | | This flag was added as an escape hatch in gh-91401 and backported to Python 3.10. The flag broke at some point between its addition and now. As there is currently no publicly known environments that require this, remove it rather than work on fixing it. This leaves the flag in the subprocess module to not break code which may have used / checked the flag itself. discussion: https://discuss.python.org/t/subprocess-use-vfork-escape-hatch-broken-fix-or-remove/56915/2
* gh-122311: Fix a refleak in pickle (GH-122411)Serhiy Storchaka2024-07-291-0/+1
|
* gh-122311: Fix some error messages in pickle (GH-122386)Serhiy Storchaka2024-07-291-3/+3
|
* gh-122332: Fix missing `NULL` check in `asyncio.Task.get_coro` (#122338)Peter Bierma2024-07-271-1/+5
|
* gh-121489: Export private _PyBytes_Join() again (#122267)Marc Mueller2024-07-251-1/+0
|
* gh-82951: Fix serializing by name in pickle protocols < 4 (GH-122149)Serhiy Storchaka2024-07-251-17/+36
| | | | | | Serializing objects with complex __qualname__ (such as unbound methods and nested classes) by name no longer involves serializing parent objects by value in pickle protocols < 4.
* gh-113785: csv: fields starting with escapechar are not quoted (GH-122110)Mikołaj Kuranowski2024-07-251-1/+0
|
* GH-121832: Assert that the version number of static builtin types is not ↵Mark Shannon2024-07-241-46/+42
| | | | | changed by PyType_Modified. (GH-122182) Update datetime module and test_type_cache.py to not call PyType_Modified.
* gh-120974: Make _asyncio._leave_task atomic in the free-threaded build (#122139)Sam Gross2024-07-232-28/+27
| | | | | | | * gh-120974: Make _asyncio._leave_task atomic in the free-threaded build Update `_PyDict_DelItemIf` to allow for an argument to be passed to the predicate.
* gh-122163: Add notes for JSON serialization errors (GH-122165)Serhiy Storchaka2024-07-231-4/+9
| | | This allows to identify the source of the error.
* gh-120974: Use common freelist code in asyncio (#122132)Sam Gross2024-07-231-69/+4
| | | | | This refactors asyncio to use the common freelist helper functions and macros. As a side effect, the freelist for _asyncio.Future is now re-enabled in the free-threaded build.
* gh-120974: Make _asyncio._enter_task atomic in the free-threaded build (#122138)Sam Gross2024-07-231-10/+5
| | | | Use `PyDict_SetDefaultRef` to set the current task in a single operation under the dictionary's lock.
* gh-121957: Emit audit events for `python -i` and `python -m asyncio` (GH-121958)Łukasz Langa2024-07-221-0/+4
| | | | Relatedly, emit the `cpython.run_startup` event from the Python version of `PYTHONSTARTUP` handling.
* gh-121621: Disable asyncio freelist in free-threaded build (#122046)Sam Gross2024-07-191-5/+17
| | | | The futureobj freelist isn't thread-safe. We intend to re-enable the freelist in a thread-safe way for 3.14 (but not 3.13).
* gh-120973: Fix thread-safety issues with `threading.local` (#121655)mpage2024-07-191-150/+234
| | | | | | This is a small refactoring to the current design that allows us to avoid manually iterating over threads. This should also fix gh-118490.
* gh-118830: Bump pickle.DEFAULT_PROTOCOL to 5 (GH-119340)Rodrigo Oliveira2024-07-192-11/+11
|
* gh-121905: Consistently use "floating-point" instead of "floating point" ↵Serhiy Storchaka2024-07-1914-37/+37
| | | | (GH-121907)
* gh-120289: Add external timer in traverse of _lsprof.Profiler (#121998)Tian Gao2024-07-191-0/+1
|
* gh-120289: Disallow disable() and clear() in external timer to prevent ↵Tian Gao2024-07-181-1/+19
| | | | use-after-free (#120297)
* gh-121621: Move asyncio_running_loop to private struct (#121939)Sam Gross2024-07-171-4/+4
| | | | This avoids changing the ABI and keeps the field in the private struct.
* gh-121925: Fix uninitialized variables in `main.c` (#121926)sobolevn2024-07-171-2/+6
|
* gh-120678: pyrepl: Include globals from modules passed with `-i` (GH-120904)Alex Waygood2024-07-171-1/+49
| | | Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* gh-121621: Move asyncio running loop to thread state (GH-121695)Ken Jin2024-07-161-104/+12
|
* gh-113993: Don't immortalize in PyUnicode_InternInPlace; keep immortalizing ↵Petr Viktorin2024-07-161-3/+8
| | | | | | | | | | | | | | | | | in other API (#121364) * Switch PyUnicode_InternInPlace to _PyUnicode_InternMortal, clarify docs * Document immortality in some functions that take `const char *` This is PyUnicode_InternFromString; PyDict_SetItemString, PyObject_SetAttrString; PyObject_DelAttrString; PyUnicode_InternFromString; and the PyModule_Add convenience functions. Always point out a non-immortalizing alternative. * Don't immortalize user-provided attr names in _ctypes
* gh-121791: Check for `NULL` in `MethodDescriptor2_new` in `_testcapi` (#121792)sobolevn2024-07-161-0/+3
|
* gh-76785: Expand How Interpreter Channels Handle Interpreter Finalization ↵Eric Snow2024-07-153-110/+321
| | | | | (gh-121805) See 6b98b274b6 for an explanation of the problem and solution. Here I've applied the solution to channels.
* gh-76785: Expand How Interpreter Queues Handle Interpreter Finalization ↵Eric Snow2024-07-151-59/+184
| | | | | | | | | | | | | | | | | | | | (gh-116431) Any cross-interpreter mechanism for passing objects between interpreters must be very careful to respect isolation, even when the object is effectively immutable (e.g. int, str). Here this especially relates to when an interpreter sends one of its objects, and then is destroyed while the inter-interpreter machinery (e.g. queue) still holds a reference to the object. When I added interpreters.Queue, I dealt with that case (using an atexit hook) by silently removing all items from the queue that were added by the finalizing interpreter. Later, while working on concurrent.futures.InterpreterPoolExecutor (gh-116430), I noticed it was somewhat surprising when items were silently removed from the queue when the originating interpreter was destroyed. (See my comment on that PR.) It took me a little while to realize what was going on. I expect that users, which much less context than I have, would experience the same pain. My approach, here, to improving the situation is to give users three options: 1. return a singleton (interpreters.queues.UNBOUND) from Queue.get() in place of each removed item 2. raise an exception (interpreters.queues.ItemInterpreterDestroyed) from Queue.get() in place of each removed item 3. existing behavior: silently remove each item (i.e. Queue.get() skips each one) The default will now be (1), but users can still explicitly opt in any of them, including to the silent removal behavior. The behavior for each item may be set with the corresponding Queue.put() call. and a queue-wide default may be set when the queue is created. (This is the same as I did for "synconly".)
* fix outdated comments in asyncio (#121783)Kumar Aditya2024-07-151-1/+1
|
* gh-121621: Use PyMutex for writes to asyncio state (#121622)Ken Jin2024-07-141-1/+29
| | | Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* Update retroactive comments from GH-117741 (segfault in ↵Savannah Ostrowski2024-07-121-3/+0
| | | | | `FutureIter_dealloc`) (GH-121638) Address comments
* gh-121103: Put free-threaded libraries in `lib/python3.14t` (#121293)Sam Gross2024-07-112-3/+10
| | | | | On POSIX systems, excluding macOS framework installs, the lib directory for the free-threaded build now includes a "t" suffix to avoid conflicts with a co-located default build installation.
* gh-121592: Make select.poll() and related objects thread-safe (#121594)Sam Gross2024-07-112-22/+96
| | | | | | This makes select.poll() and kqueue() objects thread-safe in the free-threaded build. Note that calling close() concurrently with other functions is still not thread-safe due to races on file descriptors (gh-121544).
* gh-121554: remove unnecessary internal functions in compile.c (#121555)Irit Katriel2024-07-103-19/+12
| | | Co-authored-by: Erlend E. Aasland <erlend@python.org>
* gh-121596: Fix Sharing Interpreter Channels (gh-121597)Eric Snow2024-07-101-2/+2
| | | This fixes a mistake in gh-113012 and adds a test that verifies the fix.
* gh-121368: Fix seq lock memory ordering in _PyType_Lookup (#121388)Sam Gross2024-07-081-0/+1
| | | | | | | | | The `_PySeqLock_EndRead` function needs an acquire fence to ensure that the load of the sequence happens after any loads within the read side critical section. The missing fence can trigger bugs on macOS arm64. Additionally, we need a release fence in `_PySeqLock_LockWrite` to ensure that the sequence update is visible before any modifications to the cache entry.
* gh-121374: Correct docstrings in `_interpchannels` (gh-121418)Max Muoto2024-07-081-2/+2
|