[pypy-svn] r29325 - pypy/dist/pypy/translator/backendopt
arigo at codespeak.net
arigo at codespeak.net
Sun Jun 25 17:57:38 CEST 2006
Author: arigo
Date: Sun Jun 25 17:57:31 2006
New Revision: 29325
Modified:
pypy/dist/pypy/translator/backendopt/constfold.py
Log:
Fix to avoid crashing on obscure unlisted operations.
This seems to produce a working pypy-c now.
Modified: pypy/dist/pypy/translator/backendopt/constfold.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/constfold.py (original)
+++ pypy/dist/pypy/translator/backendopt/constfold.py Sun Jun 25 17:57:31 2006
@@ -22,16 +22,20 @@
vargs.append(v)
if len(args) == len(vargs):
RESTYPE = spaceop.result.concretetype
- op = getattr(llop, spaceop.opname)
try:
- result = op(RESTYPE, *args)
- except TypeError:
+ op = getattr(llop, spaceop.opname)
+ except AttributeError:
pass
else:
- # success in folding this space operation
- constants[spaceop.result] = Constant(result, RESTYPE)
- folded_count += 1
- continue
+ try:
+ result = op(RESTYPE, *args)
+ except TypeError:
+ pass
+ else:
+ # success in folding this space operation
+ constants[spaceop.result] = Constant(result, RESTYPE)
+ folded_count += 1
+ continue
# failed to fold an operation, exit early if requested
if exit_early:
return folded_count
More information about the Pypy-commit
mailing list