Skip to content

Segmentation fault on init with Python 3.10 (likely 3.9 as well) when MultiDict is subclassed (3.11,3.12,3.13 not affected) #1140

@Tishka17

Description

@Tishka17

I am using sanic with dishka and we encountered segfault in out tests when multidict==6.4.1 or 6.4.0. There is no problem on 6.2.0
We've tried python 3.10.12, 3.10.13, 3.10.17 on Linux. We do not see the problem on python 3.11-3.13. Also it looks like Windows is not affected

Minimal code to reproduce the problem

import asyncio

from sanic import Sanic

async def main():
    app = Sanic("test")
    await app.asgi_client.get("/")


if __name__ == "__main__":
    asyncio.run(main())
Current thread 0x0000725dacb1fb80 (most recent call first):
  File "/usr/local/lib/python3.10/site-packages/sanic/asgi.py", line 135 in create
  File "/usr/local/lib/python3.10/site-packages/sanic_testing/testing.py", line 324 in app_call_with_return

My pip list

# pip list 
Package           Version
----------------- ---------
aiofiles          24.1.0
anyio             4.9.0
argcomplete       3.6.2
asgi-lifespan     2.1.0
attrs             25.3.0
certifi           2025.1.31
colorlog          6.9.0
coverage          7.8.0
dependency-groups 1.3.0
dishka            0.1
distlib           0.3.9
exceptiongroup    1.2.2
filelock          3.18.0
h11               0.14.0
html5tagger       1.3.0
httpcore          1.0.7
httptools         0.6.4
httpx             0.27.2
idna              3.10
iniconfig         2.1.0
multidict         6.4.1
nox               2025.2.9
packaging         24.2
pip               23.0.1
platformdirs      4.3.7
pluggy            1.5.0
pytest            8.3.5
pytest-asyncio    0.24.0
pytest-cov        5.0.0
pytest-repeat     0.9.4
sanic             25.3.0
sanic-routing     23.12.0
sanic-testing     24.6.0
setuptools        78.1.0
sniffio           1.3.1
tomli             2.2.1
tracerite         1.1.1
typing_extensions 4.13.1
ujson             5.10.0
uvloop            0.21.0
virtualenv        20.30.0
websockets        15.0.1
wheel             0.42.0

Our failed pipeline (not much info): https://github.com/reagento/dishka/actions/runs/14364800642/job/40274975995?pr=426#step:8:2132

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions