summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/cf/cfsupport.py
diff options
context:
space:
mode:
Diffstat (limited to 'Mac/Modules/cf/cfsupport.py')
-rw-r--r--Mac/Modules/cf/cfsupport.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Mac/Modules/cf/cfsupport.py b/Mac/Modules/cf/cfsupport.py
index 973c4d4..bb0ac40 100644
--- a/Mac/Modules/cf/cfsupport.py
+++ b/Mac/Modules/cf/cfsupport.py
@@ -359,8 +359,10 @@ class CFStringRefObjectDefinition(MyGlobalObjectDefinition):
Out("""
if (v == Py_None) { *p_itself = NULL; return 1; }
if (PyString_Check(v)) {
- char *cStr = PyString_AsString(v);
- *p_itself = CFStringCreateWithCString((CFAllocatorRef)NULL, cStr, 0);
+ char *cStr;
+ if (!PyArg_Parse(v, "et", "ascii", &cStr))
+ return NULL;
+ *p_itself = CFStringCreateWithCString((CFAllocatorRef)NULL, cStr, kCFStringEncodingASCII);
return 1;
}
if (PyUnicode_Check(v)) {