Debian Patches

Status for mypy/1.20.2-2

Patch Description Author Forwarded Bugs Origin Last update
0001-mypyc-Generate-more-type-methods-for-types-with-mana.patch [mypyc] Generate more type methods for types with managed dicts (#21290)
Fixes #21133

Types with the `Py_TPFLAGS_MANAGED_DICT` flag must call
`PyObject_VisitManagedDict` and `PyObject_ClearManagedDict` in their
`tp_traverse` / `tp_clear` functions according to
[docs](https://docs.python.org/3/c-api/typeobj.html#c.Py_TPFLAGS_MANAGED_DICT)
but the types generated by mypyc currently don't do this. We don't
generate these functions at all so they get inherited from the base
class.

Failure to call these functions may result in a segfault in python 3.14
when accessing the managed dict after its owner has been deallocated. I
believe the crash happens because the logic for types with the
`Py_TPFLAGS_INLINE_VALUES` flag in
[`PyObject_ClearManagedDict`](https://github.com/python/cpython/blob/main/Objects/dictobject.c#L7803)
is not run. The condition to add this flag has changed in
[3.14](https://github.com/python/cpython/blob/3.14/Objects/typeobject.c#L8877)
vs
[3.13](https://github.com/python/cpython/blob/3.13/Objects/typeobject.c#L8171)
so generated types with `Py_TPFLAGS_MANAGED_DICT` get it in 3.14.

To fix, generate `tp_clear`, `tp_traverse`, and `tp_dealloc` for types
with managed dicts. Also add a special case in these functions for
classes with built-in bases to call the pointer of the base class.
Piotr Sawicki <sawickipiotr@outlook.com> no upstream, https://github.com/python/mypy/commit/c56ab5857047edac41db0826b2f83c5a3d476bc0 2026-04-23
remove-mypyc-test-run-timeout remove 30 seconds timeout, due to slower architectures
With Python version 3.13.x & 3.14.x we don't see any hangs
But on sparc64 with hit the timeout, so remove it
Michael R. Crusoe <crusoe@debian.org> no
hint-typeshed-package point to python3-typeshed package for missing types "Michael R. Crusoe" <crusoe@debian.org> not-needed 2024-08-14
verbose make the build more verbose "Michael R. Crusoe" <crusoe@debian.org> not-needed 2022-04-02
intersphinx link to local documenatin "Michael R. Crusoe" <crusoe@debian.org> not-needed 2022-04-02

All known versions for source package 'mypy'

Links