summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-10-29 14:33:44 (GMT)
committerGuido van Rossum <guido@python.org>2001-10-29 14:33:44 (GMT)
commitafe7a94089dab0fea0694647e91988df29d23c1c (patch)
treecc20cda7ef29fefd8c7525cd286bc19f81c1df1c /Objects
parent7c0178618875b09241d389d1e415a1bb6142c13d (diff)
downloadcpython-afe7a94089dab0fea0694647e91988df29d23c1c.zip
cpython-afe7a94089dab0fea0694647e91988df29d23c1c.tar.gz
cpython-afe7a94089dab0fea0694647e91988df29d23c1c.tar.bz2
When overriding __str__ or __repr__, set the tp_print slot to NULL.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 026fe14..d5f6a8f 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -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,