mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
Mod to previous checkin: we must require ascii, not system defautl encoding,
because we have no easy way to convert the python encoding string to a CF encoding parameter.
This commit is contained in:
parent
d505cab5b3
commit
885d4f6577
2 changed files with 2 additions and 2 deletions
|
|
@ -360,7 +360,7 @@ class CFStringRefObjectDefinition(MyGlobalObjectDefinition):
|
||||||
if (v == Py_None) { *p_itself = NULL; return 1; }
|
if (v == Py_None) { *p_itself = NULL; return 1; }
|
||||||
if (PyString_Check(v)) {
|
if (PyString_Check(v)) {
|
||||||
char *cStr;
|
char *cStr;
|
||||||
if (!PyArg_Parse(v, "et", "ascii", &cStr))
|
if (!PyArg_Parse(v, "es", "ascii", &cStr))
|
||||||
return NULL;
|
return NULL;
|
||||||
*p_itself = CFStringCreateWithCString((CFAllocatorRef)NULL, cStr, kCFStringEncodingASCII);
|
*p_itself = CFStringCreateWithCString((CFAllocatorRef)NULL, cStr, kCFStringEncodingASCII);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
|
|
@ -292,7 +292,7 @@ PyCF_Python2CF_string(PyObject *src, CFStringRef *dst) {
|
||||||
UniChar *unichars;
|
UniChar *unichars;
|
||||||
|
|
||||||
if (PyString_Check(src)) {
|
if (PyString_Check(src)) {
|
||||||
if (!PyArg_Parse(src, "es", NULL, &chars))
|
if (!PyArg_Parse(src, "es", "ascii", &chars))
|
||||||
return NULL; /* This error is more descriptive than the general one below */
|
return NULL; /* This error is more descriptive than the general one below */
|
||||||
*dst = CFStringCreateWithCString((CFAllocatorRef)NULL, chars, kCFStringEncodingASCII);
|
*dst = CFStringCreateWithCString((CFAllocatorRef)NULL, chars, kCFStringEncodingASCII);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue