# HG changeset patch
# User Corbin Simpson <MostAwesomeDude@gmail.com>
# Date 1283545568 25200
# Node ID 2f1eff096fa8dfc7cf5d3bf9352466babc22dc96
# Parent  8bff3332e34fb4434f728e0aec6b009b9add3210
ExprNodes: Add C++ error handling for std::invalid_argument.

Also expand comments slightly.

diff -r 8bff3332e34f -r 2f1eff096fa8 Cython/Compiler/ExprNodes.py
--- a/Cython/Compiler/ExprNodes.py	Tue Feb 02 02:10:32 2010 -0800
+++ b/Cython/Compiler/ExprNodes.py	Fri Sep 03 13:26:08 2010 -0700
@@ -6187,8 +6187,13 @@
       ; // let the latest Python exn pass through and ignore the current one
     else
       throw;
+  } catch (const std::invalid_argument& exn) {
+    // Catch a handful of different errors here and turn them into the
+    // equivalent Python errors.
+    // Change invalid_argument to ValueError
+    PyErr_SetString(PyExc_ValueError, exn.what());
   } catch (const std::out_of_range& exn) {
-    // catch out_of_range explicitly so the proper Python exn may be raised
+    // Change out_of_range to IndexError
     PyErr_SetString(PyExc_IndexError, exn.what());
   } catch (const std::exception& exn) {
     PyErr_SetString(PyExc_RuntimeError, exn.what());
