Author: Ronan Lamy <[email protected]>
Branch: exc-later
Changeset: r80554:5b473e7cb37a
Date: 2015-11-04 02:52 +0000
http://bitbucket.org/pypy/pypy/changeset/5b473e7cb37a/
Log: Simplify guessexception()
diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py
--- a/rpython/flowspace/flowcontext.py
+++ b/rpython/flowspace/flowcontext.py
@@ -118,7 +118,7 @@
# block.exits[True] = ifLink.
raise StopFlowing
- def guessexception(self, ctx, *cases):
+ def guessexception(self, ctx):
block = self.crnt_block
links = []
normal_block = EggBlock([], block, None)
@@ -163,7 +163,7 @@
ctx.recorder = self.nextreplayer
return self.booloutcome
- def guessexception(self, ctx, *classes):
+ def guessexception(self, ctx):
assert self.index == len(self.listtoreplay)
ctx.recorder = self.nextreplayer
outcome = self.booloutcome
@@ -354,19 +354,11 @@
def do_op(self, op):
self.maybe_merge()
self.record(op)
- self.guessexception(op.canraise)
+ # Implicit exceptions are ignored unless they are caught explicitly
+ if op.canraise and self.has_exc_handler():
+ self.recorder.guessexception(self)
return op.result
- def guessexception(self, exceptions):
- """
- Catch possible exceptions implicitly.
- """
- if not exceptions:
- return
- # Implicit exceptions are ignored unless they are caught explicitly
- if self.has_exc_handler():
- self.recorder.guessexception(self, *exceptions)
-
def has_exc_handler(self):
return any(isinstance(block, (ExceptBlock, FinallyBlock))
for block in self.blockstack)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit