Author: Armin Rigo <[email protected]>
Branch: py3.5
Changeset: r88747:c8d9cf08602f
Date: 2016-11-29 16:41 +0100
http://bitbucket.org/pypy/pypy/changeset/c8d9cf08602f/
Log: optimize away Coroutine._finalize_() earlier
diff --git a/pypy/interpreter/generator.py b/pypy/interpreter/generator.py
--- a/pypy/interpreter/generator.py
+++ b/pypy/interpreter/generator.py
@@ -107,6 +107,14 @@
if self.saved_operr is not None:
ec.set_sys_exc_info(self.saved_operr)
self.saved_operr = None
+ #
+ # Optimization only: after we've started a Coroutine without
+ # CO_YIELD_INSIDE_TRY, then Coroutine._finalize_() will be a no-op
+ if (isinstance(self, Coroutine)
+ and frame.last_instr == -1
+ and not (self.pycode.co_flags & CO_YIELD_INSIDE_TRY)):
+ rgc.may_ignore_finalizer(self)
+ #
self.running = True
try:
w_result = frame.execute_frame(self, w_arg_or_err)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit