STINNER Victor <victor.stin...@haypocalc.com> added the comment: > 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) ---------- Added file: http://bugs.python.org/file21786/sys_thread_info-2.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11223> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com