benjamin.peterson
2008-08-18 16:45:32 UTC
Author: benjamin.peterson
Date: Mon Aug 18 18:45:31 2008
New Revision: 65819
Log:
Merged revisions 65818 via svnmerge from
svn+ssh://pythondev at svn.python.org/python/trunk
........
r65818 | benjamin.peterson | 2008-08-18 11:40:03 -0500 (Mon, 18 Aug 2008) | 4 lines
change threading.getIdent to a property
This is new in 2.6 so now need to worry about backwards compatibility :)
........
Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Doc/library/threading.rst
python/branches/py3k/Lib/test/test_threading.py
python/branches/py3k/Lib/threading.py
Modified: python/branches/py3k/Doc/library/threading.rst
==============================================================================
--- python/branches/py3k/Doc/library/threading.rst (original)
+++ python/branches/py3k/Doc/library/threading.rst Mon Aug 18 18:45:31 2008
@@ -643,12 +643,12 @@
constructor.
-.. method:: Thread.get_ident()
+.. attribute:: Thread.ident
- Return the 'thread identifier' of this thread or None if the thread has not
- been started. This is a nonzero integer. See the :func:`thread.get_ident()`
+ The 'thread identifier' of this thread or ``None`` if the thread has not been
+ started. This is a nonzero integer. See the :func:`thread.get_ident()`
function. Thread identifiers may be recycled when a thread exits and another
- thread is created. The identifier is returned even after the thread has
+ thread is created. The identifier is available even after the thread has
exited.
Modified: python/branches/py3k/Lib/test/test_threading.py
==============================================================================
--- python/branches/py3k/Lib/test/test_threading.py (original)
+++ python/branches/py3k/Lib/test/test_threading.py Mon Aug 18 18:45:31 2008
@@ -74,7 +74,7 @@
for i in range(NUMTASKS):
t = TestThread("<thread %d>"%i, self, sema, mutex, numrunning)
threads.append(t)
- self.failUnlessEqual(t.get_ident(), None)
+ self.failUnlessEqual(t.ident, None)
self.assert_(re.match('<TestThread\(.*, initial\)>', repr(t)))
t.start()
@@ -83,7 +83,7 @@
for t in threads:
t.join(NUMTASKS)
self.assert_(not t.is_alive())
- self.failIfEqual(t.get_ident(), 0)
+ self.failIfEqual(t.ident, 0)
self.assert_(re.match('<TestThread\(.*, \w+ -?\d+\)>', repr(t)))
if verbose:
print('all tasks done')
Modified: python/branches/py3k/Lib/threading.py
==============================================================================
--- python/branches/py3k/Lib/threading.py (original)
+++ python/branches/py3k/Lib/threading.py Mon Aug 18 18:45:31 2008
@@ -629,7 +629,8 @@
assert self._initialized, "Thread.__init__() not called"
self._name = str(name)
- def get_ident(self):
+ @property
+ def ident(self):
assert self._initialized, "Thread.__init__() not called"
return self._ident
Date: Mon Aug 18 18:45:31 2008
New Revision: 65819
Log:
Merged revisions 65818 via svnmerge from
svn+ssh://pythondev at svn.python.org/python/trunk
........
r65818 | benjamin.peterson | 2008-08-18 11:40:03 -0500 (Mon, 18 Aug 2008) | 4 lines
change threading.getIdent to a property
This is new in 2.6 so now need to worry about backwards compatibility :)
........
Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Doc/library/threading.rst
python/branches/py3k/Lib/test/test_threading.py
python/branches/py3k/Lib/threading.py
Modified: python/branches/py3k/Doc/library/threading.rst
==============================================================================
--- python/branches/py3k/Doc/library/threading.rst (original)
+++ python/branches/py3k/Doc/library/threading.rst Mon Aug 18 18:45:31 2008
@@ -643,12 +643,12 @@
constructor.
-.. method:: Thread.get_ident()
+.. attribute:: Thread.ident
- Return the 'thread identifier' of this thread or None if the thread has not
- been started. This is a nonzero integer. See the :func:`thread.get_ident()`
+ The 'thread identifier' of this thread or ``None`` if the thread has not been
+ started. This is a nonzero integer. See the :func:`thread.get_ident()`
function. Thread identifiers may be recycled when a thread exits and another
- thread is created. The identifier is returned even after the thread has
+ thread is created. The identifier is available even after the thread has
exited.
Modified: python/branches/py3k/Lib/test/test_threading.py
==============================================================================
--- python/branches/py3k/Lib/test/test_threading.py (original)
+++ python/branches/py3k/Lib/test/test_threading.py Mon Aug 18 18:45:31 2008
@@ -74,7 +74,7 @@
for i in range(NUMTASKS):
t = TestThread("<thread %d>"%i, self, sema, mutex, numrunning)
threads.append(t)
- self.failUnlessEqual(t.get_ident(), None)
+ self.failUnlessEqual(t.ident, None)
self.assert_(re.match('<TestThread\(.*, initial\)>', repr(t)))
t.start()
@@ -83,7 +83,7 @@
for t in threads:
t.join(NUMTASKS)
self.assert_(not t.is_alive())
- self.failIfEqual(t.get_ident(), 0)
+ self.failIfEqual(t.ident, 0)
self.assert_(re.match('<TestThread\(.*, \w+ -?\d+\)>', repr(t)))
if verbose:
print('all tasks done')
Modified: python/branches/py3k/Lib/threading.py
==============================================================================
--- python/branches/py3k/Lib/threading.py (original)
+++ python/branches/py3k/Lib/threading.py Mon Aug 18 18:45:31 2008
@@ -629,7 +629,8 @@
assert self._initialized, "Thread.__init__() not called"
self._name = str(name)
- def get_ident(self):
+ @property
+ def ident(self):
assert self._initialized, "Thread.__init__() not called"
return self._ident