summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-07-25 20:36:00 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-07-25 20:36:00 (GMT)
commit465e60e654732b3a0b726d1fd82950fc982fcba2 (patch)
tree25a1567d99855ff0a2ffcdc1f7c7659f85aaaa0b /Lib/multiprocessing
parent54701f303fdde38c53811776ba2d16fabf219dcc (diff)
downloadcpython-465e60e654732b3a0b726d1fd82950fc982fcba2.zip
cpython-465e60e654732b3a0b726d1fd82950fc982fcba2.tar.gz
cpython-465e60e654732b3a0b726d1fd82950fc982fcba2.tar.bz2
Issue #22033: Reprs of most Python implemened classes now contain actual
class name instead of hardcoded one.
Diffstat (limited to 'Lib/multiprocessing')
-rw-r--r--Lib/multiprocessing/dummy/__init__.py2
-rw-r--r--Lib/multiprocessing/managers.py10
-rw-r--r--Lib/multiprocessing/pool.py2
-rw-r--r--Lib/multiprocessing/synchronize.py12
-rw-r--r--Lib/multiprocessing/util.py7
5 files changed, 17 insertions, 16 deletions
diff --git a/Lib/multiprocessing/dummy/__init__.py b/Lib/multiprocessing/dummy/__init__.py
index 135db7f..1abea64 100644
--- a/Lib/multiprocessing/dummy/__init__.py
+++ b/Lib/multiprocessing/dummy/__init__.py
@@ -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
diff --git a/Lib/multiprocessing/managers.py b/Lib/multiprocessing/managers.py
index 820ae91..776656e 100644
--- a/Lib/multiprocessing/managers.py
+++ b/Lib/multiprocessing/managers.py
@@ -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):
diff --git a/Lib/multiprocessing/pool.py b/Lib/multiprocessing/pool.py
index 77eb817..75a76a4 100644
--- a/Lib/multiprocessing/pool.py
+++ b/Lib/multiprocessing/pool.py
@@ -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,
diff --git a/Lib/multiprocessing/synchronize.py b/Lib/multiprocessing/synchronize.py
index 7d44330..d4bdf0e 100644
--- a/Lib/multiprocessing/synchronize.py
+++ b/Lib/multiprocessing/synchronize.py
@@ -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(), \
diff --git a/Lib/multiprocessing/util.py b/Lib/multiprocessing/util.py
index 8760c82..ea5443d 100644
--- a/Lib/multiprocessing/util.py
+++ b/Lib/multiprocessing/util.py
@@ -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: