]> granicus.if.org Git - python/commitdiff
When overriding __str__ or __repr__, set the tp_print slot to NULL.
authorGuido van Rossum <guido@python.org>
Mon, 29 Oct 2001 14:33:44 +0000 (14:33 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 29 Oct 2001 14:33:44 +0000 (14:33 +0000)
Objects/typeobject.c

index 026fe1496730f080d62cc7be40abeaeb2d8293de..d5f6a8f0fe6e9e4d39b9a54b4c8341d5739000e0 100644 (file)
@@ -3380,8 +3380,10 @@ static slotdef slotdefs[] = {
 
        TPSLOT("__str__", tp_str, slot_tp_str, wrap_unaryfunc,
               "x.__str__() <==> str(x)"),
+       TPSLOT("__str__", tp_print, NULL, NULL, ""),
        TPSLOT("__repr__", tp_repr, slot_tp_repr, wrap_unaryfunc,
               "x.__repr__() <==> repr(x)"),
+       TPSLOT("__repr__", tp_print, NULL, NULL, ""),
        TPSLOT("__cmp__", tp_compare, _PyObject_SlotCompare, wrap_cmpfunc,
               "x.__cmp__(y) <==> cmp(x,y)"),
        TPSLOT("__hash__", tp_hash, slot_tp_hash, wrap_hashfunc,