| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
| |
Basically, I've turned most of _PyImport_LoadDynamicModuleWithSpec() into two new functions (_PyImport_GetModInitFunc() and _PyImport_RunModInitFunc()) and moved the rest of it out into _imp_create_dynamic_impl(). There shouldn't be any changes in behavior.
This change makes some future changes simpler. This is particularly relevant to potentially calling each module init function in the main interpreter first. Thus the critical part of the PR is the addition of _PyImport_RunModInitFunc(), which is strictly focused on running the init func and validating the result. A later PR will take it a step farther by capturing error information rather than raising exceptions.
FWIW, this change also helps readers by clarifying a bit more about what happens when an extension/builtin module is imported.
|
| |
|
| |
|
|
|
|
|
| |
inlining (#118160)
Co-authored-by: Carl Meyer <carl@oddbird.net>
|
|
|
|
| |
Switch GIL to disabled by default in free-threaded build so that the
free-threaded CIs catch thread-safety issues.
|
|
|
|
| |
(GH-118279)
|
| |
|
| |
|
|
|
| |
This does some cleanup in preparation for later changes.
|
| |
|
| |
|
|
|
|
|
| |
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.
|