[Python-checkins] cpython (merge default -> default): Merge

antoine.pitrou python-checkins at python.org
Sat Dec 15 19:28:29 CET 2012


http://hg.python.org/cpython/rev/64b5c4a9bb3e
changeset:   80862:64b5c4a9bb3e
parent:      80861:5d6c2c7bc5d4
parent:      80857:bb6fd6f021e7
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Sat Dec 15 19:26:38 2012 +0100
summary:
  Merge

files:
  Lib/test/test_builtin.py |  5 +++++
  Python/ceval.c           |  5 ++---
  2 files changed, 7 insertions(+), 3 deletions(-)


diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -462,6 +462,11 @@
         self.assertRaises(TypeError, eval, ())
         self.assertRaises(SyntaxError, eval, bom[:2] + b'a')
 
+        class X:
+            def __getitem__(self, key):
+                raise ValueError
+        self.assertRaises(ValueError, eval, "foo", {}, X())
+
     def test_general_eval(self):
         # Tests that general mappings can be used for the locals argument
 
diff --git a/Python/ceval.c b/Python/ceval.c
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -2162,9 +2162,8 @@
             else {
                 v = PyObject_GetItem(locals, name);
                 if (v == NULL && PyErr_Occurred()) {
-                    if (!PyErr_ExceptionMatches(
-                                    PyExc_KeyError))
-                        break;
+                    if (!PyErr_ExceptionMatches(PyExc_KeyError))
+                        goto error;
                     PyErr_Clear();
                 }
             }

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list