Rev 4913: It seems that python 2.4/2.5 don't have thread.ident, fall back to getName() in http://bzr.arbash-meinel.com/branches/bzr/jam-integration
John Arbash Meinel
john at arbash-meinel.com
Fri Dec 18 22:14:25 GMT 2009
At http://bzr.arbash-meinel.com/branches/bzr/jam-integration
------------------------------------------------------------
revno: 4913
revision-id: john at arbash-meinel.com-20091218221418-z5z2sgq6shohraw1
parent: john at arbash-meinel.com-20091218215454-g8fpi3sb8nnstof0
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: jam-integration
timestamp: Fri 2009-12-18 16:14:18 -0600
message:
It seems that python 2.4/2.5 don't have thread.ident, fall back to getName()
-------------- next part --------------
=== modified file 'bzrlib/smart/medium.py'
--- a/bzrlib/smart/medium.py 2009-12-11 21:57:03 +0000
+++ b/bzrlib/smart/medium.py 2009-12-18 22:14:18 +0000
@@ -300,7 +300,10 @@
tstart = osutils.timer_func()
osutils.send_all(self.socket, bytes, self._report_activity)
if 'hpss' in debug.debug_flags:
- thread_id = threading.currentThread().ident
+ cur_thread = threading.currentThread()
+ thread_id = getattr(cur_thread, 'ident', None)
+ if thread_id is None:
+ thread_id = cur_thread.getName()
trace.mutter('%12s: [%s] %d bytes to the socket in %.3fs'
% ('wrote', thread_id, len(bytes),
osutils.timer_func() - tstart))
=== modified file 'bzrlib/smart/protocol.py'
--- a/bzrlib/smart/protocol.py 2009-12-18 21:54:54 +0000
+++ b/bzrlib/smart/protocol.py 2009-12-18 22:14:18 +0000
@@ -1147,7 +1147,12 @@
self.response_sent = False
self._headers = {'Software version': bzrlib.__version__}
if 'hpss' in debug.debug_flags:
- self._thread_id = threading.currentThread().ident
+ # python 2.6 introduced 'ident' as a nice small integer to
+ # represent a thread. But it doesn't exist in 2.4/2.5
+ cur_thread = threading.currentThread()
+ self._thread_id = getattr(cur_thread, 'ident', None)
+ if self._thread_id is None:
+ self._thread_id = cur_thread.getName()
self._response_start_time = None
def _trace(self, action, message, extra_bytes=None, include_time=False):
=== modified file 'bzrlib/smart/request.py'
--- a/bzrlib/smart/request.py 2009-12-18 21:54:54 +0000
+++ b/bzrlib/smart/request.py 2009-12-18 22:14:18 +0000
@@ -291,7 +291,10 @@
self._command = None
if 'hpss' in debug.debug_flags:
self._request_start_time = osutils.timer_func()
- self._thread_id = threading.currentThread().ident
+ cur_thread = threading.currentThread()
+ self._thread_id = getattr(cur_thread, 'ident', None)
+ if self._thread_id is None:
+ self._thread_id = cur_thread.getName()
def _trace(self, action, message, extra_bytes=None, include_time=False):
# It is a bit of a shame that this functionality overlaps with that of
More information about the bazaar-commits
mailing list