Merged revisions 66693 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r66693 | benjamin.peterson | 2008-09-29 21:11:07 -0500 (Mon, 29 Sep 2008) | 4 lines Victor Stinner's patches to check the return result of PyLong_Ssize_t reviewed by Amaury ........
This commit is contained in:
parent
cb9a5517d0
commit
a8a93042dc
|
@ -221,6 +221,8 @@ bytesio_read(BytesIOObject *self, PyObject *args)
|
||||||
|
|
||||||
if (PyLong_Check(arg)) {
|
if (PyLong_Check(arg)) {
|
||||||
size = PyLong_AsSsize_t(arg);
|
size = PyLong_AsSsize_t(arg);
|
||||||
|
if (size == -1 && PyErr_Occurred())
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
else if (arg == Py_None) {
|
else if (arg == Py_None) {
|
||||||
/* Read until EOF is reached, by default. */
|
/* Read until EOF is reached, by default. */
|
||||||
|
@ -288,6 +290,8 @@ bytesio_readline(BytesIOObject *self, PyObject *args)
|
||||||
|
|
||||||
if (PyLong_Check(arg)) {
|
if (PyLong_Check(arg)) {
|
||||||
size = PyLong_AsSsize_t(arg);
|
size = PyLong_AsSsize_t(arg);
|
||||||
|
if (size == -1 && PyErr_Occurred())
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
else if (arg == Py_None) {
|
else if (arg == Py_None) {
|
||||||
/* No size limit, by default. */
|
/* No size limit, by default. */
|
||||||
|
@ -332,6 +336,8 @@ bytesio_readlines(BytesIOObject *self, PyObject *args)
|
||||||
|
|
||||||
if (PyLong_Check(arg)) {
|
if (PyLong_Check(arg)) {
|
||||||
maxsize = PyLong_AsSsize_t(arg);
|
maxsize = PyLong_AsSsize_t(arg);
|
||||||
|
if (maxsize == -1 && PyErr_Occurred())
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
else if (arg == Py_None) {
|
else if (arg == Py_None) {
|
||||||
/* No size limit, by default. */
|
/* No size limit, by default. */
|
||||||
|
@ -415,6 +421,8 @@ bytesio_truncate(BytesIOObject *self, PyObject *args)
|
||||||
|
|
||||||
if (PyLong_Check(arg)) {
|
if (PyLong_Check(arg)) {
|
||||||
size = PyLong_AsSsize_t(arg);
|
size = PyLong_AsSsize_t(arg);
|
||||||
|
if (size == -1 && PyErr_Occurred())
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
else if (arg == Py_None) {
|
else if (arg == Py_None) {
|
||||||
/* Truncate to current position if no argument is passed. */
|
/* Truncate to current position if no argument is passed. */
|
||||||
|
|
|
@ -1786,6 +1786,8 @@ s_pack_into(PyObject *self, PyObject *args)
|
||||||
|
|
||||||
/* Extract the offset from the first argument */
|
/* Extract the offset from the first argument */
|
||||||
offset = PyLong_AsSsize_t(PyTuple_GET_ITEM(args, 1));
|
offset = PyLong_AsSsize_t(PyTuple_GET_ITEM(args, 1));
|
||||||
|
if (offset == -1 && PyErr_Occurred())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
/* Support negative offsets. */
|
/* Support negative offsets. */
|
||||||
if (offset < 0)
|
if (offset < 0)
|
||||||
|
|
Loading…
Reference in New Issue