summaryrefslogtreecommitdiffstats
path: root/Modules/_ctypes/_ctypes.c
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2007-05-18 17:15:44 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2007-05-18 17:15:44 (GMT)
commit1ab833082738ced53318aca05901e596d5ede683 (patch)
tree0ff2b4c1fcbab3233e012f04bce801cadfd6d7f9 /Modules/_ctypes/_ctypes.c
parent14176a56d3fe36388115688d0b5acae0c759c044 (diff)
downloadcpython-1ab833082738ced53318aca05901e596d5ede683.zip
cpython-1ab833082738ced53318aca05901e596d5ede683.tar.gz
cpython-1ab833082738ced53318aca05901e596d5ede683.tar.bz2
Add functions PyUnicode_Append() and PyUnicode_AppendAndDel() that mirror
PyString_Concat() and PyString_ConcatAndDel() (the name PyUnicode_Concat() was already taken). Change PyObject_Repr() to always return a unicode object. Update all repr implementations to return unicode objects. Add a function PyObject_ReprStr8() that calls PyObject_Repr() and converts the result to an 8bit string. Use PyObject_ReprStr8() where using PyObject_Repr() can't be done straightforward.
Diffstat (limited to 'Modules/_ctypes/_ctypes.c')
-rw-r--r--Modules/_ctypes/_ctypes.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index e7effbe..55ef0b7 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -3446,12 +3446,12 @@ CFuncPtr_repr(CFuncPtrObject *self)
{
#ifdef MS_WIN32
if (self->index)
- return PyString_FromFormat("<COM method offset %d: %s at %p>",
+ return PyUnicode_FromFormat("<COM method offset %d: %s at %p>",
self->index - 0x1000,
self->ob_type->tp_name,
self);
#endif
- return PyString_FromFormat("<%s object at %p>",
+ return PyUnicode_FromFormat("<%s object at %p>",
self->ob_type->tp_name,
self);
}
@@ -4081,12 +4081,12 @@ Simple_repr(CDataObject *self)
static PyObject *format;
if (self->ob_type->tp_base != &Simple_Type) {
- return PyString_FromFormat("<%s object at %p>",
+ return PyUnicode_FromFormat("<%s object at %p>",
self->ob_type->tp_name, self);
}
if (format == NULL) {
- format = PyString_FromString("%s(%r)");
+ format = PyUnicode_FromString("%s(%r)");
if (format == NULL)
return NULL;
}
@@ -4095,7 +4095,7 @@ Simple_repr(CDataObject *self)
if (val == NULL)
return NULL;
- name = PyString_FromString(self->ob_type->tp_name);
+ name = PyUnicode_FromString(self->ob_type->tp_name);
if (name == NULL) {
Py_DECREF(val);
return NULL;
@@ -4107,7 +4107,7 @@ Simple_repr(CDataObject *self)
if (args == NULL)
return NULL;
- result = PyString_Format(format, args);
+ result = PyUnicode_Format(format, args);
Py_DECREF(args);
return result;
}