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.

Author vstinner
Recipients benjamin.peterson, db3l, gregory.p.smith, neologix, pitrou, python-dev, rnk, sable, vstinner
Date 2011-04-26.21:48:09
SpamBayes Score 4.5392357e-10
Marked as misclassified No
Message-id <1303854492.3.0.110377840468.issue11223@psf.upfronthosting.co.za>
In-reply-to
Content
> Well, if it's called _info() in Python, it's private too!

My patch replaces thread._info() by sys.thread_info: it becomes public.

> What I mean is that the "#ifdef WITH_THREAD" could be done in
> sysmodule.c rather than in thread.c

PyThread_GetInfo() requires some informations that are only available at the end of thread.c: USE_SEMAPHORES define from thread_pthread.h and PYTHREAD_NAME from thread.c. It is easier to define PyThread_GetInfo() here, instead of giving access to these defines outside thread.c (and these defines should remaing private).

> Another small thing: your doc says "name" is optional, but it shouldn't.

By optional I mean that its value is None if Python is compiled without threads.

> Also, when Python is compiled without threads, 
> I don't think thread_info should be a structseq. 
> It should probably be None instead.

Terry Reedy proposed an empty string for name if Python is compiled without threads. Antoine suggested None instead of an empty string for lock and version fields, so I chose to use also None for None.

But yes, I like the idea of sys.thread_info being None.

--

Updated patch (sys_thread_info-2.patch):
 - sys.thread_info is None if Python is compiled without threads
 - sys.thread_info.name is no more optional
 - change the documentation of the lock and version fields
 - fix test_os (version is now a attribute and no more a key of a dict)
History
Date User Action Args
2011-04-26 21:48:13vstinnersetrecipients: + vstinner, gregory.p.smith, db3l, pitrou, sable, benjamin.peterson, rnk, neologix, python-dev
2011-04-26 21:48:12vstinnersetmessageid: <1303854492.3.0.110377840468.issue11223@psf.upfronthosting.co.za>
2011-04-26 21:48:11vstinnerlinkissue11223 messages
2011-04-26 21:48:11vstinnercreate