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.

classification
Title: thread.name crashes interpreter
Type: Stage:
Components: Interpreter Core Versions: Python 2.3
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: ellisj, tim.peters
Priority: normal Keywords:

Created on 2004-06-11 20:15 by ellisj, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg21165 - (view) Author: Jonathan Ellis (ellisj) Date: 2004-06-11 20:15
I changed the __repr__ method of the cookbook Future
class --
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/84317
-- as follows:

    def __repr__(self):
        return '<%s at %s:%s>' % (self.__T.name,
hex(id(self)), self.__status)

this caused obscure crashes with the uninformative message
        Fatal Python error: PyEval_SaveThread: NULL tstate

changing to __T.getName() fixed the crashing.

It seems to me that thread.name should be __name or
_name to help novices not shoot themselves in the foot.
msg21166 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2004-06-13 02:58
Logged In: YES 
user_id=31435

I've been unable to reproduce any problems with Future 
modified to use your __repr__, under Python 2.3.4 on 
Windows.  Of course any attempt to invoke that method dies 
with

AttributeError: 'Thread' object has no attribute 'name'

but that's not a bug.

Python won't change to add other ways of getting the thread 
name -- the Python philosophy is to supply one clear way to 
do a thing, and is opposed to Tower of Babel approaches that 
try to cater to everything someone might type off the top of 
their head.  There's no end to that (why not .Name 
and .thread_name and ... too?).

Would you kindly add specific code to this report, sufficient 
to reproduce the fatal Python error you mentioned?  If that 
occurs, it's a bug, but I've been unable to provoke it.
msg21167 - (view) Author: Jonathan Ellis (ellisj) Date: 2004-06-13 03:57
Logged In: YES 
user_id=657828

sorry, if I had been able to fine a simple crash case I
would have given it.  :-|
msg21168 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2004-06-14 02:13
Logged In: YES 
user_id=31435

Well, in the absence of a test case, we can't even be sure 
this specific change was the true cause, so I'm closing this 
for now.  Feel encouraged to reopen it if more evidence 
appears.

FWIW, "NULL tstate" messages are historically almost all due 
to flawed logic in 3rd-party C extension modules.
History
Date User Action Args
2022-04-11 14:56:04adminsetgithub: 40389
2004-06-11 20:15:24ellisjcreate