[Python-checkins] r55888 - in python/branches/release25-maint: Lib/repr.py Lib/test/test_repr.py Misc/NEWS

neal.norwitz python-checkins at python.org
Mon Jun 11 09:34:13 CEST 2007


Author: neal.norwitz
Date: Mon Jun 11 09:34:07 2007
New Revision: 55888

Modified:
   python/branches/release25-maint/Lib/repr.py
   python/branches/release25-maint/Lib/test/test_repr.py
   python/branches/release25-maint/Misc/NEWS
Log:
Backport 55887:
Bug #1734723: Fix repr.Repr() so it doesn't ignore the maxtuple attribute.


Modified: python/branches/release25-maint/Lib/repr.py
==============================================================================
--- python/branches/release25-maint/Lib/repr.py	(original)
+++ python/branches/release25-maint/Lib/repr.py	Mon Jun 11 09:34:07 2007
@@ -52,7 +52,7 @@
         return '%s%s%s' % (left, s, right)
 
     def repr_tuple(self, x, level):
-        return self._repr_iterable(x, level, '(', ')', self.maxlist, ',')
+        return self._repr_iterable(x, level, '(', ')', self.maxtuple, ',')
 
     def repr_list(self, x, level):
         return self._repr_iterable(x, level, '[', ']', self.maxlist)

Modified: python/branches/release25-maint/Lib/test/test_repr.py
==============================================================================
--- python/branches/release25-maint/Lib/test/test_repr.py	(original)
+++ python/branches/release25-maint/Lib/test/test_repr.py	Mon Jun 11 09:34:07 2007
@@ -10,6 +10,7 @@
 
 from test.test_support import run_unittest
 from repr import repr as r # Don't shadow builtin repr
+from repr import Repr
 
 
 def nestedTuple(nesting):
@@ -34,6 +35,18 @@
         expected = repr(s)[:13] + "..." + repr(s)[-14:]
         eq(r(s), expected)
 
+    def test_tuple(self):
+        eq = self.assertEquals
+        eq(r((1,)), "(1,)")
+
+        t3 = (1, 2, 3)
+        eq(r(t3), "(1, 2, 3)")
+
+        r2 = Repr()
+        r2.maxtuple = 2
+        expected = repr(t3)[:-2] + "...)"
+        eq(r2.repr(t3), expected)
+
     def test_container(self):
         from array import array
         from collections import deque

Modified: python/branches/release25-maint/Misc/NEWS
==============================================================================
--- python/branches/release25-maint/Misc/NEWS	(original)
+++ python/branches/release25-maint/Misc/NEWS	Mon Jun 11 09:34:07 2007
@@ -14,8 +14,8 @@
 
 - Patch #1733960: Allow T_LONGLONG to accept ints.
 
-- Prevent expandtabs() on string and unicode objects from causing a segfault when
-  a large width is passed on 32-bit platforms.
+- Prevent expandtabs() on string and unicode objects from causing a segfault
+  when a large width is passed on 32-bit platforms.
 
 - Bug #1733488: Fix compilation of bufferobject.c on AIX.
 
@@ -23,6 +23,8 @@
 Library
 -------
 
+- Bug #1734723: Fix repr.Repr() so it doesn't ignore the maxtuple attribute.
+
 - Bug #1728403: Fix a bug that CJKCodecs StreamReader hangs when it
   reads a file that ends with incomplete sequence and sizehint argument
   for .read() is specified.


More information about the Python-checkins mailing list