| Commit message (Collapse) | Author | Age | Files | Lines |
| ... | |
| |
|
|
|
|
|
|
|
|
| |
c function (GH-122072) (GH-122205)
gh-122029: Log call events in sys.setprofile when it's a method with c function (GH-122072)
Log call events in sys.setprofile when it is a method with a C function.
(cherry picked from commit e91ef13861e88c27aed51a24e58d1dcc855a01dc)
Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
|
| |
|
|
|
|
|
|
|
|
|
| |
gh-121390: tracemalloc: Fix tracebacks memory leak (GH-121391)
The tracemalloc_tracebacks hash table has traceback keys and NULL
values, but its destructors do not reflect this -- key_destroy_func is
NULL while value_destroy_func is raw_free. Swap these to free the
traceback keys instead.
(cherry picked from commit db39bc42f90c151b298f97b780e62703adbf1221)
Co-authored-by: Josh Brobst <jbrobst@proton.me>
|
| |
|
|
|
|
|
|
|
|
|
| |
(GH-121655) (#122042)
This is a small refactoring to the current design that allows us to
avoid manually iterating over threads.
This should also fix gh-118490.
(cherry picked from commit e059aa6b01030310125477c3ed1da0491020fe10)
Co-authored-by: mpage <mpage@meta.com>
|
| |
|
|
|
| |
point" (GH-121907) (GH-122012)
(cherry picked from commit 1a0c7b9ba48a2dffb70bb0c7327abae1d3e87356)
|
| |
|
|
|
|
|
|
|
| |
(GH-119769) (#121869)
gh-118934: Make PyEval_GetLocals return borrowed reference (GH-119769)
(cherry picked from commit e65cb4c6f01a687f451ad9db1600525e1c5832c4)
Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
|
| |
|
|
|
|
|
|
|
|
| |
(#121943)
gh-121621: Move asyncio_running_loop to private struct (GH-121939)
This avoids changing the ABI and keeps the field in the private struct.
(cherry picked from commit 81fd625b5c30cc6f417c93bad404923676ad8ca3)
Co-authored-by: Sam Gross <colesbury@gmail.com>
|
| |
|
|
|
|
|
|
|
| |
(GH-121154) (GH-121900)
* The result has type Py_ssize_t, not intptr_t.
* Type cast between unsigned and signed integer types should be explicit.
* Downcasting should be explicit.
* Fix integer overflow check in sum().
(cherry picked from commit 1801545)
|
| |
|
|
|
|
|
| |
(GH-121880)
(cherry picked from commit f036a463dbc43d25712183dc6afa4e38c1aaf93d)
Co-authored-by: Michael Droettboom <mdboom@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
|
| |
|
|
|
|
|
|
| |
(GH-121864)
gh-121621: Move asyncio running loop to thread state (GH-121695)
(cherry picked from commit 69c68de43aef03dd52fabd21f99cb3b0f9329201)
Co-authored-by: Ken Jin <kenjin@python.org>
|
| |
|
|
|
|
|
|
|
| |
(GH-121818) (#121861)
gh-121814: Only check f_trace_opcodes if Python frame exists (GH-121818)
(cherry picked from commit 2b1b68939b15b913080a3403e3ba18e2a1f520ef)
Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
Co-authored-by: Matt Wozniski <godlygeek@gmail.com>
|
| |
|
|
|
|
|
|
| |
(GH-120318) (#121841)
(cherry picked from commit 8549559f383dfcc0ad0c32496f62a4b737c05b4f)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(GH-121799) (#121821)
We should maintain the invariant that a zero `ob_tid` implies the
refcount fields are merged.
* Move the assignment in `_Py_MergeZeroLocalRefcount` to immediately
before the refcount merge.
* Update `_PyTrash_thread_destroy_chain` to set `ob_ref_shared` to
`_Py_REF_MERGED` when setting `ob_tid` to zero.
Also check this invariant with assertions in the GC in debug builds.
That uncovered a bug when running out of memory during GC.
(cherry picked from commit d23be3947ced081914f4458c84f729c9c37f0219)
Co-authored-by: Sam Gross <colesbury@gmail.com>
|
| |
|
|
|
|
|
|
| |
(GH-121740) (#121808)
gh-121546: Disable contextvar caching on free-threading build (GH-121740)
(cherry picked from commit e904300882055bed71cae59f8ca9161066659b7c)
Co-authored-by: Ken Jin <kenjin@python.org>
|
| |
|
|
|
|
|
|
| |
(GH-121768)
(cherry picked from commit 178e44de8f023be7a5dc400044ab61983b191f24)
Co-authored-by: Gregor <36135323+gege-hoho@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
|
| |
|
|
|
|
|
| |
_Py_FinishPendingCalls() (gh-121806)
(cherry picked from commit 985dd8e17b55ae35fc31546384fc9364f2f59f86, AKA gh-118298)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
|
| |
|
|
|
|
|
| |
proposal (GH-121699) (GH-121745)
(cherry picked from commit cae15267166e217822e3c58ac22b7817162f323a)
Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
|
| |
|
|
|
| |
hardcoding attributes (GH-121334) (#121625)
(cherry picked from commit 58e8cf2bb61f82df9eabd1209fe5e3d146e4c8cd)
|
| |
|
|
|
|
|
|
|
| |
(gh-121517)
The change in gh-118157 (b2cd54a) should have also updated clear_singlephase_extension() but didn't. We fix that here. Note that clear_singlephase_extension() (AKA _PyImport_ClearExtension()) is only used in tests.
(cherry picked from commit 15d48aea02099ffc5bdc5511cc53ced460cb31b9, AKA gh-121503)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#121505)
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.
(cherry picked from commit 1d3cf79a501a93a7a488fc75d4db3060c5ee7d1a)
Co-authored-by: Sam Gross <colesbury@gmail.com>
|
| |
|
|
| |
tier 2 (GH-121483) (GH-121494)
|
| |
|
|
|
|
| |
gh-121338: Remove GH-pragma optimize (GH-121340)
(cherry picked from commit d69529d31ccd1510843cfac1ab53bb8cb027541f)
Co-authored-by: Michael Droettboom <mdboom@gmail.com>
|
| |
|
|
|
|
|
|
| |
(gh-121051) (gh-121107)
gh-120837: Update _Py_DumpExtensionModules to be async-signal-safe (gh-121051)
(cherry picked from commit 1a2e7a747540f74414e7c50556bcb2cc127e9d1c)
Co-authored-by: Donghee Na <donghee.na@python.org>
|
| |
|
|
|
|
|
|
|
| |
(gh-121067)
This change makes things a little less painful for some users. It also fixes a failing assert (gh-120765), by making sure all subinterpreters are destroyed before the main interpreter. As part of that, we make sure Py_Finalize() always runs with the main interpreter active.
(cherry picked from commit 4be1f37b20bd51498d3adf8ad603095c0f38d6e5, AKA gh-121060)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
|
| |
|
|
|
|
|
|
|
| |
We also add _PyThreadState_NewBound() and drop _PyThreadState_SetWhence().
This change only affects internal API.
(cherry picked from commit a905721b9c5c15279e67c2f7785034b7356b2d46, AKA gh-121010)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#121043)
gh-120642: Move private PyCode APIs to the internal C API (#120643)
* Move _Py_CODEUNIT and related functions to pycore_code.h.
* Move _Py_BackoffCounter to pycore_backoff.h.
* Move Include/cpython/optimizer.h content to pycore_optimizer.h.
* Remove Include/cpython/optimizer.h.
* Remove PyUnstable_Replace_Executor().
Rename functions:
* PyUnstable_GetExecutor() => _Py_GetExecutor()
* PyUnstable_GetOptimizer() => _Py_GetOptimizer()
* PyUnstable_SetOptimizer() => _Py_SetTier2Optimizer()
* PyUnstable_Optimizer_NewCounter() => _PyOptimizer_NewCounter()
* PyUnstable_Optimizer_NewUOpOptimizer() => _PyOptimizer_NewUOpOptimizer()
(cherry picked from commit 9e4a81f00fef689c6e18a64245aa064eaadc7ac7)
|
| |
|
|
|
| |
(GH-120114) (#121000)
(cherry picked from commit 42b2c9d78da7ebd6bd5925a4d4c78aec3c9e78e6)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
issues (GH-120520) (GH-120945)
* Add an InternalDocs file describing how interning should work and how to use it.
* Add internal functions to *explicitly* request what kind of interning is done:
- `_PyUnicode_InternMortal`
- `_PyUnicode_InternImmortal`
- `_PyUnicode_InternStatic`
* Switch uses of `PyUnicode_InternInPlace` to those.
* Disallow using `_Py_SetImmortal` on strings directly.
You should use `_PyUnicode_InternImmortal` instead:
- Strings should be interned before immortalization, otherwise you're possibly
interning a immortalizing copy.
- `_Py_SetImmortal` doesn't handle the `SSTATE_INTERNED_MORTAL` to
`SSTATE_INTERNED_IMMORTAL` update, and those flags can't be changed in
backports, as they are now part of public API and version-specific ABI.
* Add private `_only_immortal` argument for `sys.getunicodeinternedsize`, used in refleak test machinery.
* Make sure the statically allocated string singletons are unique. This means these sets are now disjoint:
- `_Py_ID`
- `_Py_STR` (including the empty string)
- one-character latin-1 singletons
Now, when you intern a singleton, that exact singleton will be interned.
* Add a `_Py_LATIN1_CHR` macro, use it instead of `_Py_ID`/`_Py_STR` for one-character latin-1 singletons everywhere (including Clinic).
* Intern `_Py_STR` singletons at startup.
* For free-threaded builds, intern `_Py_LATIN1_CHR` singletons at startup.
* Beef up the tests. Cover internal details (marked with `@cpython_only`).
* Add lots of assertions
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
|
| |
|
|
|
|
|
|
|
| |
(GH-120812) (#120843)
gh-120811: Fix reference leak upon `_PyContext_Exit` failure (GH-120812)
(cherry picked from commit aed31beca9a54b85a1392631a48da80602210f18)
Co-authored-by: Peter <zintensitydev@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
|
| |
|
|
|
|
|
|
|
|
|
| |
This makes the following macros public as part of the non-limited C-API for
locking a single object or two objects at once.
* `Py_BEGIN_CRITICAL_SECTION(op)` / `Py_END_CRITICAL_SECTION()`
* `Py_BEGIN_CRITICAL_SECTION2(a, b)` / `Py_END_CRITICAL_SECTION2()`
The supporting functions and structs used by the macros are also exposed for
cases where C macros are not available.
(cherry picked from commit 8f17d69b7bc906e8407095317842cc0fd52cd84a)
|
| |
|
|
|
| |
(#120800)
(cherry picked from commit 3af7263037de1d0ef63b070fc7bfc2cf042eaebe)
|
| |
|
| |
(cherry picked from commit 55402d3)
|
| |
|
|
|
| |
(cherry picked from commit 656a1c81083b76b9d998c983f4329348a65985d3)
Co-authored-by: Xie Yanbo <xieyanbo@gmail.com>
|
| |
|
|
|
|
|
|
| |
in gh-118322 (GH-120712) (#120747)
[3.13] gh-120437: Fix `_CHECK_STACK_SPACE` optimization problems introduced in gh-118322 (GH-120712)
Signed-off-by: Manjusaka <me@manjusaka.me>
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
|
| |
|
|
|
| |
(cherry picked from commit d8f27cb1141fd3575de816438ed80a916c0560ed)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
(#120729)
gh-120726: Fix compiler warnings on is_core_module() (GH-120727)
Fix compiler warnings on is_core_module() and
check_interpreter_whence(): only define them when
assertions are built.
(cherry picked from commit a816cd67f43d9adb27ccdb6331e08c835247d1df)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
|
| |
|
|
| |
op replacement (GH-120714) (#120716)
|
| |
|
|
|
|
|
|
|
| |
(GH-119368) (#120655)
Fix a race in `PyMember_GetOne` and `PyMember_SetOne` for `Py_T_OBJECT_EX`.
These functions implement `__slots__` accesses for Python objects.
(cherry picked from commit 362cd2680b45a36c3467b9721ff7fc0ceb338452)
Co-authored-by: Daniele Parmeggiani <8658291+dpdani@users.noreply.github.com>
|
| |
|
|
|
|
|
| |
(#120654)
(cherry picked from commit 460cc9e14e221c53c0038a847bfd411fe184ebf3)
Co-authored-by: Sam Gross <colesbury@gmail.com>
|
| |
|
|
|
|
|
|
|
| |
import.c (GH-120315) (#120652)
gh-115649: Copy the filename into main interpreter before intern in import.c (GH-120315)
(cherry picked from commit 28140d1f2da1766bfbb83f58779f15255c73c871)
Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
|
| |
|
|
|
|
|
|
| |
hot-cold blocks (GH-120425) (#120621)
gh-120367: fix removal of redundant NOPs and jumps after reordering hot-cold blocks (GH-120425)
(cherry picked from commit 21866c8ed296524f0ca175c0f55b43744c2b30df)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
|
| |
|
|
|
|
|
| |
parameters expressions (GH-119976) (#120641)
(cherry picked from commit 4bf17c381fb7b465f0f26aecb94a6c54cf9be2d3)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
|
| |
|
|
|
|
|
|
| |
map() requires at least one iterable arg.
(cherry picked from commit d4039d3f6f8cb7738c5cd272dde04171446dfd2b)
Signed-off-by: Adam Williamson <awilliam@redhat.com>
Co-authored-by: Adam Williamson <adam@blueradius.ca>
|
| |
|
|
|
|
|
|
|
|
|
| |
In gh-120009 I used an atexit hook to finalize the _datetime module's static types at interpreter shutdown. However, atexit hooks are executed very early in finalization, which is a problem in the few cases where a subclass of one of those static types is still alive until the final GC collection. The static builtin types don't have this probably because they are finalized toward the end, after the final GC collection. To avoid the problem for _datetime, I have applied a similar approach here.
Also, credit goes to @mgorny and @neonene for the new tests.
FYI, I would have liked to take a slightly cleaner approach with managed static types, but wanted to get a smaller fix in first for the sake of backporting. I'll circle back to the cleaner approach with a future change on the main branch.
(cherry picked from commit b2e71ff4f8fa5b7d8117dd8125137aee3d01f015, AKA gh-120182)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
|
| |
|
|
|
|
|
|
|
| |
architecture (GH-120089) (#120413)
gh-120400 :Support Linux perf profile to see Python calls on RISC-V architecture (GH-120089)
(cherry picked from commit 4b1e85bafc5bcb8cb70bb17164e07aebf7ad7e8e)
Co-authored-by: ixgbe00 <yangwang@iscas.ac.cn>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
|
| |
|
|
|
|
|
|
|
|
| |
(#120444)
gh-117657: Fix some simple races in instrumentation.c (GH-120118)
* stop the world when setting local events
(cherry picked from commit b1b61dc4cee43920ef2b08d5ac94ddf08119c507)
Co-authored-by: Ken Jin <kenjin@python.org>
|
| |
|
|
|
|
|
| |
(GH-120391) (#120427)
(cherry picked from commit 4b5d3e0e721a952f4ac9d17bee331e6dfe543dcd)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
|
| |
|
|
|
|
|
|
| |
(GH-120330) (#120399)
gh-93691: fix too broad source locations of for statement iterators (GH-120330)
(cherry picked from commit 97b69db167be28a33688db436551a6c3c3ea4662)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
|
| |
|
|
|
|
|
|
| |
(GH-120352) (#120355)
(cherry picked from commit 1b62bcee941e54244b3ce6476aef8913604987c9)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
|
| |
|
|
| |
__class__ (GH-120295) (#120299)
|
| |
|
|
|
|
|
|
| |
handler (GH-120235) (#120249)
gh-120225: fix crash in compiler on empty block at end of exception handler (GH-120235)
(cherry picked from commit 4fc82b6d3b99f873179937215833e7a573ca7876)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
|