diff options
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2007-11-22 02:48:12 (GMT) |
---|---|---|
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2007-11-22 02:48:12 (GMT) |
commit | 39599dca9db7431510f1d68609db5ea0b60af2cb (patch) | |
tree | e73e57d1e631fe1b6572bea4e915cc604fd88044 /Objects/stringobject.c | |
parent | 484fcd4521cd63beffeb45bca8396dcd7b377f0a (diff) | |
download | cpython-39599dca9db7431510f1d68609db5ea0b60af2cb.zip cpython-39599dca9db7431510f1d68609db5ea0b60af2cb.tar.gz cpython-39599dca9db7431510f1d68609db5ea0b60af2cb.tar.bz2 |
PyString_AsString is permissive and accepts unicode strings.
Replace it with PyUnicode_AsString when the argument is known to be a str.
Diffstat (limited to 'Objects/stringobject.c')
-rw-r--r-- | Objects/stringobject.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c index ae2a977..d341436 100644 --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -3273,7 +3273,7 @@ _PyString_FormatLong(PyObject *val, int flags, int prec, int type, if (!result) return NULL; - buf = PyString_AsString(result); + buf = PyUnicode_AsString(result); if (!buf) { Py_DECREF(result); return NULL; @@ -3284,7 +3284,7 @@ _PyString_FormatLong(PyObject *val, int flags, int prec, int type, 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"); |