Author: Armin Rigo <[email protected]>
Branch: flow-no-local-exception
Changeset: r66009:0c095b5010a4
Date: 2013-08-08 11:45 +0200
http://bitbucket.org/pypy/pypy/changeset/0c095b5010a4/

Log:    Remove the IndexError here

diff --git a/pypy/interpreter/argument.py b/pypy/interpreter/argument.py
--- a/pypy/interpreter/argument.py
+++ b/pypy/interpreter/argument.py
@@ -506,14 +506,15 @@
                     name = keywords[i]
                     if name is None:
                         # We'll assume it's unicode. Encode it.
-                        # Careful, I *think* it should not be possible to
-                        # get an IndexError here but you never know.
-                        try:
-                            if keyword_names_w is None:
-                                raise IndexError
-                            # note: negative-based indexing from the end
-                            w_name = keyword_names_w[i - len(keywords)]
-                        except IndexError:
+                        w_name = None
+                        if keyword_names_w is not None:
+                            # note: indexing from the end
+                            index = len(keyword_names_w) + (i - len(keywords))
+                            # Careful, I *think* it should not be possible to
+                            # get a negative index here but you never know
+                            if index >= 0:
+                                w_name = keyword_names_w[index]
+                        if w_name is None:
                             name = '?'
                         else:
                             w_enc = space.wrap(space.sys.defaultencoding)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to