Skip to content

Conversation

@fatelei
Copy link
Contributor

@fateleifatelei commented Dec 16, 2025

When _weak_cache is a descriptor that creates a new object each time it's accessed, get_weak_cache() incorrectly assumed it could return a borrowed reference and immediately decremented the reference count. This caused the newly created cache object to be freed too early, leading to use-after-free when the cache object was subsequently accessed.

fateleiand others added 26 commits December 16, 2025 15:31
…onGH-142667) The variable was previously used, but became unused after 133138a. Signed-off-by: Yongtao Huang <yongtaoh2022@gmail.com>
…#127931) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
…ython#142676) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
…-142735) We need to use release/acquire ordering for the 'mask' member of the set structure. Without this, `set_lookkey_threadsafe()` could be looking at the old value of `table` but the new value of `mask`.
…thon#141162) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Brett Cannon <brett@python.org>
…n#142243) When a `str` is encoded in `bytearray.__init__` the encoder tends to create a new unique bytes object. Rather than allocate new memory and copy the bytes use the already created bytes object as bytearray backing. The bigger the `str` the bigger the saving. Mean +- std dev: [main_encoding] 497 us +- 9 us -> [encoding] 14.2 us +- 0.3 us: 34.97x faster ```python import pyperf runner = pyperf.Runner() runner.timeit( name="encode", setup="a = 'a' * 1_000_000", stmt="bytearray(a, encoding='utf8')") ```
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

20 participants

@fatelei@picnixz@Zheaoli@hyongtao-code@AndPuQing@tungol@hugovk@serhiy-storchaka@corona10@StanFromIreland@pablogsal@adorilson@nascheme@SiliconA-Z@kumaraditya303@chaope@cmaloney@dr-carlos@vstinner@yihong0618