[Python-checkins] r74676 - in python/branches/release31-maint: Lib/test/test_bytes.py Misc/NEWS Objects/bytearrayobject.c

mark.dickinson python-checkins at python.org
Sun Sep 6 12:20:24 CEST 2009


Author: mark.dickinson
Date: Sun Sep 6 12:20:23 2009
New Revision: 74676
Log:
Merged revisions 74675 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
 r74675 | mark.dickinson | 2009年09月06日 11:19:23 +0100 (2009年9月06日) | 10 lines
 
 Merged revisions 74673 via svnmerge from 
 svn+ssh://pythondev@svn.python.org/python/trunk
 
 ........
 r74673 | mark.dickinson | 2009年09月06日 11:03:31 +0100 (2009年9月06日) | 3 lines
 
 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/branches/release31-maint/ (props changed)
 python/branches/release31-maint/Lib/test/test_bytes.py
 python/branches/release31-maint/Misc/NEWS
 python/branches/release31-maint/Objects/bytearrayobject.c
Modified: python/branches/release31-maint/Lib/test/test_bytes.py
==============================================================================
--- python/branches/release31-maint/Lib/test/test_bytes.py	(original)
+++ python/branches/release31-maint/Lib/test/test_bytes.py	Sun Sep 6 12:20:23 2009
@@ -716,6 +716,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/branches/release31-maint/Misc/NEWS
==============================================================================
--- python/branches/release31-maint/Misc/NEWS	(original)
+++ python/branches/release31-maint/Misc/NEWS	Sun Sep 6 12:20:23 2009
@@ -12,6 +12,8 @@
 Core and Builtins
 -----------------
 
+- Issue #6846: Fix bug where bytearray.pop() returns negative integers.
+
 - Issue #6750: A text file opened with io.open() could duplicate its output
 when writing from multiple threads at the same time.
 
Modified: python/branches/release31-maint/Objects/bytearrayobject.c
==============================================================================
--- python/branches/release31-maint/Objects/bytearrayobject.c	(original)
+++ python/branches/release31-maint/Objects/bytearrayobject.c	Sun Sep 6 12:20:23 2009
@@ -2705,7 +2705,7 @@
 if (PyByteArray_Resize((PyObject *)self, n - 1) < 0)
 return NULL;
 
- return PyLong_FromLong(value);
+ return PyLong_FromLong((unsigned char)value);
 }
 
 PyDoc_STRVAR(remove__doc__,


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /