[New-bugs-announce] [issue43341] functools.partial missing __weakref__ descriptor?

Dan Snider report at bugs.python.org
Sat Feb 27 13:37:25 EST 2021

New submission from Dan Snider <mr.assume.away at gmail.com>:

The only way to lookup weak references to functools.partial objects is with weakref.getweakrefs. I don't know if it's normal for extension types that define tp_weaklistoffset to not add a __weakref__ descriptor, but I figured at the very least a subtype specifying "__weakref__" in its __slots__ could get one. Instead, it fails with the partially true TypeError: __weakref__ slot disallowed: either we already got one, or __itemsize__ != 0.

messages: 387781
nosy: bup
priority: normal
severity: normal
status: open
title: functools.partial missing __weakref__ descriptor?
type: behavior
versions: Python 3.8

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list