Skip to content

Commit d9e50f5

Browse files
committed
CFStringGetUnicode() returned an extra null character at the end of the string.
fixed.
1 parent 3bfc28c commit d9e50f5

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

Mac/Modules/cf/_CFmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2349,7 +2349,7 @@ static PyObject *CFStringRefObj_CFStringGetUnicode(CFStringRefObject *_self, PyO
23492349
range.length = size;
23502350
if( data == NULL ) return PyErr_NoMemory();
23512351
CFStringGetCharacters(_self->ob_itself, range, data);
2352-
_res = (PyObject *)PyUnicode_FromUnicode(data, size);
2352+
_res = (PyObject *)PyUnicode_FromUnicode(data, size-1);
23532353
free(data);
23542354
return _res;
23552355

Mac/Modules/cf/cfsupport.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ def outputRepr(self):
575575
range.length = size;
576576
if( data == NULL ) return PyErr_NoMemory();
577577
CFStringGetCharacters(_self->ob_itself, range, data);
578-
_res = (PyObject *)PyUnicode_FromUnicode(data, size);
578+
_res = (PyObject *)PyUnicode_FromUnicode(data, size-1);
579579
free(data);
580580
return _res;
581581
"""

0 commit comments

Comments
 (0)