[Python-Dev] Removing tp_compare?

Benjamin Peterson benjamin at python.org
Sat Jan 31 22:18:13 CET 2009


On Sat, Jan 31, 2009 at 3:07 PM, Mark Dickinson <dickinsm at gmail.com> wrote:
> Once the cmp removal is complete, the type object's tp_compare
> slot will no longer be used.  The current plan is to rename it to
> tp_reserved, change its type to (void *), and raise TypeError when
> initializing any type that attempts to put something nonzero into
> that slot.  But another possibility would be to remove it entirely.
> So...

I think we should keep as tp_reserved in 3.0.1. In 3.1, as I mentioned
in the issue, I'd like to reuse it as a slot for __bytes__. Confusion
could be avoided still raising a TypeError for a non-null tp_reserved
slot unless the type has Py_TPFLAGS_HAVE_BYTES flag set. After a
while, we could just make it default.

>
> N.B. The same questions apply to nb_reserved (which used
> to be nb_long) in the PyNumberMethods structure.

IMO, it's fine to keep them around, just in case.



-- 
Regards,
Benjamin


More information about the Python-Dev mailing list