summaryrefslogtreecommitdiffstats
path: root/Python/getargs.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2008-08-24 05:48:10 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2008-08-24 05:48:10 (GMT)
commit2f99b241721f72c9f55617479709b589496c093d (patch)
tree46df4e6e2d10edb45724eb675519b8ae0c563998 /Python/getargs.c
parentc4b153542d63474431f2ba3b83d531cafb1748e9 (diff)
downloadcpython-2f99b241721f72c9f55617479709b589496c093d.zip
cpython-2f99b241721f72c9f55617479709b589496c093d.tar.gz
cpython-2f99b241721f72c9f55617479709b589496c093d.tar.bz2
Merged revisions 66006 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk TESTED=./python -E -tt ./Lib/test/regrtest.py -uall (both debug and opt modes) ........ r66006 | neal.norwitz | 2008-08-23 22:04:52 -0700 (Sat, 23 Aug 2008) | 25 lines Fix: * crashes on memory allocation failure found with failmalloc * memory leaks found with valgrind * compiler warnings in opt mode which would lead to invalid memory reads * problem using wrong name in decimal module reported by pychecker Update the valgrind suppressions file with new leaks that are small/one-time leaks we don't care about (ie, they are too hard to fix). TBR=barry TESTED=./python -E -tt ./Lib/test/regrtest.py -uall (both debug and opt modes) in opt mode: valgrind -q --leak-check=yes --suppressions=Misc/valgrind-python.supp \ ./python -E -tt ./Lib/test/regrtest.py -uall,-bsddb,-compiler \ -x test_logging test_ssl test_multiprocessing valgrind -q --leak-check=yes --suppressions=Misc/valgrind-python.supp \ ./python -E -tt ./Lib/test/regrtest.py test_multiprocessing for i in `seq 1 4000` ; do LD_PRELOAD=~/local/lib/libfailmalloc.so FAILMALLOC_INTERVAL=$i \ ./python -c pass done At least some of these fixes should probably be backported to 2.5. ........
Diffstat (limited to 'Python/getargs.c')
-rw-r--r--Python/getargs.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index cf4444c..b7beb37 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -1354,7 +1354,7 @@ convertbuffer(PyObject *arg, void **p, char **errmsg)
/* XXX for 3.x, getbuffer and convertbuffer can probably
be merged again. */
static int
-getbuffer(PyObject *arg, Py_buffer *view, char**errmsg)
+getbuffer(PyObject *arg, Py_buffer *view, char **errmsg)
{
void *buf;
Py_ssize_t count;
@@ -1364,8 +1364,10 @@ getbuffer(PyObject *arg, Py_buffer *view, char**errmsg)
return -1;
}
if (pb->bf_getbuffer) {
- if (pb->bf_getbuffer(arg, view, 0) < 0)
+ if (pb->bf_getbuffer(arg, view, 0) < 0) {
+ *errmsg = "convertible to a buffer";
return -1;
+ }
if (!PyBuffer_IsContiguous(view, 'C')) {
*errmsg = "contiguous buffer";
return -1;
@@ -1374,8 +1376,10 @@ getbuffer(PyObject *arg, Py_buffer *view, char**errmsg)
}
count = convertbuffer(arg, &buf, errmsg);
- if (count < 0)
+ if (count < 0) {
+ *errmsg = "convertible to a buffer";
return count;
+ }
PyBuffer_FillInfo(view, NULL, buf, count, 1, 0);
return 0;
}