Discussion:
[Python-3000-checkins] r66046 - python/branches/py3k/Objects/bytesobject.c
benjamin.peterson
2008-08-27 00:28:35 UTC
Permalink
Author: benjamin.peterson
Date: Wed Aug 27 02:28:34 2008
New Revision: 66046

Log:
add NULL checking for PyBytes_FromObject; R=Neal

Modified:
python/branches/py3k/Objects/bytesobject.c

Modified: python/branches/py3k/Objects/bytesobject.c
==============================================================================
--- python/branches/py3k/Objects/bytesobject.c (original)
+++ python/branches/py3k/Objects/bytesobject.c Wed Aug 27 02:28:34 2008
@@ -2932,6 +2932,11 @@
PyObject *new, *it;
Py_ssize_t i, size;

+ if (x == NULL) {
+ PyErr_BadInternalCall();
+ return NULL;
+ }
+
/* Is it an int? */
size = PyNumber_AsSsize_t(x, PyExc_ValueError);
if (size == -1 && PyErr_Occurred()) {

Loading...