summaryrefslogtreecommitdiffstats
path: root/Mac/Modules
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 /Mac/Modules
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 'Mac/Modules')
-rw-r--r--Mac/Modules/cf/_CFmodule.c20
-rw-r--r--Mac/Modules/file/_Filemodule.c2
-rw-r--r--Mac/Modules/win/_Winmodule.c2
3 files changed, 12 insertions, 12 deletions
diff --git a/Mac/Modules/cf/_CFmodule.c b/Mac/Modules/cf/_CFmodule.c
index 3f4d4f2..8d78022 100644
--- a/Mac/Modules/cf/_CFmodule.c
+++ b/Mac/Modules/cf/_CFmodule.c
@@ -392,7 +392,7 @@ static PyObject * CFTypeRefObj_repr(CFTypeRefObject *self)
{
char buf[100];
sprintf(buf, "<CFTypeRef type-%d object at 0x%8.8x for 0x%8.8x>", (int)CFGetTypeID(self->ob_itself), (unsigned)self, (unsigned)self->ob_itself);
- return PyString_FromString(buf);
+ return PyUnicode_FromString(buf);
}
static int CFTypeRefObj_hash(CFTypeRefObject *self)
@@ -596,7 +596,7 @@ static PyObject * CFArrayRefObj_repr(CFArrayRefObject *self)
{
char buf[100];
sprintf(buf, "<CFArrayRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
- return PyString_FromString(buf);
+ return PyUnicode_FromString(buf);
}
static int CFArrayRefObj_hash(CFArrayRefObject *self)
@@ -836,7 +836,7 @@ static PyObject * CFMutableArrayRefObj_repr(CFMutableArrayRefObject *self)
{
char buf[100];
sprintf(buf, "<CFMutableArrayRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
- return PyString_FromString(buf);
+ return PyUnicode_FromString(buf);
}
static int CFMutableArrayRefObj_hash(CFMutableArrayRefObject *self)
@@ -1029,7 +1029,7 @@ static PyObject * CFDictionaryRefObj_repr(CFDictionaryRefObject *self)
{
char buf[100];
sprintf(buf, "<CFDictionaryRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
- return PyString_FromString(buf);
+ return PyUnicode_FromString(buf);
}
static int CFDictionaryRefObj_hash(CFDictionaryRefObject *self)
@@ -1206,7 +1206,7 @@ static PyObject * CFMutableDictionaryRefObj_repr(CFMutableDictionaryRefObject *s
{
char buf[100];
sprintf(buf, "<CFMutableDictionaryRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
- return PyString_FromString(buf);
+ return PyUnicode_FromString(buf);
}
static int CFMutableDictionaryRefObj_hash(CFMutableDictionaryRefObject *self)
@@ -1437,7 +1437,7 @@ static PyObject * CFDataRefObj_repr(CFDataRefObject *self)
{
char buf[100];
sprintf(buf, "<CFDataRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
- return PyString_FromString(buf);
+ return PyUnicode_FromString(buf);
}
static int CFDataRefObj_hash(CFDataRefObject *self)
@@ -1702,7 +1702,7 @@ static PyObject * CFMutableDataRefObj_repr(CFMutableDataRefObject *self)
{
char buf[100];
sprintf(buf, "<CFMutableDataRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
- return PyString_FromString(buf);
+ return PyUnicode_FromString(buf);
}
static int CFMutableDataRefObj_hash(CFMutableDataRefObject *self)
@@ -2444,7 +2444,7 @@ static PyObject * CFStringRefObj_repr(CFStringRefObject *self)
{
char buf[100];
sprintf(buf, "<CFStringRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
- return PyString_FromString(buf);
+ return PyUnicode_FromString(buf);
}
static int CFStringRefObj_hash(CFStringRefObject *self)
@@ -2832,7 +2832,7 @@ static PyObject * CFMutableStringRefObj_repr(CFMutableStringRefObject *self)
{
char buf[100];
sprintf(buf, "<CFMutableStringRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
- return PyString_FromString(buf);
+ return PyUnicode_FromString(buf);
}
static int CFMutableStringRefObj_hash(CFMutableStringRefObject *self)
@@ -3484,7 +3484,7 @@ static PyObject * CFURLRefObj_repr(CFURLRefObject *self)
{
char buf[100];
sprintf(buf, "<CFURL object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
- return PyString_FromString(buf);
+ return PyUnicode_FromString(buf);
}
static int CFURLRefObj_hash(CFURLRefObject *self)
diff --git a/Mac/Modules/file/_Filemodule.c b/Mac/Modules/file/_Filemodule.c
index 07bd341..768f1a2 100644
--- a/Mac/Modules/file/_Filemodule.c
+++ b/Mac/Modules/file/_Filemodule.c
@@ -1393,7 +1393,7 @@ static PyObject * FSSpec_repr(FSSpecObject *self)
self->ob_itself.vRefNum,
self->ob_itself.parID,
self->ob_itself.name[0], self->ob_itself.name+1);
- return PyString_FromString(buf);
+ return PyUnicode_FromString(buf);
}
#define FSSpec_hash NULL
diff --git a/Mac/Modules/win/_Winmodule.c b/Mac/Modules/win/_Winmodule.c
index fa8c52d..3841775 100644
--- a/Mac/Modules/win/_Winmodule.c
+++ b/Mac/Modules/win/_Winmodule.c
@@ -2580,7 +2580,7 @@ static PyObject * WinObj_repr(WindowObject *self)
{
char buf[100];
sprintf(buf, "<Window object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
- return PyString_FromString(buf);
+ return PyUnicode_FromString(buf);
}
static int WinObj_hash(WindowObject *self)