[issue21340] Possible concurrency bug in asyncio, AttributeError in tasks.py

2014-04-27 Thread Guido van Rossum

Guido van Rossum added the comment:

Sorry, should have let someone review it. I'm a bit out of practice. :-)

But in this case I think three-arg getattr() is better; less code, less 
indentation, and the final question (is the frame not None?) must still be 
asked.

--

___
Python tracker 

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



[issue21340] Possible concurrency bug in asyncio, AttributeError in tasks.py

2014-04-27 Thread STINNER Victor

STINNER Victor added the comment:

Why not using try/except AttributeError?

--

___
Python tracker 

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



[issue21340] Possible concurrency bug in asyncio, AttributeError in tasks.py

2014-04-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d42d3d3f9c41 by Guido van Rossum in branch '3.4':
asyncio: Be careful accessing instance variables in __del__ (closes #21340).
http://hg.python.org/cpython/rev/d42d3d3f9c41

New changeset 0cb436c6f082 by Guido van Rossum in branch 'default':
Merge 3.4 -> default: asyncio: Be careful accessing instance variables in 
__del__ (closes #21340).
http://hg.python.org/cpython/rev/0cb436c6f082

--
nosy: +python-dev
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue21340] Possible concurrency bug in asyncio, AttributeError in tasks.py

2014-04-24 Thread Guido van Rossum

Guido van Rossum added the comment:

Oh wait, it looks like the assert failed because KeyboardInterrupt hit right at 
that point. I ran the program a few times and when I hit ^C I get a traceback 
at a different point in the code each time. This is as expected. You must have 
hit the rare case where it hit right at the assert -- then the behavior I 
described can happen.

Anyway, I think this would fix it:

--- a/asyncio/tasks.py  Fri Apr 18 09:51:35 2014 -0700
+++ b/asyncio/tasks.py  Thu Apr 24 23:44:57 2014 -0700
@@ -76,7 +76,8 @@
 return self.gen.gi_code

 def __del__(self):
-frame = self.gen.gi_frame
+gen = getattr(self, 'gen', None)
+frame = getattr(gen, 'gi_frame', None)
 if frame is not None and frame.f_lasti == -1:
 func = self.func
 code = func.__code__

--

___
Python tracker 

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



[issue21340] Possible concurrency bug in asyncio, AttributeError in tasks.py

2014-04-24 Thread Guido van Rossum

Guido van Rossum added the comment:

Looks like there is a bug in CoroWrapper -- when the assert in __init__ fails, 
__del__ gets called imediately after and that triggers this traceback.

However I'm not sure what causes the assert to fail -- it looks like this is 
coming from sleep(), which does not make sense to me.

--

___
Python tracker 

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



[issue21340] Possible concurrency bug in asyncio, AttributeError in tasks.py

2014-04-24 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +giampaolo.rodola, gvanrossum, haypo, pitrou, yselivanov

___
Python tracker 

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



[issue21340] Possible concurrency bug in asyncio, AttributeError in tasks.py

2014-04-23 Thread Jack Murray

Changes by Jack Murray :


--
title: Possible bug in asyncio -> Possible concurrency bug in asyncio, 
AttributeError in tasks.py

___
Python tracker 

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