diff options
author | Guido van Rossum <guido@python.org> | 2006-04-23 07:43:54 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2006-04-23 07:43:54 (GMT) |
commit | e06b6b8ff5a380f5e107f2d28f23853bfe20021e (patch) | |
tree | 6e28f5973de58276cd682c76dc997a472e4beb44 /Objects/bytesobject.c | |
parent | 5f6f27de4d9f7cb260e243cf517cec629e54e985 (diff) | |
download | cpython-e06b6b8ff5a380f5e107f2d28f23853bfe20021e.zip cpython-e06b6b8ff5a380f5e107f2d28f23853bfe20021e.tar.gz cpython-e06b6b8ff5a380f5e107f2d28f23853bfe20021e.tar.bz2 |
Fix a leak and a buglet discovered by Thomas.
Get rid of silly lambdas in the unit test suite.
Add a TODO list to the unit test suite (TDD style).
Diffstat (limited to 'Objects/bytesobject.c')
-rw-r--r-- | Objects/bytesobject.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index 8fc089b..f221395 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -130,7 +130,7 @@ bytes_init(PyBytesObject *self, PyObject *args, PyObject *kwds) /* Get the iterator */ it = PyObject_GetIter(arg); if (it == NULL) - return 0; + return -1; iternext = *it->ob_type->tp_iternext; /* Run the iterator to exhaustion */ @@ -151,6 +151,7 @@ bytes_init(PyBytesObject *self, PyObject *args, PyObject *kwds) /* Interpret it as an int (__index__) */ value = PyNumber_Index(item); + Py_DECREF(item); if (value == -1 && PyErr_Occurred()) goto error; |