[Python-checkins] cpython (3.4): asyncio: Be careful accessing instance variables in __del__ (closes #21340).
guido.van.rossum
python-checkins at python.org
Sun Apr 27 19:47:37 CEST 2014
http://hg.python.org/cpython/rev/d42d3d3f9c41
changeset: 90478:d42d3d3f9c41
branch: 3.4
parent: 90469:d24f1fb256a3
user: Guido van Rossum <guido at python.org>
date: Sun Apr 27 10:33:58 2014 -0700
summary:
asyncio: Be careful accessing instance variables in __del__ (closes #21340).
files:
Lib/asyncio/tasks.py | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py
--- a/Lib/asyncio/tasks.py
+++ b/Lib/asyncio/tasks.py
@@ -76,7 +76,9 @@
return self.gen.gi_code
def __del__(self):
- frame = self.gen.gi_frame
+ # Be careful accessing self.gen.frame -- self.gen might not exist.
+ 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__
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list