| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
| |
A couple of refleaks slipped through in gh-118194. This takes care of them.
(AKA _Py_ext_module_loader_info_init() does not steal references.)
|
|
|
| |
This helps with a later change that splits up _PyImport_LoadDynamicModuleWithSpec().
|
|
|
|
|
| |
Singlephase or Not (gh-118193)
This change makes other upcoming changes simpler.
|
|
|
| |
See https://discuss.python.org/t/pep-734-multiple-interpreters-in-the-stdlib/41147/26.
|
|
|
| |
These are cleanups I've pulled out of gh-118116. Mostly, this change moves code around to align with some future changes and to improve clarity a little. There is one very small change in behavior: we now add the module to the per-interpreter caches after updating the global state, rather than before.
|
| |
|
|
|
| |
Covert DEOPT_IFs on likely side exits to EXIT_IFs
|
|
|
|
| |
sequences for introspection (#118007)
|
|
|
|
|
| |
Better version of gh-118117.
Just check for immortality instead of an address range check.
|
|
|
|
|
| |
`tstate->state` (#118165)
Quiet TSAN warnings about remaining non-atomic accesses of `tstate->state`
|
|
|
| |
This is a collection of very basic cleanups I've pulled out of gh-118116. It is mostly renaming variables and moving a couple bits of code in functionally equivalent ways.
|
|
|
|
| |
Co-authored-by: Joe Jevnik <joe@quantopian.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
|
| |
|
| |
|
|
|
|
| |
known already (GH-118050)
|
|
|
|
|
| |
(#114742)
Make instance attributes stored in inline "dict" thread safe on free-threaded builds
|
|
|
|
|
|
|
| |
(#116775)
Makes sys.settrace, sys.setprofile, and monitoring generally thread-safe.
Mostly uses a stop-the-world approach and synchronization around the code object's _co_instrumentation_version. There may be a little bit of extra synchronization around the monitoring data that's required to be TSAN clean.
|
|
|
|
|
| |
(GH-118073)
Co-authored-by: Joshua Root jmr@macports.org
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
We were under-counting calls in `_PyEvalFramePushAndInit`
because the `CALL_STAT_INC` macro was redefined to a no-op
for the Tier 2 interpreter. The fix is not to `#undef` it at all.
This results in ~37% more "Frames pushed" reported
under "Call stats".
|
|
|
|
|
|
|
|
|
| |
Restore these functions removed in Python 3.13 alpha 1:
* Py_SetPythonHome()
* Py_SetProgramName()
* PySys_SetArgvEx()
* PySys_SetArgv()
|
|
|
|
| |
(GH-117997)
|
| |
|
|
|
|
|
|
|
|
| |
Quiet erroneous TSAN reports of data races in `_PySeqLock`
TSAN reports a couple of data races between the compare/exchange in
`_PySeqLock_LockWrite` and the non-atomic loads in `_PySeqLock_{Abandon,Unlock}Write`.
This is another instance of TSAN incorrectly modeling failed compare/exchange
as a write instead of a load.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
compare/exchange (#117830)
|
|
|
|
|
|
|
|
| |
and `tstate_try_attach()` (#117828)
TSAN erroneously reports a data race between the `_Py_atomic_compare_exchange_int`
on `tstate->state` in `tstate_try_attach()` and the non-atomic load of
`tstate->state` in `start_the_world`. The `_Py_atomic_compare_exchange_int` fails,
but TSAN erroneously treats it as a store.
|
|
|
|
|
| |
This marks objects as using deferred refrence counting using the
`ob_gc_bits` field in the free-threaded build and collects those objects
during GC.
|
| |
|
|
|
| |
Use Argument Clinic if possible.
|
|
|
| |
This is similar to the situation with threading._DummyThread. The methods (incl. __del__()) of interpreters.Interpreter objects must be careful with interpreters not created by interpreters.create(). The simplest thing to start with is to disable any method that modifies or runs in the interpreter. As part of this, the runtime keeps track of where an interpreter was created. We also handle interpreter "refcounts" properly.
|
|
|
|
|
|
|
|
|
|
| |
(#117651)
The free-threaded build does not currently support the combination of
single-phase init modules and non-isolated subinterpreters. Ensure that
`check_multi_interp_extensions` is always `True` for subinterpreters in
the free-threaded build so that importing these modules raises an
`ImportError`.
|
|
|
| |
In addition to the increase test coverage, this is a precursor to sorting out how we handle interpreters created directly via the C-API.
|
| |
|
|
|
|
|
| |
This keeps track of the per-thread total reference count operations in
PyThreadState in the free-threaded builds. The count is merged into the
interpreter's total when the thread exits.
|
|
|
|
|
|
|
|
|
| |
Most mutable data is protected by a striped lock that is keyed on the
referenced object's address. The weakref's hash is protected using the
weakref's per-object lock.
Note that this only affects free-threaded builds. Apart from some minor
refactoring, the added code is all either gated by `ifdef`s or is a no-op
(e.g. `Py_BEGIN_CRITICAL_SECTION`).
|
| |
|
| |
|
| |
|
|
|
| |
Make _PyDict_LoadGlobal threadsafe
|
|
|
|
| |
file (#117496)
|
|
|
|
|
|
|
|
|
|
|
|
| |
Introduce a unified 16-bit backoff counter type (``_Py_BackoffCounter``),
shared between the Tier 1 adaptive specializer and the Tier 2 optimizer. The
API used for adaptive specialization counters is changed but the behavior is
(supposed to be) identical.
The behavior of the Tier 2 counters is changed:
- There are no longer dynamic thresholds (we never varied these).
- All counters now use the same exponential backoff.
- The counter for ``JUMP_BACKWARD`` starts counting down from 16.
- The ``temperature`` in side exits starts counting down from 64.
|