Message149001
| Author |
vstinner |
| Recipients |
vstinner |
| Date |
2011年12月07日.22:40:24 |
| SpamBayes Score |
2.5813796e-12 |
| Marked as misclassified |
No |
| Message-id |
<1323297626.55.0.00727033353184.issue13550@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
The threading module uses an hack to log actions to help debugging. The log depends on 3 flags: __debug__, threading._VERBOSE and a verbose attribute (each threading class has such attribute). By default, _note() is always called but does nothing: it checks the verbose attribute and return if the flag is False.
Attached threading_note.patch only calls _note() if verbose is True to avoid a Python function call (which is slow in CPython). It avoids also a _Verbose parent class and pass the verbose flag to subobjects (e.g. Semaphore sets verbose argument of its Condition object).
I don't think that it is really useful to be able to enable/disable logs on only one threading object, so it is maybe simpler to have only one global flag (instead of 3 flags): threading._VERBOSE. Attached threading_note_global.patch replaces _note() method by a function, remove _Verbose class and the _verbose attribute, and only call _note() if _VERBOSE is True.
_VERBOSE and verbose arguments are undocumented and not tested, so I hope nobody relies on their API ;-) |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2011年12月07日 22:40:28 | vstinner | set | recipients:
+ vstinner |
| 2011年12月07日 22:40:26 | vstinner | set | messageid: <1323297626.55.0.00727033353184.issue13550@psf.upfronthosting.co.za> |
| 2011年12月07日 22:40:25 | vstinner | link | issue13550 messages |
| 2011年12月07日 22:40:25 | vstinner | create |
|