Mercurial > cpython-lru_cache-weakref
diff Python/codecs.c @ 36501:7fdc639bc5b4 legacy-trunk
Merge ssize_t branch.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Wed, 15 Feb 2006 17:27:45 +0000 |
| parents | 79374eb6db51 |
| children | 5c36c222e7ca |
line wrap: on
line diff
--- a/Python/codecs.c Wed Feb 15 06:55:57 2006 +0000 +++ b/Python/codecs.c Wed Feb 15 17:27:45 2006 +0000 @@ -460,7 +460,7 @@ #ifdef Py_USING_UNICODE PyObject *PyCodec_IgnoreErrors(PyObject *exc) { - int end; + Py_ssize_t end; if (PyObject_IsInstance(exc, PyExc_UnicodeEncodeError)) { if (PyUnicodeEncodeError_GetEnd(exc, &end)) return NULL; @@ -478,16 +478,16 @@ return NULL; } /* ouch: passing NULL, 0, pos gives None instead of u'' */ - return Py_BuildValue("(u#i)", &end, 0, end); + return Py_BuildValue("(u#n)", &end, 0, end); } PyObject *PyCodec_ReplaceErrors(PyObject *exc) { PyObject *restuple; - int start; - int end; - int i; + Py_ssize_t start; + Py_ssize_t end; + Py_ssize_t i; if (PyObject_IsInstance(exc, PyExc_UnicodeEncodeError)) { PyObject *res; @@ -502,7 +502,7 @@ for (p = PyUnicode_AS_UNICODE(res), i = start; i<end; ++p, ++i) *p = '?'; - restuple = Py_BuildValue("(Oi)", res, end); + restuple = Py_BuildValue("(On)", res, end); Py_DECREF(res); return restuple; } @@ -510,7 +510,7 @@ Py_UNICODE res = Py_UNICODE_REPLACEMENT_CHARACTER; if (PyUnicodeDecodeError_GetEnd(exc, &end)) return NULL; - return Py_BuildValue("(u#i)", &res, 1, end); + return Py_BuildValue("(u#n)", &res, 1, end); } else if (PyObject_IsInstance(exc, PyExc_UnicodeTranslateError)) { PyObject *res; @@ -525,7 +525,7 @@ for (p = PyUnicode_AS_UNICODE(res), i = start; i<end; ++p, ++i) *p = Py_UNICODE_REPLACEMENT_CHARACTER; - restuple = Py_BuildValue("(Oi)", res, end); + restuple = Py_BuildValue("(On)", res, end); Py_DECREF(res); return restuple; } @@ -540,8 +540,8 @@ if (PyObject_IsInstance(exc, PyExc_UnicodeEncodeError)) { PyObject *restuple; PyObject *object; - int start; - int end; + Py_ssize_t start; + Py_ssize_t end; PyObject *res; Py_UNICODE *p; Py_UNICODE *startp; @@ -631,7 +631,7 @@ } *outp++ = ';'; } - restuple = Py_BuildValue("(Oi)", res, end); + restuple = Py_BuildValue("(On)", res, end); Py_DECREF(res); Py_DECREF(object); return restuple; @@ -652,8 +652,8 @@ if (PyObject_IsInstance(exc, PyExc_UnicodeEncodeError)) { PyObject *restuple; PyObject *object; - int start; - int end; + Py_ssize_t start; + Py_ssize_t end; PyObject *res; Py_UNICODE *p; Py_UNICODE *startp; @@ -708,7 +708,7 @@ *outp++ = hexdigits[c&0xf]; } - restuple = Py_BuildValue("(Oi)", res, end); + restuple = Py_BuildValue("(On)", res, end); Py_DECREF(res); Py_DECREF(object); return restuple;
