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
0c937b3e
Commit
0c937b3e
authored
Jul 22, 2014
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #22031: Reprs now always use hexadecimal format with the "0x" prefix
when contain an id in form " at 0x...".
parent
fbc877b7
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
19 additions
and
8 deletions
+19
-8
Lib/ctypes/__init__.py
Lib/ctypes/__init__.py
+1
-1
Lib/reprlib.py
Lib/reprlib.py
+1
-1
Lib/test/test_reprlib.py
Lib/test/test_reprlib.py
+1
-1
Lib/test/test_weakref.py
Lib/test/test_weakref.py
+8
-0
Lib/test/test_xmlrpc.py
Lib/test/test_xmlrpc.py
+1
-1
Lib/weakref.py
Lib/weakref.py
+2
-2
Lib/xmlrpc/client.py
Lib/xmlrpc/client.py
+2
-2
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/ctypes/__init__.py
View file @
0c937b3e
...
@@ -353,7 +353,7 @@ class CDLL(object):
...
@@ -353,7 +353,7 @@ class CDLL(object):
self
.
_handle
=
handle
self
.
_handle
=
handle
def
__repr__
(
self
):
def
__repr__
(
self
):
return
"<%s '%s', handle %x at %x>"
%
\
return
"<%s '%s', handle %x at %
#
x>"
%
\
(
self
.
__class__
.
__name__
,
self
.
_name
,
(
self
.
__class__
.
__name__
,
self
.
_name
,
(
self
.
_handle
&
(
_sys
.
maxsize
*
2
+
1
)),
(
self
.
_handle
&
(
_sys
.
maxsize
*
2
+
1
)),
id
(
self
)
&
(
_sys
.
maxsize
*
2
+
1
))
id
(
self
)
&
(
_sys
.
maxsize
*
2
+
1
))
...
...
Lib/reprlib.py
View file @
0c937b3e
...
@@ -136,7 +136,7 @@ class Repr:
...
@@ -136,7 +136,7 @@ class Repr:
# Bugs in x.__repr__() can cause arbitrary
# Bugs in x.__repr__() can cause arbitrary
# exceptions -- then make up something
# exceptions -- then make up something
except
Exception
:
except
Exception
:
return
'<%s instance at %x>'
%
(
x
.
__class__
.
__name__
,
id
(
x
))
return
'<%s instance at %
#
x>'
%
(
x
.
__class__
.
__name__
,
id
(
x
))
if
len
(
s
)
>
self
.
maxother
:
if
len
(
s
)
>
self
.
maxother
:
i
=
max
(
0
,
(
self
.
maxother
-
3
)
//
2
)
i
=
max
(
0
,
(
self
.
maxother
-
3
)
//
2
)
j
=
max
(
0
,
self
.
maxother
-
3
-
i
)
j
=
max
(
0
,
self
.
maxother
-
3
-
i
)
...
...
Lib/test/test_reprlib.py
View file @
0c937b3e
...
@@ -123,7 +123,7 @@ class ReprTests(unittest.TestCase):
...
@@ -123,7 +123,7 @@ class ReprTests(unittest.TestCase):
eq
(
r
(
i2
),
expected
)
eq
(
r
(
i2
),
expected
)
i3
=
ClassWithFailingRepr
()
i3
=
ClassWithFailingRepr
()
eq
(
r
(
i3
),
(
"<ClassWithFailingRepr instance at %x>"
%
id
(
i3
)))
eq
(
r
(
i3
),
(
"<ClassWithFailingRepr instance at %
#
x>"
%
id
(
i3
)))
s
=
r
(
ClassWithFailingRepr
)
s
=
r
(
ClassWithFailingRepr
)
self
.
assertTrue
(
s
.
startswith
(
"<class "
))
self
.
assertTrue
(
s
.
startswith
(
"<class "
))
...
...
Lib/test/test_weakref.py
View file @
0c937b3e
...
@@ -1536,6 +1536,14 @@ class MappingTestCase(TestBase):
...
@@ -1536,6 +1536,14 @@ class MappingTestCase(TestBase):
self
.
assertEqual
(
len
(
d
),
0
)
self
.
assertEqual
(
len
(
d
),
0
)
self
.
assertEqual
(
count
,
2
)
self
.
assertEqual
(
count
,
2
)
def
test_make_weak_valued_dict_repr
(
self
):
dict
=
weakref
.
WeakValueDictionary
()
self
.
assertRegex
(
repr
(
dict
),
'<WeakValueDictionary at 0x.*>'
)
def
test_make_weak_keyed_dict_repr
(
self
):
dict
=
weakref
.
WeakKeyDictionary
()
self
.
assertRegex
(
repr
(
dict
),
'<WeakKeyDictionary at 0x.*>'
)
from
test
import
mapping_tests
from
test
import
mapping_tests
class
WeakValueDictionaryTestCase
(
mapping_tests
.
BasicTestMappingProtocol
):
class
WeakValueDictionaryTestCase
(
mapping_tests
.
BasicTestMappingProtocol
):
...
...
Lib/test/test_xmlrpc.py
View file @
0c937b3e
...
@@ -287,7 +287,7 @@ class DateTimeTestCase(unittest.TestCase):
...
@@ -287,7 +287,7 @@ class DateTimeTestCase(unittest.TestCase):
def
test_repr
(
self
):
def
test_repr
(
self
):
d
=
datetime
.
datetime
(
2007
,
1
,
2
,
3
,
4
,
5
)
d
=
datetime
.
datetime
(
2007
,
1
,
2
,
3
,
4
,
5
)
t
=
xmlrpclib
.
DateTime
(
d
)
t
=
xmlrpclib
.
DateTime
(
d
)
val
=
"<DateTime '20070102T03:04:05' at %x>"
%
id
(
t
)
val
=
"<DateTime '20070102T03:04:05' at %
#
x>"
%
id
(
t
)
self
.
assertEqual
(
repr
(
t
),
val
)
self
.
assertEqual
(
repr
(
t
),
val
)
def
test_decode
(
self
):
def
test_decode
(
self
):
...
...
Lib/weakref.py
View file @
0c937b3e
...
@@ -144,7 +144,7 @@ class WeakValueDictionary(collections.MutableMapping):
...
@@ -144,7 +144,7 @@ class WeakValueDictionary(collections.MutableMapping):
return
o
is
not
None
return
o
is
not
None
def
__repr__
(
self
):
def
__repr__
(
self
):
return
"<WeakValueDictionary at %
s
>"
%
id
(
self
)
return
"<WeakValueDictionary at %
#x
>"
%
id
(
self
)
def
__setitem__
(
self
,
key
,
value
):
def
__setitem__
(
self
,
key
,
value
):
if
self
.
_pending_removals
:
if
self
.
_pending_removals
:
...
@@ -348,7 +348,7 @@ class WeakKeyDictionary(collections.MutableMapping):
...
@@ -348,7 +348,7 @@ class WeakKeyDictionary(collections.MutableMapping):
return
len
(
self
.
data
)
-
len
(
self
.
_pending_removals
)
return
len
(
self
.
data
)
-
len
(
self
.
_pending_removals
)
def
__repr__
(
self
):
def
__repr__
(
self
):
return
"<WeakKeyDictionary at %
s
>"
%
id
(
self
)
return
"<WeakKeyDictionary at %
#x
>"
%
id
(
self
)
def
__setitem__
(
self
,
key
,
value
):
def
__setitem__
(
self
,
key
,
value
):
self
.
data
[
ref
(
key
,
self
.
_remove
)]
=
value
self
.
data
[
ref
(
key
,
self
.
_remove
)]
=
value
...
...
Lib/xmlrpc/client.py
View file @
0c937b3e
...
@@ -354,7 +354,7 @@ class DateTime:
...
@@ -354,7 +354,7 @@ class DateTime:
return
self
.
value
return
self
.
value
def
__repr__
(
self
):
def
__repr__
(
self
):
return
"<DateTime %r at %x>"
%
(
self
.
value
,
id
(
self
))
return
"<DateTime %r at %
#
x>"
%
(
self
.
value
,
id
(
self
))
def
decode
(
self
,
data
):
def
decode
(
self
,
data
):
self
.
value
=
str
(
data
).
strip
()
self
.
value
=
str
(
data
).
strip
()
...
@@ -846,7 +846,7 @@ class MultiCall:
...
@@ -846,7 +846,7 @@ class MultiCall:
self
.
__call_list
=
[]
self
.
__call_list
=
[]
def
__repr__
(
self
):
def
__repr__
(
self
):
return
"<MultiCall at %x>"
%
id
(
self
)
return
"<MultiCall at %
#
x>"
%
id
(
self
)
__str__
=
__repr__
__str__
=
__repr__
...
...
Misc/NEWS
View file @
0c937b3e
...
@@ -108,6 +108,9 @@ Core and Builtins
...
@@ -108,6 +108,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #22031: Reprs now always use hexadecimal format with the "0x" prefix
when contain an id in form " at 0x...".
- Issue #22018: signal.set_wakeup_fd() now raises an OSError instead of a
- Issue #22018: signal.set_wakeup_fd() now raises an OSError instead of a
ValueError on ``fstat()`` failure.
ValueError on ``fstat()`` failure.
...
...
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