Mercurial > cpython-lru_cache-weakref
diff Objects/stringobject.c @ 43961:b231bda653a4
PyString_AsString is permissive and accepts unicode strings.
Replace it with PyUnicode_AsString when the argument is known to be a str.
| author | Amaury Forgeot d'Arc <amauryfa@gmail.com> |
|---|---|
| date | Thu, 22 Nov 2007 02:48:12 +0000 |
| parents | cbc8b3bd3157 |
| children | 259e8a2d6f8c |
line wrap: on
line diff
--- a/Objects/stringobject.c Thu Nov 22 01:09:33 2007 +0000 +++ b/Objects/stringobject.c Thu Nov 22 02:48:12 2007 +0000 @@ -3273,7 +3273,7 @@ if (!result) return NULL; - buf = PyString_AsString(result); + buf = PyUnicode_AsString(result); if (!buf) { Py_DECREF(result); return NULL; @@ -3284,7 +3284,7 @@ PyErr_BadInternalCall(); return NULL; } - llen = PyString_Size(result); + llen = PyUnicode_GetSize(result); if (llen > INT_MAX) { PyErr_SetString(PyExc_ValueError, "string too large in _PyString_FormatLong");
