diff Objects/typeobject.c @ 20737:00a581bdedeb legacy-trunk

When overriding __str__ or __repr__, set the tp_print slot to NULL.
author Guido van Rossum <guido@python.org>
date Mon, 29 Oct 2001 14:33:44 +0000
parents 7130750a6222
children ecd64931482c
line wrap: on
line diff
--- a/Objects/typeobject.c	Mon Oct 29 11:19:46 2001 +0000
+++ b/Objects/typeobject.c	Mon Oct 29 14:33:44 2001 +0000
@@ -3380,8 +3380,10 @@
 
 	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,