Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.12: pytest seg faults with mpl tests #227

Closed
bje- opened this issue Jun 12, 2024 · 4 comments
Closed

Python 3.12: pytest seg faults with mpl tests #227

bje- opened this issue Jun 12, 2024 · 4 comments

Comments

@bje-
Copy link

bje- commented Jun 12, 2024

I am testing my package on Python 3.12. The testsuite uses pytest-mpl. When running the following minimised test case, pytest (well, presumably, the Python interpreter) segfaults. Any test that does not use mpl decorators runs fine.

import pytest
import unittest
import matplotlib.pyplot as plt

class TestUtils(unittest.TestCase):

    @pytest.mark.mpl_image_compare
    def test_figure_1(self):
        return plt.figure()
@bje-
Copy link
Author

bje- commented Jun 12, 2024

I ran python3.12 under GDB and ran -m pytest testcase.py and got this backtrace:

Thread 1 "python3.12" received signal SIGSEGV, Segmentation fault.
0x00000000005333f0 in _PyInterpreterState_GET () at ../Include/internal/pycore_pystate.h:133
(gdb) bt
#0  0x00000000005333f0 in _PyInterpreterState_GET () at ../Include/internal/pycore_pystate.h:133
#1  get_state () at ../Objects/obmalloc.c:866
#2  _PyObject_Free (p=0x20bf0b0, ctx=0x0) at ../Objects/obmalloc.c:1850
#3  PyMem_Free (ptr=0x20bf0b0) at ../Objects/obmalloc.c:732
#4  0x00007fffe5921839 in sip_api_free (mem=<optimised out>) at ../../../../sip/siplib/siplib.c:2162
#5  0x00007fffe591d61d in sipOMFinalise (om=om@entry=0x7fffe593fec0 <cppPyMap>)
    at ../../../../sip/siplib/objmap.c:69
#6  0x00007fffe5921a2f in finalise () at ../../../../sip/siplib/siplib.c:2064
#7  0x00000000004630c1 in call_ll_exitfuncs (runtime=<optimised out>) at ../Python/pylifecycle.c:3046
#8  Py_FinalizeEx () at ../Python/pylifecycle.c:2005
#9  0x0000000000657a9e in Py_RunMain () at ../Modules/main.c:711
#10 0x0000000000610acd in Py_BytesMain (argc=<optimised out>, argv=<optimised out>) at ../Modules/main.c:763
#11 0x00007ffff7c29d90 in __libc_start_call_main
     (main=main@entry=0x610a10 <main>, argc=argc@entry=4, argv=argv@entry=0x7fffffffe2b8)
    at ../sysdeps/nptl/libc_start_call_main.h:58
#12 0x00007ffff7c29e40 in __libc_start_main_impl
     (main=0x610a10 <main>, argc=4, argv=0x7fffffffe2b8, init=<optimised out>, fini=<optimised out>, rtld_fini=<optimised out>, stack_end=0x7fffffffe2a8) at ../csu/libc-start.c:392
#13 0x0000000000610945 in _start ()

@bje-
Copy link
Author

bje- commented Jun 12, 2024

I figure this is very likely to be a Python interpreter bug, so filed python/cpython#120387 as well.

@bje-
Copy link
Author

bje- commented Jun 12, 2024

pytest no longer implicated :-)

@bje-
Copy link
Author

bje- commented Jun 12, 2024

Closing.

@bje- bje- closed this as completed Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant