-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Open
Milestone
Description
Bug summary
Running ft2font import through pytest with pytest-cov plugin causes Python to crash.
Code for reproduction
MRE:
from matplotlib import ft2font
def test_dummy():
pass
print('unreachable')
Env:
python3 -m venv ./venv
source ./venv/bin/activate.fish
pip install matplotlib pytest pytest-cov
pytest ./segft2.py
Actual outcome
====================================== test session starts =======================================
platform linux -- Python 3.13.3, pytest-8.3.5, pluggy-1.5.0
rootdir: /home/mmatous/playground/segft2
plugins: cov-6.1.1
collecting ... fish: Job 1, 'pytest ./segft2.py' terminated by signal SIGSEGV (Address boundary error)
Expected outcome
====================================== test session starts =======================================
platform linux -- Python 3.13.3, pytest-8.3.5, pluggy-1.5.0
rootdir: /home/mmatous/playground/segft2
collected 1 item
segft2.py . [100%]
======================================= 1 passed in 0.09s ========================================
Additional information
- Uninstalling pytest-cov makes dummy test pass.
- matplotlib-3.9.4 is unaffected.
- matplotlib-3.10.0 is affected.
- main HEAD (828ec6f) is affected.
- Persists even after copying system ft2font.*.so into venv (so not simply broken wheels).
Possibly not related to pytest specifically, but being run as subprocess or being loaded multiple times in general?I encounter the same problem when trying to build doc. withtox run -e docs-dev
while setting up https://pydata-sphinx-theme.readthedocs.io/en/latest/community/setup.html#build-the-documentation where MPL is a dependency.CPU: AMD Ryzen 9 7950X (in case it's some weird hw/simd/optimization thing)- Feel free to ask for more info, I don't know much about debugging C/Python boundary, so for now here's an LLDB backtrace:
(lldb) bt
* thread #1, name = 'pytest', stop reason = SIGSEGV: address not mapped to object (fault address=0x0)
* frame #0: 0x0000000000000000
frame #1: 0x00007f211fd9dc00 libunwind.so.8`_ULx86_64_dwarf_find_proc_info(as=0x00007ffd900eb900, ip=140727020337416, pi=0x00007ffd900eb958, need_unwind_info=1, arg=<unavailable>) at Gfind_proc_info-lsb.c:807:9
frame #2: 0x00007f211fd9e817 libunwind.so.8`fetch_proc_info(c=0x00007ffd900eb800, ip=<unavailable>) at Gparser.c:473:18
frame #3: 0x00007f211fd96e73 libunwind.so.8`_Unwind_GetLanguageSpecificData [inlined] _ULx86_64_dwarf_make_proc_info(c=<unavailable>) at Gparser.c:1089:9
frame #4: 0x00007f211fd96e61 libunwind.so.8`_Unwind_GetLanguageSpecificData [inlined] _ULx86_64_get_proc_info(cursor=<unavailable>, pi=<unavailable>) at Gget_proc_info.c:35:7
frame #5: 0x00007f211fd96e61 libunwind.so.8`_Unwind_GetLanguageSpecificData(context=<unavailable>) at GetLanguageSpecificData.c:34:3
frame #6: 0x00007f211eee32dd libstdc++.so.6`__gxx_personality_v0 + 285
frame #7: 0x00007f211fd7f6dc libgcc_s.so.1`___lldb_unnamed_symbol337 + 156
frame #8: 0x00007f211fd80001 libgcc_s.so.1`_Unwind_Resume + 161
frame #9: 0x00007f20ca1fb720 ft2font.cpython-313-x86_64-linux-gnu.so`ft2font__getattr__(std::string) (.lto_priv.0.cold) + 81
frame #10: 0x00007f20ca2351c6 ft2font.cpython-313-x86_64-linux-gnu.so`void pybind11::cpp_function::initialize<pybind11::object (*&)(std::string), pybind11::object, std::string, pybind11::name, pybind11::scope, pybind11::sibling>(pybind11::object (*&)(std::string), pybind11::object (*)(std::string), pybind11::name const&, pybind11::scope const&, pybind11::sibling const&)::'lambda1'(pybind11::detail::function_call&)::_FUN(pybind11::detail::function_call&) + 454
frame #11: 0x00007f20ca20ba3d ft2font.cpython-313-x86_64-linux-gnu.so`pybind11::cpp_function::dispatcher(_object*, _object*, _object*) + 3373
frame #12: 0x00007f21219587f7 libpython3.13.so.1.0`cfunction_call(func=0x00007f20ca3c3880, args=0x0000000000000000, kwargs=0x0000000000000000) at methodobject.c:540:18
Operating system
Gentoo
Matplotlib Version
3.10.1
Matplotlib Backend
tkagg
Python version
Python 3.13.3
Jupyter version
No response
Installation
pip
Metadata
Metadata
Assignees
Labels
No labels