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
465e60e6
Commit
465e60e6
authored
Jul 25, 2014
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #22033: Reprs of most Python implemened classes now contain actual
class name instead of hardcoded one.
parent
54701f30
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
102 additions
and
74 deletions
+102
-74
Lib/_pyio.py
Lib/_pyio.py
+6
-4
Lib/concurrent/futures/_base.py
Lib/concurrent/futures/_base.py
+9
-6
Lib/datetime.py
Lib/datetime.py
+29
-20
Lib/doctest.py
Lib/doctest.py
+3
-2
Lib/email/headerregistry.py
Lib/email/headerregistry.py
+4
-2
Lib/fractions.py
Lib/fractions.py
+2
-1
Lib/http/client.py
Lib/http/client.py
+2
-1
Lib/http/cookiejar.py
Lib/http/cookiejar.py
+1
-1
Lib/idlelib/WidgetRedirector.py
Lib/idlelib/WidgetRedirector.py
+5
-3
Lib/multiprocessing/dummy/__init__.py
Lib/multiprocessing/dummy/__init__.py
+1
-1
Lib/multiprocessing/managers.py
Lib/multiprocessing/managers.py
+5
-5
Lib/multiprocessing/pool.py
Lib/multiprocessing/pool.py
+1
-1
Lib/multiprocessing/synchronize.py
Lib/multiprocessing/synchronize.py
+6
-6
Lib/multiprocessing/util.py
Lib/multiprocessing/util.py
+4
-3
Lib/pydoc.py
Lib/pydoc.py
+2
-1
Lib/subprocess.py
Lib/subprocess.py
+1
-1
Lib/urllib/parse.py
Lib/urllib/parse.py
+1
-1
Lib/uuid.py
Lib/uuid.py
+1
-1
Lib/weakref.py
Lib/weakref.py
+2
-2
Lib/wsgiref/headers.py
Lib/wsgiref/headers.py
+1
-1
Lib/xml/dom/minidom.py
Lib/xml/dom/minidom.py
+3
-2
Lib/xml/etree/ElementTree.py
Lib/xml/etree/ElementTree.py
+2
-2
Lib/xmlrpc/client.py
Lib/xmlrpc/client.py
+8
-7
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/_pyio.py
View file @
465e60e6
...
...
@@ -808,13 +808,14 @@ class _BufferedIOMixin(BufferedIOBase):
.
format
(
self
.
__class__
.
__name__
))
def
__repr__
(
self
):
clsname
=
self
.
__class__
.
__name__
modname
=
self
.
__class__
.
__module__
clsname
=
self
.
__class__
.
__qualname__
try
:
name
=
self
.
name
except
AttributeError
:
return
"<
_pyio.{0}>"
.
format
(
clsname
)
return
"<
{}.{}>"
.
format
(
modname
,
clsname
)
else
:
return
"<
_pyio.{0} name={1!r}>"
.
format
(
clsname
,
name
)
return
"<
{}.{} name={!r}>"
.
format
(
modname
,
clsname
,
name
)
### Lower-level APIs ###
...
...
@@ -1635,7 +1636,8 @@ class TextIOWrapper(TextIOBase):
# - "chars_..." for integer variables that count decoded characters
def
__repr__
(
self
):
result
=
"<_pyio.TextIOWrapper"
result
=
"<{}.{}"
.
format
(
self
.
__class__
.
__module__
,
self
.
__class__
.
__qualname__
)
try
:
name
=
self
.
name
except
AttributeError
:
...
...
Lib/concurrent/futures/_base.py
View file @
465e60e6
...
...
@@ -302,17 +302,20 @@ class Future(object):
with
self
.
_condition
:
if
self
.
_state
==
FINISHED
:
if
self
.
_exception
:
return
'<Future at %s state=%s raised %s>'
%
(
hex
(
id
(
self
)),
return
'<%s at %#x state=%s raised %s>'
%
(
self
.
__class__
.
__name__
,
id
(
self
),
_STATE_TO_DESCRIPTION_MAP
[
self
.
_state
],
self
.
_exception
.
__class__
.
__name__
)
else
:
return
'<Future at %s state=%s returned %s>'
%
(
hex
(
id
(
self
)),
return
'<%s at %#x state=%s returned %s>'
%
(
self
.
__class__
.
__name__
,
id
(
self
),
_STATE_TO_DESCRIPTION_MAP
[
self
.
_state
],
self
.
_result
.
__class__
.
__name__
)
return
'<Future at %s state=%s>'
%
(
hex
(
id
(
self
)),
return
'<%s at %#x state=%s>'
%
(
self
.
__class__
.
__name__
,
id
(
self
),
_STATE_TO_DESCRIPTION_MAP
[
self
.
_state
])
def
cancel
(
self
):
...
...
Lib/datetime.py
View file @
465e60e6
...
...
@@ -414,15 +414,19 @@ class timedelta:
def
__repr__
(
self
):
if
self
.
_microseconds
:
return
"%s(%d, %d, %d)"
%
(
'datetime.'
+
self
.
__class__
.
__name__
,
self
.
_days
,
self
.
_seconds
,
self
.
_microseconds
)
return
"%s.%s(%d, %d, %d)"
%
(
self
.
__class__
.
__module__
,
self
.
__class__
.
__qualname__
,
self
.
_days
,
self
.
_seconds
,
self
.
_microseconds
)
if
self
.
_seconds
:
return
"%s(%d, %d)"
%
(
'datetime.'
+
self
.
__class__
.
__name__
,
self
.
_days
,
self
.
_seconds
)
return
"%s(%d)"
%
(
'datetime.'
+
self
.
__class__
.
__name__
,
self
.
_days
)
return
"%s.%s(%d, %d)"
%
(
self
.
__class__
.
__module__
,
self
.
__class__
.
__qualname__
,
self
.
_days
,
self
.
_seconds
)
return
"%s.%s(%d)"
%
(
self
.
__class__
.
__module__
,
self
.
__class__
.
__qualname__
,
self
.
_days
)
def
__str__
(
self
):
mm
,
ss
=
divmod
(
self
.
_seconds
,
60
)
...
...
@@ -700,10 +704,11 @@ class date:
>>> repr(dt)
'datetime.datetime(2010, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)'
"""
return
"%s(%d, %d, %d)"
%
(
'datetime.'
+
self
.
__class__
.
__name__
,
self
.
_year
,
self
.
_month
,
self
.
_day
)
return
"%s.%s(%d, %d, %d)"
%
(
self
.
__class__
.
__module__
,
self
.
__class__
.
__qualname__
,
self
.
_year
,
self
.
_month
,
self
.
_day
)
# XXX These shouldn't depend on time.localtime(), because that
# clips the usable dates to [1970 .. 2038). At least ctime() is
# easily done without using strftime() -- that's better too because
...
...
@@ -1155,8 +1160,9 @@ class time:
s
=
", %d"
%
self
.
_second
else
:
s
=
""
s
=
"%s(%d, %d%s)"
%
(
'datetime.'
+
self
.
__class__
.
__name__
,
self
.
_hour
,
self
.
_minute
,
s
)
s
=
"%s.%s(%d, %d%s)"
%
(
self
.
__class__
.
__module__
,
self
.
__class__
.
__qualname__
,
self
.
_hour
,
self
.
_minute
,
s
)
if
self
.
_tzinfo
is
not
None
:
assert
s
[
-
1
:]
==
")"
s
=
s
[:
-
1
]
+
", tzinfo=%r"
%
self
.
_tzinfo
+
")"
...
...
@@ -1569,8 +1575,9 @@ class datetime(date):
del
L
[
-
1
]
if
L
[
-
1
]
==
0
:
del
L
[
-
1
]
s
=
", "
.
join
(
map
(
str
,
L
))
s
=
"%s(%s)"
%
(
'datetime.'
+
self
.
__class__
.
__name__
,
s
)
s
=
"%s.%s(%s)"
%
(
self
.
__class__
.
__module__
,
self
.
__class__
.
__qualname__
,
", "
.
join
(
map
(
str
,
L
)))
if
self
.
_tzinfo
is
not
None
:
assert
s
[
-
1
:]
==
")"
s
=
s
[:
-
1
]
+
", tzinfo=%r"
%
self
.
_tzinfo
+
")"
...
...
@@ -1857,10 +1864,12 @@ class timezone(tzinfo):
if
self
is
self
.
utc
:
return
'datetime.timezone.utc'
if
self
.
_name
is
None
:
return
"%s(%r)"
%
(
'datetime.'
+
self
.
__class__
.
__name__
,
self
.
_offset
)
return
"%s(%r, %r)"
%
(
'datetime.'
+
self
.
__class__
.
__name__
,
self
.
_offset
,
self
.
_name
)
return
"%s.%s(%r)"
%
(
self
.
__class__
.
__module__
,
self
.
__class__
.
__qualname__
,
self
.
_offset
)
return
"%s.%s(%r, %r)"
%
(
self
.
__class__
.
__module__
,
self
.
__class__
.
__qualname__
,
self
.
_offset
,
self
.
_name
)
def
__str__
(
self
):
return
self
.
tzname
(
None
)
...
...
Lib/doctest.py
View file @
465e60e6
...
...
@@ -533,8 +533,9 @@ class DocTest:
examples
=
'1 example'
else
:
examples
=
'%d examples'
%
len
(
self
.
examples
)
return
(
'<DocTest %s from %s:%s (%s)>'
%
(
self
.
name
,
self
.
filename
,
self
.
lineno
,
examples
))
return
(
'<%s %s from %s:%s (%s)>'
%
(
self
.
__class__
.
__name__
,
self
.
name
,
self
.
filename
,
self
.
lineno
,
examples
))
def
__eq__
(
self
,
other
):
if
type
(
self
)
is
not
type
(
other
):
...
...
Lib/email/headerregistry.py
View file @
465e60e6
...
...
@@ -80,7 +80,8 @@ class Address:
return
lp
def
__repr__
(
self
):
return
"Address(display_name={!r}, username={!r}, domain={!r})"
.
format
(
return
"{}(display_name={!r}, username={!r}, domain={!r})"
.
format
(
self
.
__class__
.
__name__
,
self
.
display_name
,
self
.
username
,
self
.
domain
)
def
__str__
(
self
):
...
...
@@ -131,7 +132,8 @@ class Group:
return
self
.
_addresses
def
__repr__
(
self
):
return
"Group(display_name={!r}, addresses={!r}"
.
format
(
return
"{}(display_name={!r}, addresses={!r}"
.
format
(
self
.
__class__
.
__name__
,
self
.
display_name
,
self
.
addresses
)
def
__str__
(
self
):
...
...
Lib/fractions.py
View file @
465e60e6
...
...
@@ -280,7 +280,8 @@ class Fraction(numbers.Rational):
def
__repr__
(
self
):
"""repr(self)"""
return
(
'Fraction(%s, %s)'
%
(
self
.
_numerator
,
self
.
_denominator
))
return
'%s(%s, %s)'
%
(
self
.
__class__
.
__name__
,
self
.
_numerator
,
self
.
_denominator
)
def
__str__
(
self
):
"""str(self)"""
...
...
Lib/http/client.py
View file @
465e60e6
...
...
@@ -1334,7 +1334,8 @@ class IncompleteRead(HTTPException):
e
=
', %i more expected'
%
self
.
expected
else
:
e
=
''
return
'IncompleteRead(%i bytes read%s)'
%
(
len
(
self
.
partial
),
e
)
return
'%s(%i bytes read%s)'
%
(
self
.
__class__
.
__name__
,
len
(
self
.
partial
),
e
)
def
__str__
(
self
):
return
repr
(
self
)
...
...
Lib/http/cookiejar.py
View file @
465e60e6
...
...
@@ -805,7 +805,7 @@ class Cookie:
args.append("%s=%s" % (name, repr(attr)))
args.append("rest=%s" % repr(self._rest))
args.append("rfc2109=%s" % repr(self.rfc2109))
return "
Cookie(%s)" % ", ".join(args
)
return "
%s(%s)" % (self.__class__.__name__, ", ".join(args)
)
class CookiePolicy:
...
...
Lib/idlelib/WidgetRedirector.py
View file @
465e60e6
...
...
@@ -47,8 +47,9 @@ class WidgetRedirector:
tk
.
createcommand
(
w
,
self
.
dispatch
)
def
__repr__
(
self
):
return
"WidgetRedirector(%s<%s>)"
%
(
self
.
widget
.
__class__
.
__name__
,
self
.
widget
.
_w
)
return
"%s(%s<%s>)"
%
(
self
.
__class__
.
__name__
,
self
.
widget
.
__class__
.
__name__
,
self
.
widget
.
_w
)
def
close
(
self
):
"Unregister operations and revert redirection created by .__init__."
...
...
@@ -142,7 +143,8 @@ class OriginalCommand:
self
.
orig_and_operation
=
(
redir
.
orig
,
operation
)
def
__repr__
(
self
):
return
"OriginalCommand(%r, %r)"
%
(
self
.
redir
,
self
.
operation
)
return
"%s(%r, %r)"
%
(
self
.
__class__
.
__name__
,
self
.
redir
,
self
.
operation
)
def
__call__
(
self
,
*
args
):
return
self
.
tk_call
(
self
.
orig_and_operation
+
args
)
...
...
Lib/multiprocessing/dummy/__init__.py
View file @
465e60e6
...
...
@@ -86,7 +86,7 @@ class Namespace(object):
if
not
name
.
startswith
(
'_'
):
temp
.
append
(
'%s=%r'
%
(
name
,
value
))
temp
.
sort
()
return
'
Namespace(%s)'
%
str
.
join
(
', '
,
temp
)
return
'
%s(%s)'
%
(
self
.
__class__
.
__name__
,
', '
.
join
(
temp
)
)
dict
=
dict
list
=
list
...
...
Lib/multiprocessing/managers.py
View file @
465e60e6
...
...
@@ -65,8 +65,8 @@ class Token(object):
(
self
.
typeid
,
self
.
address
,
self
.
id
)
=
state
def
__repr__
(
self
):
return
'
Token
(typeid=%r, address=%r, id=%r)'
%
\
(
self
.
typeid
,
self
.
address
,
self
.
id
)
return
'
%s
(typeid=%r, address=%r, id=%r)'
%
\
(
self
.
__class__
.
__name__
,
self
.
typeid
,
self
.
address
,
self
.
id
)
#
# Function for communication with a manager's server process
...
...
@@ -803,8 +803,8 @@ class BaseProxy(object):
return
self
.
_getvalue
()
def
__repr__
(
self
):
return
'<%s object, typeid %r at %
s
>'
%
\
(
type
(
self
).
__name__
,
self
.
_token
.
typeid
,
'0x%x'
%
id
(
self
))
return
'<%s object, typeid %r at %
#x
>'
%
\
(
type
(
self
).
__name__
,
self
.
_token
.
typeid
,
id
(
self
))
def
__str__
(
self
):
'''
...
...
@@ -901,7 +901,7 @@ class Namespace(object):
if
not
name
.
startswith
(
'_'
):
temp
.
append
(
'%s=%r'
%
(
name
,
value
))
temp
.
sort
()
return
'
Namespace(%s)'
%
str
.
join
(
', '
,
temp
)
return
'
%s(%s)'
%
(
self
.
__class__
.
__name__
,
', '
.
join
(
temp
)
)
class
Value
(
object
):
def
__init__
(
self
,
typecode
,
value
,
lock
=
True
):
...
...
Lib/multiprocessing/pool.py
View file @
465e60e6
...
...
@@ -87,7 +87,7 @@ class MaybeEncodingError(Exception):
self
.
exc
)
def
__repr__
(
self
):
return
"<
MaybeEncodingError: %s>"
%
str
(
self
)
return
"<
%s: %s>"
%
(
self
.
__class__
.
__name__
,
self
)
def
worker
(
inqueue
,
outqueue
,
initializer
=
None
,
initargs
=
(),
maxtasks
=
None
,
...
...
Lib/multiprocessing/synchronize.py
View file @
465e60e6
...
...
@@ -134,7 +134,7 @@ class Semaphore(SemLock):
value
=
self
.
_semlock
.
_get_value
()
except
Exception
:
value
=
'unknown'
return
'<
Semaphore(value=%s)>'
%
value
return
'<
%s(value=%s)>'
%
(
self
.
__class__
.
__name__
,
value
)
#
# Bounded semaphore
...
...
@@ -150,8 +150,8 @@ class BoundedSemaphore(Semaphore):
value
=
self
.
_semlock
.
_get_value
()
except
Exception
:
value
=
'unknown'
return
'<
BoundedSemaphore
(value=%s, maxvalue=%s)>'
%
\
(
value
,
self
.
_semlock
.
maxvalue
)
return
'<
%s
(value=%s, maxvalue=%s)>'
%
\
(
self
.
__class__
.
__name__
,
value
,
self
.
_semlock
.
maxvalue
)
#
# Non-recursive lock
...
...
@@ -176,7 +176,7 @@ class Lock(SemLock):
name
=
'SomeOtherProcess'
except
Exception
:
name
=
'unknown'
return
'<
Lock(owner=%s)>'
%
name
return
'<
%s(owner=%s)>'
%
(
self
.
__class__
.
__name__
,
name
)
#
# Recursive lock
...
...
@@ -202,7 +202,7 @@ class RLock(SemLock):
name
,
count
=
'SomeOtherProcess'
,
'nonzero'
except
Exception
:
name
,
count
=
'unknown'
,
'unknown'
return
'<
RLock(%s, %s)>'
%
(
name
,
count
)
return
'<
%s(%s, %s)>'
%
(
self
.
__class__
.
__name__
,
name
,
count
)
#
# Condition variable
...
...
@@ -243,7 +243,7 @@ class Condition(object):
self
.
_woken_count
.
_semlock
.
_get_value
())
except
Exception
:
num_waiters
=
'unknown'
return
'<
Condition(%s, %s)>'
%
(
self
.
_lock
,
num_waiters
)
return
'<
%s(%s, %s)>'
%
(
self
.
__class__
.
__name__
,
self
.
_lock
,
num_waiters
)
def
wait
(
self
,
timeout
=
None
):
assert
self
.
_lock
.
_semlock
.
_is_mine
(),
\
...
...
Lib/multiprocessing/util.py
View file @
465e60e6
...
...
@@ -212,10 +212,11 @@ class Finalize(object):
obj
=
None
if
obj
is
None
:
return
'<
Finalize object, dead>'
return
'<
%s object, dead>'
%
self
.
__class__
.
__name__
x
=
'<Finalize object, callback=%s'
%
\
getattr
(
self
.
_callback
,
'__name__'
,
self
.
_callback
)
x
=
'<%s object, callback=%s'
%
(
self
.
__class__
.
__name__
,
getattr
(
self
.
_callback
,
'__name__'
,
self
.
_callback
))
if
self
.
_args
:
x
+=
', args='
+
str
(
self
.
_args
)
if
self
.
_kwargs
:
...
...
Lib/pydoc.py
View file @
465e60e6
...
...
@@ -1811,7 +1811,8 @@ class Helper:
if
inspect
.
stack
()[
1
][
3
]
==
'?'
:
self
()
return
''
return
'<pydoc.Helper instance>'
return
'<%s.%s instance>'
%
(
self
.
__class__
.
__module__
,
self
.
__class__
.
__qualname__
)
_GoInteractive
=
object
()
def
__call__
(
self
,
request
=
_GoInteractive
):
...
...
Lib/subprocess.py
View file @
465e60e6
...
...
@@ -464,7 +464,7 @@ if mswindows:
raise
ValueError
(
"already closed"
)
def
__repr__
(
self
):
return
"
Handle(%d)"
%
int
(
self
)
return
"
%s(%d)"
%
(
self
.
__class__
.
__name__
,
int
(
self
)
)
__del__
=
Close
__str__
=
__repr__
...
...
Lib/urllib/parse.py
View file @
465e60e6
...
...
@@ -641,7 +641,7 @@ class Quoter(collections.defaultdict):
def
__repr__
(
self
):
# Without this, will just display as a defaultdict
return
"<
Quoter %r>"
%
dict
(
self
)
return
"<
%s %r>"
%
(
self
.
__class__
.
__name__
,
dict
(
self
)
)
def
__missing__
(
self
,
b
):
# Handle a cache miss. Store quoted string in cache and return.
...
...
Lib/uuid.py
View file @
465e60e6
...
...
@@ -222,7 +222,7 @@ class UUID(object):
return
self
.
int
def
__repr__
(
self
):
return
'
UUID(%r)'
%
str
(
self
)
return
'
%s(%r)'
%
(
self
.
__class__
.
__name__
,
str
(
self
)
)
def
__setattr__
(
self
,
name
,
value
):
raise
TypeError
(
'UUID objects are immutable'
)
...
...
Lib/weakref.py
View file @
465e60e6
...
...
@@ -144,7 +144,7 @@ class WeakValueDictionary(collections.MutableMapping):
return
o
is
not
None
def
__repr__
(
self
):
return
"<
WeakValueDictionary at %#x>"
%
id
(
self
)
return
"<
%s at %#x>"
%
(
self
.
__class__
.
__name__
,
id
(
self
)
)
def
__setitem__
(
self
,
key
,
value
):
if
self
.
_pending_removals
:
...
...
@@ -348,7 +348,7 @@ class WeakKeyDictionary(collections.MutableMapping):
return
len
(
self
.
data
)
-
len
(
self
.
_pending_removals
)
def
__repr__
(
self
):
return
"<
WeakKeyDictionary at %#x>"
%
id
(
self
)
return
"<
%s at %#x>"
%
(
self
.
__class__
.
__name__
,
id
(
self
)
)
def
__setitem__
(
self
,
key
,
value
):
self
.
data
[
ref
(
key
,
self
.
_remove
)]
=
value
...
...
Lib/wsgiref/headers.py
View file @
465e60e6
...
...
@@ -131,7 +131,7 @@ class Headers:
return self._headers[:]
def __repr__(self):
return "
Headers
(
%
r
)
" % self._headers
return "
%
s
(
%
r
)
" % (self.__class__.__name__, self._headers)
def __str__(self):
"""str() returns the formatted headers, complete with end line,
...
...
Lib/xml/dom/minidom.py
View file @
465e60e6
...
...
@@ -648,9 +648,10 @@ class TypeInfo(object):
def
__repr__
(
self
):
if
self
.
namespace
:
return
"<TypeInfo %r (from %r)>"
%
(
self
.
name
,
self
.
namespace
)
return
"<%s %r (from %r)>"
%
(
self
.
__class__
.
__name__
,
self
.
name
,
self
.
namespace
)
else
:
return
"<
TypeInfo %r>"
%
self
.
name
return
"<
%s %r>"
%
(
self
.
__class__
.
__name__
,
self
.
name
)
def
_get_name
(
self
):
return
self
.
name
...
...
Lib/xml/etree/ElementTree.py
View file @
465e60e6
...
...
@@ -174,7 +174,7 @@ class Element:
self
.
_children
=
[]
def
__repr__
(
self
):
return
"<
Element %s at 0x%x>"
%
(
repr
(
self
.
tag
)
,
id
(
self
))
return
"<
%s %r at %#x>"
%
(
self
.
__class__
.
__name__
,
self
.
tag
,
id
(
self
))
def
makeelement
(
self
,
tag
,
attrib
):
"""Create a new element with the same type.
...
...
@@ -509,7 +509,7 @@ class QName:
def
__str__
(
self
):
return
self
.
text
def
__repr__
(
self
):
return
'<
QName %r>'
%
(
self
.
text
,
)
return
'<
%s %r>'
%
(
self
.
__class__
.
__name__
,
self
.
text
)
def
__hash__
(
self
):
return
hash
(
self
.
text
)
def
__le__
(
self
,
other
):
...
...
Lib/xmlrpc/client.py
View file @
465e60e6
...
...
@@ -207,8 +207,8 @@ class ProtocolError(Error):
self
.
headers
=
headers
def
__repr__
(
self
):
return
(
"<
ProtocolError
for %s: %s %s>"
%
(
self
.
url
,
self
.
errcode
,
self
.
errmsg
)
"<
%s
for %s: %s %s>"
%
(
self
.
__class__
.
__name__
,
self
.
url
,
self
.
errcode
,
self
.
errmsg
)
)
##
...
...
@@ -236,7 +236,8 @@ class Fault(Error):
self
.
faultCode
=
faultCode
self
.
faultString
=
faultString
def
__repr__
(
self
):
return
"<Fault %s: %r>"
%
(
self
.
faultCode
,
self
.
faultString
)
return
"<%s %s: %r>"
%
(
self
.
__class__
.
__name__
,
self
.
faultCode
,
self
.
faultString
)
# --------------------------------------------------------------------
# Special values
...
...
@@ -354,7 +355,7 @@ class DateTime:
return
self
.
value
def
__repr__
(
self
):
return
"<
DateTime %r at %#x>"
%
(
self
.
value
,
id
(
self
))
return
"<
%s %r at %#x>"
%
(
self
.
__class__
.
__name__
,
self
.
value
,
id
(
self
))
def
decode
(
self
,
data
):
self
.
value
=
str
(
data
).
strip
()
...
...
@@ -846,7 +847,7 @@ class MultiCall:
self
.
__call_list
=
[]
def
__repr__
(
self
):
return
"<
MultiCall at %#x>"
%
id
(
self
)
return
"<
%s at %#x>"
%
(
self
.
__class__
.
__name__
,
id
(
self
)
)
__str__
=
__repr__
...
...
@@ -1426,8 +1427,8 @@ class ServerProxy:
def
__repr__
(
self
):
return
(
"<
ServerProxy
for %s%s>"
%
(
self
.
__host
,
self
.
__handler
)
"<
%s
for %s%s>"
%
(
self
.
__
class__
.
__name__
,
self
.
__
host
,
self
.
__handler
)
)
__str__
=
__repr__
...
...
Misc/NEWS
View file @
465e60e6
...
...
@@ -108,6 +108,9 @@ Core and Builtins
Library
-------
- Issue #22033: Reprs of most Python implemened classes now contain actual
class name instead of hardcoded one.
- Issue #21947: The dis module can now disassemble generator-iterator
objects based on their gi_code attribute. Patch by Clement Rouault.
...
...
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