diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2008-06-09 04:58:54 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2008-06-09 04:58:54 (GMT) |
commit | dd96db63f689e2f0d8ae5a1436b3b3395eec7de5 (patch) | |
tree | b2299acac9ce44fc488fc7b2ae2a44548cd5fbb8 /Mac/Modules/cf | |
parent | e98839a1f48b2915f1cc747884e64f4d6e4c8e7a (diff) | |
download | cpython-dd96db63f689e2f0d8ae5a1436b3b3395eec7de5.zip cpython-dd96db63f689e2f0d8ae5a1436b3b3395eec7de5.tar.gz cpython-dd96db63f689e2f0d8ae5a1436b3b3395eec7de5.tar.bz2 |
This reverts r63675 based on the discussion in this thread:
http://mail.python.org/pipermail/python-dev/2008-June/079988.html
Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names
in the spirit of 3.0 are available via a #define only. See the email thread.
Diffstat (limited to 'Mac/Modules/cf')
-rw-r--r-- | Mac/Modules/cf/_CFmodule.c | 30 | ||||
-rw-r--r-- | Mac/Modules/cf/pycfbridge.c | 6 |
2 files changed, 18 insertions, 18 deletions
diff --git a/Mac/Modules/cf/_CFmodule.c b/Mac/Modules/cf/_CFmodule.c index 1ea5b7e..0904ae1 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 PyBytes_FromString(buf); + return PyString_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 PyBytes_FromString(buf); + return PyString_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 PyBytes_FromString(buf); + return PyString_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 PyBytes_FromString(buf); + return PyString_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 PyBytes_FromString(buf); + return PyString_FromString(buf); } static int CFMutableDictionaryRefObj_hash(CFMutableDictionaryRefObject *self) @@ -1327,10 +1327,10 @@ int CFDataRefObj_Convert(PyObject *v, CFDataRef *p_itself) { if (v == Py_None) { *p_itself = NULL; return 1; } - if (PyBytes_Check(v)) { + if (PyString_Check(v)) { char *cStr; Py_ssize_t cLen; - if( PyBytes_AsStringAndSize(v, &cStr, &cLen) < 0 ) return 0; + if( PyString_AsStringAndSize(v, &cStr, &cLen) < 0 ) return 0; *p_itself = CFDataCreate((CFAllocatorRef)NULL, (unsigned char *)cStr, cLen); return 1; } @@ -1405,7 +1405,7 @@ static PyObject *CFDataRefObj_CFDataGetData(CFDataRefObject *_self, PyObject *_a int size = CFDataGetLength(_self->ob_itself); char *data = (char *)CFDataGetBytePtr(_self->ob_itself); - _res = (PyObject *)PyBytes_FromStringAndSize(data, size); + _res = (PyObject *)PyString_FromStringAndSize(data, size); return _res; } @@ -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 PyBytes_FromString(buf); + return PyString_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 PyBytes_FromString(buf); + return PyString_FromString(buf); } static int CFMutableDataRefObj_hash(CFMutableDataRefObject *self) @@ -1823,7 +1823,7 @@ int CFStringRefObj_Convert(PyObject *v, CFStringRef *p_itself) { if (v == Py_None) { *p_itself = NULL; return 1; } - if (PyBytes_Check(v)) { + if (PyString_Check(v)) { char *cStr; if (!PyArg_Parse(v, "es", "ascii", &cStr)) return 0; @@ -2344,7 +2344,7 @@ static PyObject *CFStringRefObj_CFStringGetString(CFStringRefObject *_self, PyOb if( data == NULL ) return PyErr_NoMemory(); if ( CFStringGetCString(_self->ob_itself, data, size, 0) ) { - _res = (PyObject *)PyBytes_FromString(data); + _res = (PyObject *)PyString_FromString(data); } else { PyErr_SetString(PyExc_RuntimeError, "CFStringGetCString could not fit the string"); _res = NULL; @@ -2445,7 +2445,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 PyBytes_FromString(buf); + return PyString_FromString(buf); } static int CFStringRefObj_hash(CFStringRefObject *self) @@ -2833,7 +2833,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 PyBytes_FromString(buf); + return PyString_FromString(buf); } static int CFMutableStringRefObj_hash(CFMutableStringRefObject *self) @@ -3485,7 +3485,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 PyBytes_FromString(buf); + return PyString_FromString(buf); } static int CFURLRefObj_hash(CFURLRefObject *self) diff --git a/Mac/Modules/cf/pycfbridge.c b/Mac/Modules/cf/pycfbridge.c index 7aa2386..06700b3 100644 --- a/Mac/Modules/cf/pycfbridge.c +++ b/Mac/Modules/cf/pycfbridge.c @@ -146,7 +146,7 @@ PyCF_CF2Python_string(CFStringRef src) { int PyCF_Python2CF(PyObject *src, CFTypeRef *dst) { - if (PyBytes_Check(src) || PyUnicode_Check(src)) + if (PyString_Check(src) || PyUnicode_Check(src)) return PyCF_Python2CF_simple(src, dst); if (PySequence_Check(src)) return PyCF_Python2CF_sequence(src, (CFArrayRef *)dst); @@ -249,7 +249,7 @@ PyCF_Python2CF_simple(PyObject *src, CFTypeRef *dst) { return (*dst != NULL); } #endif - if (PyBytes_Check(src) || PyUnicode_Check(src)) + if (PyString_Check(src) || PyUnicode_Check(src)) return PyCF_Python2CF_string(src, (CFStringRef *)dst); if (PyBool_Check(src)) { if (src == Py_True) @@ -281,7 +281,7 @@ PyCF_Python2CF_string(PyObject *src, CFStringRef *dst) { CFIndex size; UniChar *unichars; - if (PyBytes_Check(src)) { + if (PyString_Check(src)) { if (!PyArg_Parse(src, "es", "ascii", &chars)) return 0; /* This error is more descriptive than the general one below */ *dst = CFStringCreateWithCString((CFAllocatorRef)NULL, chars, kCFStringEncodingASCII); |