mirror of
https://github.com/python/cpython.git
synced 2025-11-03 11:23:31 +00:00
PyString_FromString: this requires its argument be non-NULL, but doesn't
check it. Added an assert() to that effect.
This commit is contained in:
parent
604ddf80d8
commit
62de65b25e
1 changed files with 4 additions and 1 deletions
|
|
@ -105,8 +105,11 @@ PyString_FromStringAndSize(const char *str, int size)
|
||||||
PyObject *
|
PyObject *
|
||||||
PyString_FromString(const char *str)
|
PyString_FromString(const char *str)
|
||||||
{
|
{
|
||||||
register size_t size = strlen(str);
|
register size_t size;
|
||||||
register PyStringObject *op;
|
register PyStringObject *op;
|
||||||
|
|
||||||
|
assert(str != NULL);
|
||||||
|
size = strlen(str);
|
||||||
if (size > INT_MAX) {
|
if (size > INT_MAX) {
|
||||||
PyErr_SetString(PyExc_OverflowError,
|
PyErr_SetString(PyExc_OverflowError,
|
||||||
"string is too long for a Python string");
|
"string is too long for a Python string");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue