When overriding __str__ or __repr__, set the tp_print slot to NULL.
This commit is contained in:
parent
7c01786188
commit
afe7a94089
|
@ -3380,8 +3380,10 @@ static slotdef slotdefs[] = {
|
||||||
|
|
||||||
TPSLOT("__str__", tp_str, slot_tp_str, wrap_unaryfunc,
|
TPSLOT("__str__", tp_str, slot_tp_str, wrap_unaryfunc,
|
||||||
"x.__str__() <==> str(x)"),
|
"x.__str__() <==> str(x)"),
|
||||||
|
TPSLOT("__str__", tp_print, NULL, NULL, ""),
|
||||||
TPSLOT("__repr__", tp_repr, slot_tp_repr, wrap_unaryfunc,
|
TPSLOT("__repr__", tp_repr, slot_tp_repr, wrap_unaryfunc,
|
||||||
"x.__repr__() <==> repr(x)"),
|
"x.__repr__() <==> repr(x)"),
|
||||||
|
TPSLOT("__repr__", tp_print, NULL, NULL, ""),
|
||||||
TPSLOT("__cmp__", tp_compare, _PyObject_SlotCompare, wrap_cmpfunc,
|
TPSLOT("__cmp__", tp_compare, _PyObject_SlotCompare, wrap_cmpfunc,
|
||||||
"x.__cmp__(y) <==> cmp(x,y)"),
|
"x.__cmp__(y) <==> cmp(x,y)"),
|
||||||
TPSLOT("__hash__", tp_hash, slot_tp_hash, wrap_hashfunc,
|
TPSLOT("__hash__", tp_hash, slot_tp_hash, wrap_hashfunc,
|
||||||
|
|
Loading…
Reference in New Issue