[pypy-commit] pypy remove-list-smm-2: Inline and kill one-line function get_list_index().

Manuel Jacob noreply at buildbot.pypy.org
Sun May 19 13:56:40 CEST 2013


Author: Manuel Jacob
Branch: remove-list-smm-2
Changeset: r64318:fe09a3a46053
Date: 2013-05-18 14:04 +0200
http://bitbucket.org/pypy/pypy/changeset/fe09a3a46053/

Log:	Inline and kill one-line function get_list_index().

diff --git a/pypy/objspace/std/listobject.py b/pypy/objspace/std/listobject.py
--- a/pypy/objspace/std/listobject.py
+++ b/pypy/objspace/std/listobject.py
@@ -480,7 +480,8 @@
             return self.getslice(start, stop, step, slicelength)
 
         try:
-            return self.getitem(get_list_index(space, w_index))
+            index = space.getindex_w(w_index, space.w_IndexError, "list index")
+            return self.getitem(index)
         except IndexError:
             raise OperationError(space.w_IndexError,
                                  space.wrap("list index out of range"))
@@ -506,7 +507,7 @@
                 self.setslice(start, step, slicelength, w_other)
             return
 
-        idx = get_list_index(space, w_index)
+        idx = space.getindex_w(w_index, space.w_IndexError, "list index")
         try:
             self.setitem(idx, w_any)
         except IndexError:
@@ -530,7 +531,7 @@
             self.deleteslice(start, step, slicelength)
             return
 
-        idx = get_list_index(space, w_idx)
+        idx = space.getindex_w(w_idx, space.w_IndexError, "list index")
         if idx < 0:
             idx += self.length()
         try:
@@ -1682,11 +1683,6 @@
         assert isinstance(b, KeyContainer)
         return CustomCompareSort.lt(self, a.w_key, b.w_key)
 
-# ____________________________________________________________
-
-def get_list_index(space, w_index):
-    return space.getindex_w(w_index, space.w_IndexError, "list index")
-
 
 W_ListObject.typedef = StdTypeDef("list",
     __doc__ = """list() -> new list


More information about the pypy-commit mailing list