[Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.114,2.115
Guido van Rossum
gvanrossum@users.sourceforge.net
Mon, 29 Oct 2001 06:34:00 -0800
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv9012
Modified Files:
typeobject.c
Log Message:
When overriding __str__ or __repr__, set the tp_print slot to NULL.
Index: typeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v
retrieving revision 2.114
retrieving revision 2.115
diff -C2 -d -r2.114 -r2.115
*** typeobject.c 2001/10/27 19:37:48 2.114
--- typeobject.c 2001/10/29 14:33:44 2.115
***************
*** 3381,3386 ****
--- 3381,3388 ----
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)"),