Author: Armin Rigo <[email protected]>
Branch:
Changeset: r69420:35e7f867cc40
Date: 2014-02-25 14:23 +0100
http://bitbucket.org/pypy/pypy/changeset/35e7f867cc40/
Log: Fix for @jit.elidable. Previously, it would elidably return None,
even though it doesn't mean that it will stay None forever.
diff --git a/pypy/module/_lsprof/interp_lsprof.py
b/pypy/module/_lsprof/interp_lsprof.py
--- a/pypy/module/_lsprof/interp_lsprof.py
+++ b/pypy/module/_lsprof/interp_lsprof.py
@@ -159,7 +159,7 @@
subentry = ProfilerSubEntry(entry.frame)
self.calls[entry] = subentry
return subentry
- return None
+ raise
class ProfilerContext(object):
def __init__(self, profobj, entry):
@@ -181,8 +181,11 @@
entry._stop(tt, it)
if profobj.subcalls and self.previous:
caller = jit.promote(self.previous.entry)
- subentry = caller._get_or_make_subentry(entry, False)
- if subentry is not None:
+ try:
+ subentry = caller._get_or_make_subentry(entry, False)
+ except KeyError:
+ pass
+ else:
subentry._stop(tt, it)
@@ -308,7 +311,7 @@
entry = ProfilerEntry(f_code)
self.data[f_code] = entry
return entry
- return None
+ raise
@jit.elidable
def _get_or_make_builtin_entry(self, key, make=True):
@@ -319,7 +322,7 @@
entry = ProfilerEntry(self.space.wrap(key))
self.builtin_data[key] = entry
return entry
- return None
+ raise
def _enter_call(self, f_code):
# we have a superb gc, no point in freelist :)
@@ -332,8 +335,11 @@
if context is None:
return
self = jit.promote(self)
- entry = self._get_or_make_entry(f_code, False)
- if entry is not None:
+ try:
+ entry = self._get_or_make_entry(f_code, False)
+ except KeyError:
+ pass
+ else:
context._stop(self, entry)
self.current_context = context.previous
@@ -347,8 +353,11 @@
if context is None:
return
self = jit.promote(self)
- entry = self._get_or_make_builtin_entry(key, False)
- if entry is not None:
+ try:
+ entry = self._get_or_make_builtin_entry(key, False)
+ except KeyError:
+ pass
+ else:
context._stop(self, entry)
self.current_context = context.previous
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit