Accept only the system default encoding when converting Python
strings to CF strings. Fixes 682215.
diff --git a/Mac/Modules/cf/pycfbridge.c b/Mac/Modules/cf/pycfbridge.c
index 00efa72..d4466ac 100644
--- a/Mac/Modules/cf/pycfbridge.c
+++ b/Mac/Modules/cf/pycfbridge.c
@@ -292,8 +292,9 @@
UniChar *unichars;
if (PyString_Check(src)) {
- if ((chars = PyString_AsString(src)) == NULL ) goto err;
- *dst = CFStringCreateWithCString((CFAllocatorRef)NULL, chars, 0);
+ if (!PyArg_Parse(src, "es", NULL, &chars))
+ return NULL; /* This error is more descriptive than the general one below */
+ *dst = CFStringCreateWithCString((CFAllocatorRef)NULL, chars, kCFStringEncodingASCII);
return 1;
}
if (PyUnicode_Check(src)) {