[issue21137] Better repr for threading.Lock()

Raymond Hettinger report at bugs.python.org
Thu Apr 3 03:19:02 CEST 2014


New submission from Raymond Hettinger:

It is really nice to have the open/closed status in the __repr__ of file objects: 

  <open file 'data.txt', mode 'r' at 0x102c8ec90>
  <closed file 'data.txt', mode 'r' at 0x102c8ec90>

I would like to have the same for locks:

  <unlocked thread.lock object at 0x1002b1330>
  <locked thread.lock object at 0x1002b1330>

This would be nice in logs and tracebacks for example.

----------
components: Library (Lib)
keywords: easy
messages: 215413
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Better repr for threading.Lock()
type: enhancement
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21137>
_______________________________________


More information about the Python-bugs-list mailing list