[Python-checkins] r74673 - in python/trunk: Lib/test/test_bytes.py Misc/NEWS Objects/bytearrayobject.c
mark.dickinson
python-checkins at python.org
Sun Sep 6 12:03:32 CEST 2009
Author: mark.dickinson
Date: Sun Sep 6 12:03:31 2009
New Revision: 74673
Log:
Issue #6846: bytearray.pop was returning ints in the range [-128, 128)
instead of [0, 256). Thanks Hagen Fürstenau for the report and fix.
Modified:
python/trunk/Lib/test/test_bytes.py
python/trunk/Misc/NEWS
python/trunk/Objects/bytearrayobject.c
Modified: python/trunk/Lib/test/test_bytes.py
==============================================================================
--- python/trunk/Lib/test/test_bytes.py (original)
+++ python/trunk/Lib/test/test_bytes.py Sun Sep 6 12:03:31 2009
@@ -690,6 +690,8 @@
self.assertEqual(b.pop(-2), ord('r'))
self.assertRaises(IndexError, lambda: b.pop(10))
self.assertRaises(OverflowError, lambda: bytearray().pop())
+ # test for issue #6846
+ self.assertEqual(bytearray(b'\xff').pop(), 0xff)
def test_nosort(self):
self.assertRaises(AttributeError, lambda: bytearray().sort())
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Sun Sep 6 12:03:31 2009
@@ -12,6 +12,8 @@
Core and Builtins
-----------------
+- Issue #6846: Fix bug where bytearray.pop() returns negative integers.
+
- classmethod no longer checks if its argument is callable.
- Issue #6750: A text file opened with io.open() could duplicate its output
Modified: python/trunk/Objects/bytearrayobject.c
==============================================================================
--- python/trunk/Objects/bytearrayobject.c (original)
+++ python/trunk/Objects/bytearrayobject.c Sun Sep 6 12:03:31 2009
@@ -2773,7 +2773,7 @@
if (PyByteArray_Resize((PyObject *)self, n - 1) < 0)
return NULL;
- return PyInt_FromLong(value);
+ return PyInt_FromLong((unsigned char)value);
}
PyDoc_STRVAR(remove__doc__,
More information about the Python-checkins
mailing list