[ python-Bugs-971395 ] thread.name crashes interpreter

SourceForge.net noreply at sourceforge.net
Sat Jun 12 23:57:03 EDT 2004


Bugs item #971395, was opened at 2004-06-11 20:15
Message generated for change (Comment added) made by ellisj
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=971395&group_id=5470

Category: Threads
Group: Python 2.3
Status: Open
Resolution: Works For Me
Priority: 5
Submitted By: Jonathan Ellis (ellisj)
Assigned to: Nobody/Anonymous (nobody)
Summary: thread.name crashes interpreter

Initial Comment:
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.

----------------------------------------------------------------------

>Comment By: Jonathan Ellis (ellisj)
Date: 2004-06-13 03:57

Message:
Logged In: YES 
user_id=657828

sorry, if I had been able to fine a simple crash case I
would have given it.  :-|

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2004-06-13 02:58

Message:
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.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=971395&group_id=5470



More information about the Python-bugs-list mailing list