diff --git a/Mac/Modules/cf/_CFmodule.c b/Mac/Modules/cf/_CFmodule.c index 1f44a8eaef8..85433319fc2 100644 --- a/Mac/Modules/cf/_CFmodule.c +++ b/Mac/Modules/cf/_CFmodule.c @@ -2349,7 +2349,7 @@ static PyObject *CFStringRefObj_CFStringGetUnicode(CFStringRefObject *_self, PyO range.length = size; if( data == NULL ) return PyErr_NoMemory(); CFStringGetCharacters(_self->ob_itself, range, data); - _res = (PyObject *)PyUnicode_FromUnicode(data, size); + _res = (PyObject *)PyUnicode_FromUnicode(data, size-1); free(data); return _res; diff --git a/Mac/Modules/cf/cfsupport.py b/Mac/Modules/cf/cfsupport.py index c244c727dc7..f236e6d374e 100644 --- a/Mac/Modules/cf/cfsupport.py +++ b/Mac/Modules/cf/cfsupport.py @@ -575,7 +575,7 @@ def outputRepr(self): range.length = size; if( data == NULL ) return PyErr_NoMemory(); CFStringGetCharacters(_self->ob_itself, range, data); -_res = (PyObject *)PyUnicode_FromUnicode(data, size); +_res = (PyObject *)PyUnicode_FromUnicode(data, size-1); free(data); return _res; """