Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
2ea0c2e6
Commit
2ea0c2e6
authored
Jun 11, 2007
by
Neal Norwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport 55887:
Bug #1734723: Fix repr.Repr() so it doesn't ignore the maxtuple attribute.
parent
cb1ef926
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
3 deletions
+18
-3
Lib/repr.py
Lib/repr.py
+1
-1
Lib/test/test_repr.py
Lib/test/test_repr.py
+13
-0
Misc/NEWS
Misc/NEWS
+4
-2
No files found.
Lib/repr.py
View file @
2ea0c2e6
...
@@ -52,7 +52,7 @@ class Repr:
...
@@ -52,7 +52,7 @@ class Repr:
return
'%s%s%s'
%
(
left
,
s
,
right
)
return
'%s%s%s'
%
(
left
,
s
,
right
)
def
repr_tuple
(
self
,
x
,
level
):
def
repr_tuple
(
self
,
x
,
level
):
return
self
.
_repr_iterable
(
x
,
level
,
'('
,
')'
,
self
.
max
list
,
','
)
return
self
.
_repr_iterable
(
x
,
level
,
'('
,
')'
,
self
.
max
tuple
,
','
)
def
repr_list
(
self
,
x
,
level
):
def
repr_list
(
self
,
x
,
level
):
return
self
.
_repr_iterable
(
x
,
level
,
'['
,
']'
,
self
.
maxlist
)
return
self
.
_repr_iterable
(
x
,
level
,
'['
,
']'
,
self
.
maxlist
)
...
...
Lib/test/test_repr.py
View file @
2ea0c2e6
...
@@ -10,6 +10,7 @@ import unittest
...
@@ -10,6 +10,7 @@ import unittest
from
test.test_support
import
run_unittest
from
test.test_support
import
run_unittest
from
repr
import
repr
as
r
# Don't shadow builtin repr
from
repr
import
repr
as
r
# Don't shadow builtin repr
from
repr
import
Repr
def
nestedTuple
(
nesting
):
def
nestedTuple
(
nesting
):
...
@@ -34,6 +35,18 @@ class ReprTests(unittest.TestCase):
...
@@ -34,6 +35,18 @@ class ReprTests(unittest.TestCase):
expected
=
repr
(
s
)[:
13
]
+
"..."
+
repr
(
s
)[
-
14
:]
expected
=
repr
(
s
)[:
13
]
+
"..."
+
repr
(
s
)[
-
14
:]
eq
(
r
(
s
),
expected
)
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
):
def
test_container
(
self
):
from
array
import
array
from
array
import
array
from
collections
import
deque
from
collections
import
deque
...
...
Misc/NEWS
View file @
2ea0c2e6
...
@@ -14,8 +14,8 @@ Core and builtins
...
@@ -14,8 +14,8 @@ Core and builtins
- Patch #1733960: Allow T_LONGLONG to accept ints.
- Patch #1733960: Allow T_LONGLONG to accept ints.
- Prevent expandtabs() on string and unicode objects from causing a segfault
when
- Prevent expandtabs() on string and unicode objects from causing a segfault
a large width is passed on 32-bit platforms.
when
a large width is passed on 32-bit platforms.
- Bug #1733488: Fix compilation of bufferobject.c on AIX.
- Bug #1733488: Fix compilation of bufferobject.c on AIX.
...
@@ -23,6 +23,8 @@ Core and builtins
...
@@ -23,6 +23,8 @@ Core and builtins
Library
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
-
Bug
#
1728403
:
Fix
a
bug
that
CJKCodecs
StreamReader
hangs
when
it
reads
a
file
that
ends
with
incomplete
sequence
and
sizehint
argument
reads
a
file
that
ends
with
incomplete
sequence
and
sizehint
argument
for
.
read
()
is
specified
.
for
.
read
()
is
specified
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment