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
1d17fae6
Commit
1d17fae6
authored
Jun 11, 2007
by
Neal Norwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug #1734723: Fix repr.Repr() so it doesn't ignore the maxtuple attribute.
Will backport
parent
f027af05
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
1 deletion
+16
-1
Lib/repr.py
Lib/repr.py
+1
-1
Lib/test/test_repr.py
Lib/test/test_repr.py
+13
-0
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/repr.py
View file @
1d17fae6
...
...
@@ -52,7 +52,7 @@ class Repr:
return
'%s%s%s'
%
(
left
,
s
,
right
)
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
):
return
self
.
_repr_iterable
(
x
,
level
,
'['
,
']'
,
self
.
maxlist
)
...
...
Lib/test/test_repr.py
View file @
1d17fae6
...
...
@@ -10,6 +10,7 @@ import unittest
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 @@ class ReprTests(unittest.TestCase):
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
...
...
Misc/NEWS
View file @
1d17fae6
...
...
@@ -229,6 +229,8 @@ Core and builtins
Library
-------
- Bug #1734723: Fix repr.Repr() so it doesn'
t
ignore
the
maxtuple
attribute
.
-
The
urlopen
function
of
urllib2
now
has
an
optional
timeout
parameter
(
note
that
it
actually
works
with
HTTP
,
HTTPS
,
FTP
and
FTPS
connections
).
...
...
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