[Python-Dev] [Python-checkins] cpython: Issue #11223: Add threading._info() function providing informations about the

Victor Stinner victor.stinner at haypocalc.com
Wed Apr 20 16:01:34 CEST 2011


Le mercredi 20 avril 2011 à 20:24 +1000, Nick Coghlan a écrit :
> On Wed, Apr 20, 2011 at 6:20 PM, Victor Stinner
> <victor.stinner at haypocalc.com> wrote:
> > Hi,
> >
> > Le mardi 19 avril 2011 à 22:42 -0400, Terry Reedy a écrit :
> >> On 4/19/2011 5:59 PM, victor.stinner wrote:
> >>
> >> >    Issue #11223: Add threading._info() function providing informations about the
> >> > thread implementation.
> >>
> >> Since this is being documented, making it part of the public api, why
> >> does it have a leading underscore?
> >
> > Well, I suppose that this function might be specific to CPython. Do you
> > think that this function can/should be implemented in PyPy, Jython and
> > IronPython?
> 
> I agree with your reasoning (and the leading underscore), but I
> suggest marking the docs with the implementation detail flag.

I chose to return a dict to be flexible: any thread implementation may
add new specific keys. There is just one mandatory key: 'name', name of
the thread implementation (nt, os2, pthread or solaris for CPython 3.3).

http://docs.python.org/dev/py3k/library/threading.html#threading._info

After thinking twice, PyPy, Jython and IronPython should be able to fill
the only required key (name).

PyPy reuses the code from CPython, so it can just reuse the same names
(pthread or nt). I suppose that IronPython uses Windows threads and
semaphores, so it can use the name 'nt'. For Jython, I don't know if
Jython is able to get the name of the thread implementation used by the
JVM. If it is not, something like 'jvm' can be used.

threading._info() is a function: it can call other functions to retrieve
informations (it is not hardcoded or initialized at startup).

What do you think? Can I remove the leading underscore? :-)

Victor



More information about the Python-Dev mailing list