Discussion:
[Python-3000-checkins] r66695 - python/branches/py3k/Modules/_stringio.c
benjamin.peterson
2008-09-30 02:22:04 UTC
Permalink
Author: benjamin.peterson
Date: Tue Sep 30 04:22:04 2008
New Revision: 66695

Log:
check for errors after PyLong_Ssize_t

patch from Victor Stinner #3977
reviewed by Amaury


Modified:
python/branches/py3k/Modules/_stringio.c

Modified: python/branches/py3k/Modules/_stringio.c
==============================================================================
--- python/branches/py3k/Modules/_stringio.c (original)
+++ python/branches/py3k/Modules/_stringio.c Tue Sep 30 04:22:04 2008
@@ -177,6 +177,10 @@

if (PyLong_Check(arg)) {
size = PyLong_AsSsize_t(arg);
+ if (size == -1 && PyErr_Occurred())
+ return NULL;
+ if (size == -1 && PyErr_Occurred())
+ return NULL;
}
else if (arg == Py_None) {
/* Truncate to current position if no argument is passed. */
Neal Norwitz
2008-09-30 03:48:58 UTC
Permalink
On Mon, Sep 29, 2008 at 7:22 PM, benjamin.peterson
Post by benjamin.peterson
Author: benjamin.peterson
Date: Tue Sep 30 04:22:04 2008
New Revision: 66695
check for errors after PyLong_Ssize_t
patch from Victor Stinner #3977
reviewed by Amaury
python/branches/py3k/Modules/_stringio.c
Modified: python/branches/py3k/Modules/_stringio.c
==============================================================================
--- python/branches/py3k/Modules/_stringio.c (original)
+++ python/branches/py3k/Modules/_stringio.c Tue Sep 30 04:22:04 2008
@@ -177,6 +177,10 @@
if (PyLong_Check(arg)) {
size = PyLong_AsSsize_t(arg);
+ if (size == -1 && PyErr_Occurred())
+ return NULL;
+ if (size == -1 && PyErr_Occurred())
+ return NULL;
}
That check is redundant, isn't that check?

n
Amaury Forgeot d'Arc
2008-09-30 08:07:14 UTC
Permalink
Post by Neal Norwitz
Post by benjamin.peterson
Modified: python/branches/py3k/Modules/_stringio.c
=============================================================
--- python/branches/py3k/Modules/_stringio.c (original)
+++ python/branches/py3k/Modules/_stringio.c Tue Sep 30 04:22:04 2008
@@ -177,6 +177,10 @@
if (PyLong_Check(arg)) {
size = PyLong_AsSsize_t(arg);
+ if (size == -1 && PyErr_Occurred())
+ return NULL;
+ if (size == -1 && PyErr_Occurred())
+ return NULL;
}
That check is redundant, isn't that check?
It's redundant here, but missing in another place, in stringio_read().
--
Amaury Forgeot d'Arc
Loading...