| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
* Add Lib/test/test_capi/test_eval.py
* Add Modules/_testlimitedcapi/eval.c
|
|
|
|
|
|
|
|
|
| |
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-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.
|
|
|
|
| |
implementation (GH-122047)
|
|
|
|
|
|
|
| |
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().
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
(#122317)
* gh-120974: Make asyncio `swap_current_task` safe in free-threaded build
|
|
|
| |
Replace PyMem_Del() with PyMem_Free().
|
|
|
|
| |
PyObject_Del() is just a alias to PyObject_Free() kept for backward
compatibility. Use directly PyObject_Free() instead.
|
|
|
|
|
| |
Don't expose `FICLONE` ioctl on Android
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
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
Update `_PyDict_DelItemIf` to allow for an argument to be passed to the
predicate.
|
|
|
| |
This allows to identify the source of the error.
|
|
|
|
|
| |
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.
|
|
|
|
| |
Use `PyDict_SetDefaultRef` to set the current task in a single operation
under the dictionary's lock.
|
|
|
|
| |
Relatedly, emit the `cpython.run_startup` event from the Python version of
`PYTHONSTARTUP` handling.
|
|
|
|
| |
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).
|
|
|
|
|
|
| |
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-121907)
|
| |
|
|
|
|
| |
use-after-free (#120297)
|
|
|
|
| |
This avoids changing the ABI and keeps the field in the private struct.
|
| |
|
|
|
| |
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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-121805)
See 6b98b274b6 for an explanation of the problem and solution. Here I've applied the solution to channels.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(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".)
|
| |
|
|
|
| |
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
|
|
|
|
|
| |
`FutureIter_dealloc`) (GH-121638)
Address comments
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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).
|
|
|
| |
Co-authored-by: Erlend E. Aasland <erlend@python.org>
|
|
|
| |
This fixes a mistake in gh-113012 and adds a test that verifies the fix.
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|