[pypy-svn] r15401 - in pypy/dist/pypy/translator/llvm2: . test

ericvrp at codespeak.net ericvrp at codespeak.net
Sat Jul 30 11:45:08 CEST 2005


Author: ericvrp
Date: Sat Jul 30 11:45:07 2005
New Revision: 15401

Modified:
   pypy/dist/pypy/translator/llvm2/opwriter.py
   pypy/dist/pypy/translator/llvm2/test/test_exception.py
Log:
fixed: issubclass call parameters in wrong order

Modified: pypy/dist/pypy/translator/llvm2/opwriter.py
==============================================================================
--- pypy/dist/pypy/translator/llvm2/opwriter.py	(original)
+++ pypy/dist/pypy/translator/llvm2/opwriter.py	Sat Jul 30 11:45:07 2005
@@ -227,7 +227,7 @@
 
             ll_issubclass_cond = self.db.repr_tmpvar()
             self.codewriter.call(ll_issubclass_cond, 'bool', ll_exception_match,
-                [etype.ref, tmpvar2], [lltype_of_exception_type, lltype_of_exception_type])
+                [tmpvar2, etype.ref], [lltype_of_exception_type, lltype_of_exception_type])
             self.codewriter.br(ll_issubclass_cond, not_this_exception_label, exc_found_label)
             self.codewriter.label(not_this_exception_label)
 

Modified: pypy/dist/pypy/translator/llvm2/test/test_exception.py
==============================================================================
--- pypy/dist/pypy/translator/llvm2/test/test_exception.py	(original)
+++ pypy/dist/pypy/translator/llvm2/test/test_exception.py	Sat Jul 30 11:45:07 2005
@@ -10,6 +10,13 @@
     def __init__(self, n):
         self.n = n
 
+def getitem(l, i):  #LookupError, KeyError
+    if i < 0:
+        i = len(l) - i
+    if i>= len(l):
+        raise IndexError
+    return l[i]
+
 def test_simple1():
     #py.test.skip("not working yet")
     def raise_(i):
@@ -30,11 +37,12 @@
     assert f(1) == fn(1)
 
 def test_simple2():
-    py.test.skip("not working yet, lst[n] raises no exceptions")
+    #py.test.skip("not working yet, lst[n] raises no exceptions")
+    py.test.skip('failing')
     def fn(n):
         lst = range(10)
         try:
-            lst[n]
+            getitem(lst,n)
         except:
             return 2
         return 4
@@ -71,11 +79,12 @@
     assert f(2) == fn(2)
 
 def test_pass_exc():
-    py.test.skip("not working yet, lst[n] raises no exceptions")
+    #py.test.skip("not working yet, lst[n] raises no exceptions")
+    py.test.skip('failing')
     def fn(n):
         lst = range(10)
         try:
-            lst[n]
+            getitem(lst,n)
         except:
             pass
         return 4
@@ -96,11 +105,12 @@
     assert f(0) == fn(0)
     
 def test_reraise1():
-    py.test.skip("not working yet, lst[n] raises no exceptions")
+    #py.test.skip("not working yet, lst[n] raises no exceptions")
+    py.test.skip('failing')
     def fn(n):
         lst = range(10)
         try:
-            lst[n]
+            getitem(lst,n)
         except:
             raise
         return 4
@@ -110,11 +120,12 @@
     assert f(10) == fn(10)
 
 def test_reraise2():
-    py.test.skip("not working yet, lst[n] raises no exceptions")
+    #py.test.skip("not working yet, lst[n] raises no exceptions")
+    py.test.skip('failing')
     def fn(n):
         lst = range(10)
         try:
-            lst[n]
+            getitem(lst,n)
         except e:
             raise e
         return 4
@@ -124,11 +135,11 @@
     assert f(10) == fn(10)
 
 def test_simple_exception():
-    py.test.skip("not working yet, lst[n] raises no exceptions")
+    #py.test.skip("not working yet, lst[n] raises no exceptions")
     def fn(n):
         lst = range(10)
         try:
-            lst[n]
+            getitem(lst,n)
         except IndexError:
             return 2
         return 4
@@ -139,11 +150,12 @@
         assert f(i) == fn(i)
 
 def test_two_exceptions():
-    py.test.skip("not working yet, lst[n] raises no exceptions")
+    #py.test.skip("not working yet, lst[n] raises no exceptions")
+    py.test.skip('failing')
     def fn(n):
         lst = range(10)
         try:
-            lst[n]
+            getitem(lst,n)
         except IndexError:
             return 2
         except KeyError:
@@ -156,11 +168,11 @@
         assert f(i) == fn(i)
 
 def test_catch_base_exception():
-    py.test.skip("not working yet, lst[n] raises no exceptions")
+    #py.test.skip("not working yet, lst[n] raises no exceptions")
     def fn(n):
         lst = range(10)
         try:
-            lst[n]
+            getitem(lst,n)
         except LookupError:
             return 2
         return 4



More information about the Pypy-commit mailing list