Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1df628d

Browse files
committed
Partial fix for string handling. Null byte TBD.
1 parent c9abc1d commit 1df628d

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Mac/Modules/cf/pycfbridge.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ PyCF_CF2Python_sequence(CFArrayRef src) {
5353
if (item_cf == NULL ) goto err;
5454
item_py = PyCF_CF2Python(item_cf);
5555
if (item_py == NULL ) goto err;
56-
if (!PyList_SetItem(rv, i, item_py)) goto err;
56+
if (PyList_SetItem(rv, i, item_py) < 0) goto err;
5757
item_py = NULL;
5858
}
5959
return rv;
@@ -86,7 +86,7 @@ PyCF_CF2Python_mapping(CFTypeRef src) {
8686
if (key_py == NULL ) goto err;
8787
value_py = PyCF_CF2Python(value_py);
8888
if (value_py == NULL ) goto err;
89-
if (!PyDict_SetItem(rv, key_py, value_py)) goto err;
89+
if (PyDict_SetItem(rv, key_py, value_py) < 0) goto err;
9090
key_py = NULL;
9191
value_py = NULL;
9292
}
@@ -135,6 +135,8 @@ PyCF_CF2Python_string(CFStringRef src) {
135135
int
136136
PyCF_Python2CF(PyObject *src, CFTypeRef *dst) {
137137

138+
if (PyString_Check(src) || PyUnicode_Check(src))
139+
return PyCF_Python2CF_simple(src, dst);
138140
if (PySequence_Check(src))
139141
return PyCF_Python2CF_sequence(src, (CFArrayRef *)dst);
140142
if (PyMapping_Check(src))

0 commit comments

Comments
 (0)