[pypy-commit] pypy default: rename this function so it doesn't look like something we copied out of the CPython C-API
alex_gaynor
noreply at buildbot.pypy.org
Wed Jul 27 19:45:49 CEST 2011
Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch:
Changeset: r46025:042386e45958
Date: 2011-07-27 10:46 -0700
http://bitbucket.org/pypy/pypy/changeset/042386e45958/
Log: rename this function so it doesn't look like something we copied out
of the CPython C-API
diff --git a/pypy/objspace/std/bytearrayobject.py b/pypy/objspace/std/bytearrayobject.py
--- a/pypy/objspace/std/bytearrayobject.py
+++ b/pypy/objspace/std/bytearrayobject.py
@@ -282,8 +282,8 @@
return space.wrap(''.join(w_bytearray.data))
def _convert_idx_params(space, w_self, w_start, w_stop):
- start = slicetype._Eval_SliceIndex(space, w_start)
- stop = slicetype._Eval_SliceIndex(space, w_stop)
+ start = slicetype.eval_slice_index(space, w_start)
+ stop = slicetype.eval_slice_index(space, w_stop)
length = len(w_self.data)
if start < 0:
start += length
diff --git a/pypy/objspace/std/sliceobject.py b/pypy/objspace/std/sliceobject.py
--- a/pypy/objspace/std/sliceobject.py
+++ b/pypy/objspace/std/sliceobject.py
@@ -4,7 +4,7 @@
from pypy.interpreter import gateway
from pypy.objspace.std.model import registerimplementation, W_Object
from pypy.objspace.std.register_all import register_all
-from pypy.objspace.std.slicetype import _Eval_SliceIndex
+from pypy.objspace.std.slicetype import eval_slice_index
class W_SliceObject(W_Object):
from pypy.objspace.std.slicetype import slice_typedef as typedef
@@ -25,7 +25,7 @@
if space.is_w(w_slice.w_step, space.w_None):
step = 1
else:
- step = _Eval_SliceIndex(space, w_slice.w_step)
+ step = eval_slice_index(space, w_slice.w_step)
if step == 0:
raise OperationError(space.w_ValueError,
space.wrap("slice step cannot be zero"))
@@ -35,7 +35,7 @@
else:
start = 0
else:
- start = _Eval_SliceIndex(space, w_slice.w_start)
+ start = eval_slice_index(space, w_slice.w_start)
if start < 0:
start += length
if start < 0:
@@ -54,7 +54,7 @@
else:
stop = length
else:
- stop = _Eval_SliceIndex(space, w_slice.w_stop)
+ stop = eval_slice_index(space, w_slice.w_stop)
if stop < 0:
stop += length
if stop < 0:
diff --git a/pypy/objspace/std/slicetype.py b/pypy/objspace/std/slicetype.py
--- a/pypy/objspace/std/slicetype.py
+++ b/pypy/objspace/std/slicetype.py
@@ -14,7 +14,7 @@
' normal slices.')
# utility functions
-def _Eval_SliceIndex(space, w_int):
+def eval_slice_index(space, w_int):
try:
return space.getindex_w(w_int, None) # clamp if long integer too large
except OperationError, err:
@@ -25,7 +25,7 @@
"None or have an __index__ method"))
def adapt_lower_bound(space, size, w_index):
- index = _Eval_SliceIndex(space, w_index)
+ index = eval_slice_index(space, w_index)
if index < 0:
index = index + size
if index < 0:
@@ -34,7 +34,7 @@
return index
def adapt_bound(space, size, w_index):
- index = _Eval_SliceIndex(space, w_index)
+ index = eval_slice_index(space, w_index)
if index < 0:
index = index + size
if index < 0:
diff --git a/pypy/objspace/std/tupleobject.py b/pypy/objspace/std/tupleobject.py
--- a/pypy/objspace/std/tupleobject.py
+++ b/pypy/objspace/std/tupleobject.py
@@ -172,8 +172,8 @@
return space.wrap(count)
def tuple_index__Tuple_ANY_ANY_ANY(space, w_tuple, w_obj, w_start, w_stop):
- start = slicetype._Eval_SliceIndex(space, w_start)
- stop = slicetype._Eval_SliceIndex(space, w_stop)
+ start = slicetype.eval_slice_index(space, w_start)
+ stop = slicetype.eval_slice_index(space, w_stop)
length = len(w_tuple.wrappeditems)
if start < 0:
start += length
More information about the pypy-commit
mailing list