diff options
author | Raymond Hettinger <python@rcn.com> | 2014-05-26 01:22:35 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2014-05-26 01:22:35 (GMT) |
commit | 62f4dad81607d8d0a70223ef3feacdfd3aa5e898 (patch) | |
tree | 5e4c3b7ccb6ab56240b77da3946c4e0a301c72f3 /Lib/_dummy_thread.py | |
parent | fa4ed0c145f2e17ccd59c2180cbf7be07c8c872d (diff) | |
download | cpython-62f4dad81607d8d0a70223ef3feacdfd3aa5e898.zip cpython-62f4dad81607d8d0a70223ef3feacdfd3aa5e898.tar.gz cpython-62f4dad81607d8d0a70223ef3feacdfd3aa5e898.tar.bz2 |
Issue 21137: Better repr for threading.Lock()
Diffstat (limited to 'Lib/_dummy_thread.py')
-rw-r--r-- | Lib/_dummy_thread.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/_dummy_thread.py b/Lib/_dummy_thread.py index b67cfb9..36e5f38 100644 --- a/Lib/_dummy_thread.py +++ b/Lib/_dummy_thread.py @@ -140,6 +140,14 @@ class LockType(object): def locked(self): return self.locked_status + def __repr__(self): + return "<%s %s.%s object at %s>" % ( + "locked" if self.locked_status else "unlocked", + self.__class__.__module__, + self.__class__.__qualname__, + hex(id(self)) + ) + # Used to signal that interrupt_main was called in a "thread" _interrupt = False # True when not executing in a "thread" |