mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
PyString_AsString is permissive and accepts unicode strings.
Replace it with PyUnicode_AsString when the argument is known to be a str.
This commit is contained in:
parent
484fcd4521
commit
39599dca9d
5 changed files with 9 additions and 9 deletions
|
@ -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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue