[issue14474] mishandling of AttributeError in threads

2012-04-22 Thread Stefan Behnel

Stefan Behnel  added the comment:

Could the

while thread._count() > c:
pass

in test_thread.py be changed to this? (as used in other places)

while thread._count() > c:
time.sleep(0.01)

It currently hangs in Cython because it doesn't free the GIL during the plain C 
loop. (While that might be considered a bug in Cython, it's not what this test 
is supposed to test for.)

--
nosy: +scoder

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14474] mishandling of AttributeError in threads

2012-04-02 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 60ad83716733 by Benjamin Peterson in branch '3.2':
prevent writing to stderr from messing up the exception state (closes #14474)
http://hg.python.org/cpython/rev/60ad83716733

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14474] mishandling of AttributeError in threads

2012-04-02 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 8609d7fcdcc7 by Benjamin Peterson in branch '2.7':
prevent writing to stderr from messing up the exception state (closes #14474)
http://hg.python.org/cpython/rev/8609d7fcdcc7

--
nosy: +python-dev
resolution:  -> fixed
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14474] mishandling of AttributeError in threads

2012-04-02 Thread Pierre Ossman

Pierre Ossman  added the comment:

Indeed. I assume old style classes are still supported though?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14474] mishandling of AttributeError in threads

2012-04-02 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

If Dummy is a new-style class, the traceback is correctly printed.

--
nosy: +amaury.forgeotdarc

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14474] mishandling of AttributeError in threads

2012-04-02 Thread Pierre Ossman

New submission from Pierre Ossman :

These three things do not mix:

 - AttributeError
 - Threads
 - Object methods

An unhandled AttributeError thrown in a thread will not call sys.excepthook if 
the thread's start function is a class/object method.

Test case:


import sys
import thread

class Dummy:
def worker(self):
raise AttributeError

thread.start_new_thread(Dummy().worker, ())

sys.stdin.readline()


Note that you do not get a traceback here. Throwing any other exception type 
works fine, as does having worker() be a simple function.

I think I've traced the issue to Objects/classobject.c:instance_repr(). It 
tries to look up the method, making sure to handle any AttributeError this 
might cause. But it fails to save and restore and Exception currently already 
active, effectively clearing out the current exception.

--
components: Interpreter Core
messages: 157350
nosy: ossman
priority: normal
severity: normal
status: open
title: mishandling of AttributeError in threads
versions: Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com