summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2002-05-08 15:29:33 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2002-05-08 15:29:33 (GMT)
commit1df628ddce2498b5b3da9834cb402a96ab2fc0f0 (patch)
tree1034092c6b009090bde55cba11cc889f3d6cdf36
parentc9abc1de6b6739a75b7eb87711a9ef30db5c682e (diff)
downloadcpython-1df628ddce2498b5b3da9834cb402a96ab2fc0f0.zip
cpython-1df628ddce2498b5b3da9834cb402a96ab2fc0f0.tar.gz
cpython-1df628ddce2498b5b3da9834cb402a96ab2fc0f0.tar.bz2
Partial fix for string handling. Null byte TBD.
-rw-r--r--Mac/Modules/cf/pycfbridge.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Mac/Modules/cf/pycfbridge.c b/Mac/Modules/cf/pycfbridge.c
index 9afc96c..a44c404 100644
--- a/Mac/Modules/cf/pycfbridge.c
+++ b/Mac/Modules/cf/pycfbridge.c
@@ -53,7 +53,7 @@ PyCF_CF2Python_sequence(CFArrayRef src) {
if (item_cf == NULL ) goto err;
item_py = PyCF_CF2Python(item_cf);
if (item_py == NULL ) goto err;
- if (!PyList_SetItem(rv, i, item_py)) goto err;
+ if (PyList_SetItem(rv, i, item_py) < 0) goto err;
item_py = NULL;
}
return rv;
@@ -86,7 +86,7 @@ PyCF_CF2Python_mapping(CFTypeRef src) {
if (key_py == NULL ) goto err;
value_py = PyCF_CF2Python(value_py);
if (value_py == NULL ) goto err;
- if (!PyDict_SetItem(rv, key_py, value_py)) goto err;
+ if (PyDict_SetItem(rv, key_py, value_py) < 0) goto err;
key_py = NULL;
value_py = NULL;
}
@@ -135,6 +135,8 @@ PyCF_CF2Python_string(CFStringRef src) {
int
PyCF_Python2CF(PyObject *src, CFTypeRef *dst) {
+ if (PyString_Check(src) || PyUnicode_Check(src))
+ return PyCF_Python2CF_simple(src, dst);
if (PySequence_Check(src))
return PyCF_Python2CF_sequence(src, (CFArrayRef *)dst);
if (PyMapping_Check(src))