This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2011年12月07日 22:40 by vstinner, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| threading_note.patch | vstinner, 2011年12月07日 22:40 | review | ||
| threading_note_global.patch | vstinner, 2011年12月07日 23:16 | review | ||
| Messages (10) | |||
|---|---|---|---|
| msg149001 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2011年12月07日 22:40 | |
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 ;-) |
|||
| msg149003 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2011年12月07日 23:16 | |
(threading_note_global.patch was completly wrong, here is the fixed version) |
|||
| msg149084 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2011年12月09日 10:11 | |
Tim, do you happen to know what the goal was with the threading._VERBOSE hack and the undocumented _Verbose class? |
|||
| msg149166 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年12月10日 16:30 | |
On #13550 I asked Guido about the Thing/_Thing function/class indirection and use of _Verbose; the reply: > IIRC: > > The design started out this way because it predates new-style classes. When this was put in one > couldn't subclass extension types, and there were plans/hopes to replace some of the lock types > with platform-specific built-in versions on some platforms. > > Since it is now possible to write subclassable extension types the Thing/_Thing design is no > longer needed. > > I'm not sure about the _Verbose hacks, if it is deemed not useful I'm fine with letting it go. |
|||
| msg149823 - (view) | Author: Charles-François Natali (neologix) * (Python committer) | Date: 2011年12月19日 09:08 | |
I'm personally +1 on removing the verbose thing altogether: - it's ugly - I doubt it's really useful (I mean, printing to stderr - which is often line buffered or unbuffered - upon every action will probably change the timing) - it also brings some problems on its own, e.g. #4188 So unless there's a good reason behind it, I think we could let it go. |
|||
| msg150803 - (view) | Author: Charles-François Natali (neologix) * (Python committer) | Date: 2012年01月07日 15:55 | |
Alright, Nick agreed on python-dev to remove the logging hack. |
|||
| msg150805 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2012年01月07日 16:09 | |
haypo’s threading_note_global looks good to me. The only thing I’m not sure about is the signature change from X(verbose, *args, **kwargs) to X(*args, **kwargs): is it okay? (BTW you probably want to delete the obsolete reference to ihooks in a comment before committing.) |
|||
| msg152820 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2012年02月07日 23:42 | |
> Alright, Nick agreed on python-dev to remove the logging hack. You mean removing complelty debug logging from the threading module? Or just to simplify the code to decide if we should log or not? |
|||
| msg152824 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2012年02月08日 01:09 | |
I believe Charles-François was referring to this message: http://mail.python.org/pipermail/python-dev/2012-January/115372.html We shouldn't be encumbering threading *all the time* with stuff that "might be useful sometimes". Adding selective output to help debug problems can be handled with Thread subclasses, or even temporarily running with a modified threading.py (for people hacking on the stdlib itself). |
|||
| msg154815 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2012年03月03日 00:35 | |
New changeset 8ec51b2e57c2 by Victor Stinner in branch 'default': Close #13550: Remove the debug machinery from the threading module: remove http://hg.python.org/cpython/rev/8ec51b2e57c2 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:24 | admin | set | github: 57759 |
| 2012年03月03日 00:35:31 | python-dev | set | status: open -> closed nosy: + python-dev messages: + msg154815 resolution: fixed stage: resolved |
| 2012年02月08日 01:09:24 | ncoghlan | set | messages: + msg152824 |
| 2012年02月07日 23:42:21 | vstinner | set | messages: + msg152820 |
| 2012年01月07日 16:09:17 | eric.araujo | set | messages: + msg150805 |
| 2012年01月07日 15:55:46 | neologix | set | nosy:
+ ncoghlan messages: + msg150803 |
| 2012年01月04日 04:36:13 | jcea | set | nosy:
+ jcea |
| 2011年12月19日 09:08:10 | neologix | set | nosy:
+ neologix messages: + msg149823 |
| 2011年12月10日 16:30:15 | eric.araujo | set | nosy:
+ eric.araujo messages: + msg149166 |
| 2011年12月09日 10:11:37 | pitrou | set | nosy:
+ pitrou, tim.peters messages: + msg149084 |
| 2011年12月07日 23:16:25 | vstinner | set | files:
+ threading_note_global.patch messages: + msg149003 |
| 2011年12月07日 23:15:59 | vstinner | set | files: - threading_note_global.patch |
| 2011年12月07日 22:40:41 | vstinner | set | files: + threading_note_global.patch |
| 2011年12月07日 22:40:25 | vstinner | create | |