astral-sh / astral-sh/python-build-standalone
valgrind diagnostic in uv python 3.15.0b4, but not locally built 3.15.0b4
- Dominant language
- Python
- Stars
- 4.4k
- Forks
- 314
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 27
Description
### Summary
While trying to diagnose an unrelated problem, I noticed that there's some kind of incorrect stack memory usage diagnosed by valgrind in this code:
```
$ uv run --python 3.15.0b4 valgrind --quiet --error-exitcode=13 --exit-on-first-error=yes python -c 'import _sha2; _sha2.sha512().digest()'
==999== Invalid write of size 8
==999== at 0x1B9291A: sha512_update (in /root/.local/share/uv/python/cpython-3.15.0b4-linux-x86_64-gnu/bin/python3.15)
==999== by 0x1B924A4: _Py_LibHacl_Hacl_Hash_SHA2_digest_512 (in /root/.local/share/uv/python/cpython-3.15.0b4-linux-x86_64-gnu/bin/python3.15)
==999== by 0x1B9220E: SHA512Type_digest (in /root/.local/share/uv/python/cpython-3.15.0b4-linux-x86_64-gnu/bin/python3.15)
==999== by 0x1A2796F: _TAIL_CALL_CALL (in /root/.local/share/uv/python/cpython-3.15.0b4-linux-x86_64-gnu/bin/python3.15)
==999== by 0x1A51D49: _PyEval_Vector (in /root/.local/share/uv/python/cpython-3.15.0b4-linux-x86_64-gnu/bin/python3.15)
==999== by 0x1A51A41: PyEval_EvalCode (in /root/.local/share/uv/python/cpython-3.15.0b4-linux-x86_64-gnu/bin/python3.15)
==999== by 0x1AD4202: run_mod.llvm.10306309658545239246 (in /root/.local/share/uv/python/cpython-3.15.0b4-linux-x86_64-gnu/bin/python3.15)
==999== by 0x1AD401C: _PyRun_String.llvm.10306309658545239246 (in /root/.local/share/uv/python/cpython-3.15.0b4-linux-x86_64-gnu/bin/python3.15)
==999== by 0x1B7B54C: _PyRun_SimpleString (in /root/.local/share/uv/python/cpython-3.15.0b4-linux-x86_64-gnu/bin/python3.15)
==999== by 0x1B7B44C: Py_RunMain (in /root/.local/share/uv/python/cpython-3.15.0b4-linux-x86_64-gnu/bin/python3.15)
==999== by 0x1B7AF01: pymain_main.llvm.15341643721652829911 (in /root/.local/share/uv/python/cpython-3.15.0b4-linux-x86_64-gnu/bin/python3.15)
==999== by 0x1B7AD2B: main (in /root/.local/share/uv/python/cpython-3.15.0b4-linux-x86_64-gnu/bin/python3.15)
==999== Address 0x1ffeffff68 is on thread 1's stack
==999== 160 bytes below stack pointer
==999==
==999==
==999== Exit program on first error (--exit-on-first-error=yes)
$
```
There's no valgrind diagonstic when running a freshly built git clone of cpython at the `v3.15.0b4` tag (built with the default debian compiler gcc version 14.2.0 (Debian 14.2.0-19))
```
$ ./python --version
Python 3.15.0b4
$ valgrind --quiet --error-exitcode=13 --exit-on-first-error=yes ./python -c 'import _sha2; _sha2.sha512().digest()'
$
```
### Platform
Debian GNU/Linux 13 (trixie) 6.12.69+deb13-amd64 x86_64
### Version
uv 0.11.31 (x86_64-unknown-linux-gnu)
### Python version
3.15.0a4
Contributor guide
Assessment
This issue has not been assessed yet.