You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reference leak in is_namedtuple_class when _fields is not exactly a tuple #1376
Building a decoder for a tuple subclass whose _fields attribute is not exactly a tuple leaks one reference to that _fields object per build. In is_namedtuple_class (src/msgspec/_core.c), the early return false after if (!PyTuple_CheckExact(fields)) skips the Py_DECREF(fields) that the other paths perform. The check was added in 76d4402 (#1259). Release 0.22.0 does not show the leak, so this is only on main.
Expected: the refcount of _fields does not grow. There is no exception or traceback; the exception from the Decoder call is caught in the script. With msgspec 0.22.0 the same script prints growth == 0.
Activity