Commit e1a72a2b authored by Jim Fulton's avatar Jim Fulton

Changed the way default reprs are done to make them consistent with

the way Python does them.  In particular, we we has a "0x" prefix on
the address part that Python strips off.  This has to be fixed
so that Zope's detection of non-content would work.
parent 89f4952f
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE. DAMAGE.
$Id: ExtensionClass.c,v 1.33 1999/05/12 15:49:55 jim Exp $ $Id: ExtensionClass.c,v 1.34 1999/05/24 13:47:02 jim Exp $
If you have questions regarding this software, If you have questions regarding this software,
contact: contact:
...@@ -54,7 +54,7 @@ static char ExtensionClass_module_documentation[] = ...@@ -54,7 +54,7 @@ static char ExtensionClass_module_documentation[] =
" - They provide access to unbound methods,\n" " - They provide access to unbound methods,\n"
" - They can be called to create instances.\n" " - They can be called to create instances.\n"
"\n" "\n"
"$Id: ExtensionClass.c,v 1.33 1999/05/12 15:49:55 jim Exp $\n" "$Id: ExtensionClass.c,v 1.34 1999/05/24 13:47:02 jim Exp $\n"
; ;
#include <stdio.h> #include <stdio.h>
...@@ -2012,7 +2012,7 @@ err: ...@@ -2012,7 +2012,7 @@ err:
static PyObject * static PyObject *
CCL_repr(PyExtensionClass *self) CCL_repr(PyExtensionClass *self)
{ {
char p[128]; char p[64], *pp;
PyObject *m; PyObject *m;
if ((m=PyObject_GetAttr(OBJECT(self), py__module__))) if ((m=PyObject_GetAttr(OBJECT(self), py__module__)))
...@@ -2026,11 +2026,14 @@ CCL_repr(PyExtensionClass *self) ...@@ -2026,11 +2026,14 @@ CCL_repr(PyExtensionClass *self)
else PyErr_Clear(); else PyErr_Clear();
sprintf(p,"%p",self); sprintf(p,"%p",self);
if (*p=='0' && p[1]=='x') pp=p+2;
else pp=p;
if (m) ASSIGN(m, JimString_Build("<extension class %s.%s at %s>","Oss", if (m) ASSIGN(m, JimString_Build("<extension class %s.%s at %s>","Oss",
m, self->tp_name, p)); m, self->tp_name, pp));
else m= JimString_Build("<extension class %s at %s>","ss", else m= JimString_Build("<extension class %s at %s>","ss",
self->tp_name, p); self->tp_name, pp);
return m; return m;
} }
...@@ -2277,12 +2280,14 @@ subclass_hash(PyObject *self) ...@@ -2277,12 +2280,14 @@ subclass_hash(PyObject *self)
static PyObject * static PyObject *
default_subclass_repr(PyObject *self) default_subclass_repr(PyObject *self)
{ {
char p[64]; char p[64], *pp;
PyErr_Clear(); PyErr_Clear();
sprintf(p,"%p",self); sprintf(p,"%p",self);
if (*p=='0' && p[1]=='x') pp=p+2;
else pp=p;
return JimString_Build("<%s instance at %s>","ss", return JimString_Build("<%s instance at %s>","ss",
self->ob_type->tp_name, p); self->ob_type->tp_name, pp);
} }
static PyObject * static PyObject *
...@@ -3398,7 +3403,7 @@ void ...@@ -3398,7 +3403,7 @@ void
initExtensionClass() initExtensionClass()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.33 $"; char *rev="$Revision: 1.34 $";
PURE_MIXIN_CLASS(Base, "Minimalbase class for Extension Classes", NULL); PURE_MIXIN_CLASS(Base, "Minimalbase class for Extension Classes", NULL);
PMethodType.ob_type=&PyType_Type; PMethodType.ob_type=&PyType_Type;
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE. DAMAGE.
$Id: ExtensionClass.c,v 1.33 1999/05/12 15:49:55 jim Exp $ $Id: ExtensionClass.c,v 1.34 1999/05/24 13:47:02 jim Exp $
If you have questions regarding this software, If you have questions regarding this software,
contact: contact:
...@@ -54,7 +54,7 @@ static char ExtensionClass_module_documentation[] = ...@@ -54,7 +54,7 @@ static char ExtensionClass_module_documentation[] =
" - They provide access to unbound methods,\n" " - They provide access to unbound methods,\n"
" - They can be called to create instances.\n" " - They can be called to create instances.\n"
"\n" "\n"
"$Id: ExtensionClass.c,v 1.33 1999/05/12 15:49:55 jim Exp $\n" "$Id: ExtensionClass.c,v 1.34 1999/05/24 13:47:02 jim Exp $\n"
; ;
#include <stdio.h> #include <stdio.h>
...@@ -2012,7 +2012,7 @@ err: ...@@ -2012,7 +2012,7 @@ err:
static PyObject * static PyObject *
CCL_repr(PyExtensionClass *self) CCL_repr(PyExtensionClass *self)
{ {
char p[128]; char p[64], *pp;
PyObject *m; PyObject *m;
if ((m=PyObject_GetAttr(OBJECT(self), py__module__))) if ((m=PyObject_GetAttr(OBJECT(self), py__module__)))
...@@ -2026,11 +2026,14 @@ CCL_repr(PyExtensionClass *self) ...@@ -2026,11 +2026,14 @@ CCL_repr(PyExtensionClass *self)
else PyErr_Clear(); else PyErr_Clear();
sprintf(p,"%p",self); sprintf(p,"%p",self);
if (*p=='0' && p[1]=='x') pp=p+2;
else pp=p;
if (m) ASSIGN(m, JimString_Build("<extension class %s.%s at %s>","Oss", if (m) ASSIGN(m, JimString_Build("<extension class %s.%s at %s>","Oss",
m, self->tp_name, p)); m, self->tp_name, pp));
else m= JimString_Build("<extension class %s at %s>","ss", else m= JimString_Build("<extension class %s at %s>","ss",
self->tp_name, p); self->tp_name, pp);
return m; return m;
} }
...@@ -2277,12 +2280,14 @@ subclass_hash(PyObject *self) ...@@ -2277,12 +2280,14 @@ subclass_hash(PyObject *self)
static PyObject * static PyObject *
default_subclass_repr(PyObject *self) default_subclass_repr(PyObject *self)
{ {
char p[64]; char p[64], *pp;
PyErr_Clear(); PyErr_Clear();
sprintf(p,"%p",self); sprintf(p,"%p",self);
if (*p=='0' && p[1]=='x') pp=p+2;
else pp=p;
return JimString_Build("<%s instance at %s>","ss", return JimString_Build("<%s instance at %s>","ss",
self->ob_type->tp_name, p); self->ob_type->tp_name, pp);
} }
static PyObject * static PyObject *
...@@ -3398,7 +3403,7 @@ void ...@@ -3398,7 +3403,7 @@ void
initExtensionClass() initExtensionClass()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.33 $"; char *rev="$Revision: 1.34 $";
PURE_MIXIN_CLASS(Base, "Minimalbase class for Extension Classes", NULL); PURE_MIXIN_CLASS(Base, "Minimalbase class for Extension Classes", NULL);
PMethodType.ob_type=&PyType_Type; PMethodType.ob_type=&PyType_Type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment