cpython
cpython copied to clipboard
The Python programming language
At the sprints at PyConUS 2024, @brandtbucher suggested an improvement to pystats data. Right now, the Tier 2 stats include a count of how many times each UOp is executed,...
As suggested by @ncoghlan: * Added `test_nonlocal.py` * Added a Documentation NEWS entry * Added a Tests NEWS entry In tests, I've decided to use simply the variable names, rather...
* Issue: gh-139899 ---- 📚 Documentation preview 📚: https://cpython-previews--139900.org.readthedocs.build/
fix OrderedDict copy heap-use-after-free security issue * Issue: gh-142734
* Issue: gh-142555
### What happened? A crafted integer subclass overrides `__int__` so when `TextIOWrapper.seek` converts the cookie with `PyNumber_Long` it detaches the wrapper and frees the buffer, yet the seek logic continues...
This fix actually changes the existing behavior but messing up with the memoryview while still being accessed is honestly a poor design choice and I don't know when it'd be...
### What happened? `memory_subscript()` creates a new view (`mbuf_add_view`) **before** parsing slice indices. If a slice bound’s `__index__` releases/truncates the underlying buffer (e.g., `mv.release(); ftruncate()`), the newly created subview keeps...
FTR, the reason why `execute` is actually _not_ affected is that the iterator we are taking is built from a list we create ourselves so it's not possible to have...
### What happened? A crafted indent object overrides `__mul__`, so when `create_indent_cache` calls `PySequence_Repeat` it can drop the encoder’s last reference and free the encoder mid‑call. The freed memory is...