Python 3.13 refcounting related memory corruption

Florian Bruhin me at the-compiler.org
Tue May 28 22:50:37 BST 2024


> On 28/05/2024 17:04, Florian Bruhin wrote:
> >> Unfortunately I've not been able to extract a minimal example by any
> >> means. The best I could get is getting it down to running 11 test 
> >> files
> >> in qutebrowser, with almost 2000 test cases. If I remove any of those
> >> files, the bug doesn't trigger anymore.
> > 
> > I've been able to reduce this to a minimal example now, which is
> > attached and (at least for me) crashes reliably with Python 3.13.
> > 
> > Florian
> 
> I can't get it to crash on either macOS or Linux.

I was only trying the minimal example with ASan enabled, i.e. with
CPython built with:

    $ export CC="/usr/bin/clang -fsanitize=address"
    $ ./configure --with-address-sanitizer  --without-pymalloc --with-pydebug

The attached revised example seems to crash more reliably with a vanilla
CPython.

If that doesn't work, try with PYTHONMALLOC=malloc (no Python rebuild
needed).

If that still doesn't work, rebuild Python as above, or try under
valgrind:

    PYTHONMALLOC=malloc valgrind python3.13 py313_crash_v2.py

Florian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: py313_crash_v2.py
Type: text/x-python
Size: 782 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20240528/53dd3dec/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20240528/53dd3dec/attachment.sig>


More information about the PyQt mailing list