* Add PyDict_GetItemRef() and PyDict_GetItemStringRef() functions.
Add these functions to the stable ABI version 3.13.
* Add unit tests on the PyDict C API in test_capi.
There was a slight race in _Py_ClearFileSystemEncoding() (when called from _Py_SetFileSystemEncoding()), between freeing the value and setting the variable to NULL, which occasionally caused crashes when multiple isolated interpreters were used. (Notably, I saw at least 10 different, seemingly unrelated spooky-action-at-a-distance, ways this crashed. Yay, free threading!) We avoid the problem by only setting the global variables with the main interpreter (i.e. runtime init).
A static (process-global) str object must only have its "interned" state cleared when no longer interned in any interpreters. They are the only ones that can be shared by interpreters so we don't have to worry about any other str objects.
We trigger clearing the state with the main interpreter, since no other interpreters may exist at that point and _PyUnicode_ClearInterned() is only called during interpreter finalization.
We do not address here the fact that a string will only be interned in the first interpreter that interns it. In any subsequent interpreters str.state.interned is already set so _PyUnicode_InternInPlace() will skip it. That needs to be addressed separately from fixing the crasher.
Add Background as a toplevel section with the following subsections:
- Background
- The goals of Argument Clinic
- Basic concepts and usage
Rename "Converting your first function" to Tutorial.
Add anchors for Background, Tutorial, and How-to Guides:
- :ref:`clinic-background`
- :ref:`clinic-tutorial`
- :ref:`clinic-howtos`
Link to these from within the Abstract.
Break the compatibility paragraph out of Abstract and make it a note.
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
This restores a corner case: when the generator is run with working directory set to Tools/cases_generator, the source filenames listed in the generated provenance header should be relative to the repo root directory.
Previous ToC layout (excerpt):
- How to use symbolic default values
...
- How to assign default values to parameter
- How to use the ``NULL`` default value
- How to use expressions as default values
New layout:
- How to assign default values to parameter
- The ``NULL`` default value
- Symbolic default values
- Expressions as default values
threadingmock: Improve test suite to avoid race conditions
Simplify tests and split them into multiple tests to prevent assertions
from triggering race conditions.
Additionally, we rely on calling the mocks without delay to validate the
functionality of matching calls.
By turning `assert(kwnames == NULL)` into a macro that is not in the "forbidden" list, many instructions that formerly were skipped because they contained such an assert (but no other mention of `kwnames`) are now supported in Tier 2. This covers 10 instructions in total (all specializations of `CALL` that invoke some C code):
- `CALL_NO_KW_TYPE_1`
- `CALL_NO_KW_STR_1`
- `CALL_NO_KW_TUPLE_1`
- `CALL_NO_KW_BUILTIN_O`
- `CALL_NO_KW_BUILTIN_FAST`
- `CALL_NO_KW_LEN`
- `CALL_NO_KW_ISINSTANCE`
- `CALL_NO_KW_METHOD_DESCRIPTOR_O`
- `CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS`
- `CALL_NO_KW_METHOD_DESCRIPTOR_FAST`