additional fix and test for ticket #650
authorLisandro Dalcin <dalcinl@gmail.com>
Tue, 5 Apr 2011 17:29:36 +0000 (14:29 -0300)
committerLisandro Dalcin <dalcinl@gmail.com>
Tue, 5 Apr 2011 17:29:36 +0000 (14:29 -0300)
Cython/Compiler/Nodes.py
tests/run/raise_memory_error_T650.pyx

index bdb524cf2cb484e3ef9ebc48552abd19c462b73e..e7c3bd4f4f9280273d0248b33ce1ead71762b2e9 100644 (file)
@@ -4145,7 +4145,9 @@ class RaiseStatNode(StatNode):
         if self.exc_type and not self.exc_value and not self.exc_tb:
             exc = self.exc_type
             import ExprNodes
-            if isinstance(exc, ExprNodes.SimpleCallNode) and not exc.args:
+            if (isinstance(exc, ExprNodes.SimpleCallNode) and 
+                not (exc.args or (exc.arg_tuple is not None and 
+                                  exc.arg_tuple.args))):
                 exc = exc.function # extract the exception type
             if exc.is_name and exc.entry.is_builtin:
                 self.builtin_exc_name = exc.name
index 1fcc76271f144fde74f62518520f25b0fddbd453..065faf2c9afb78ff85e4782b9c22aca955cf33e3 100644 (file)
@@ -23,3 +23,12 @@ def raise_me_instance():
     ... else: print('NOT RAISED!')
     """
     raise MemoryError()
+
+def raise_me_instance_value():
+    """
+    >>> raise_me_instance_value()
+    Traceback (most recent call last):
+        ...
+    MemoryError: oom
+    """
+    raise MemoryError("oom")