Author: Alex Gaynor <[email protected]>
Branch:
Changeset: r82965:f20ce35486b5
Date: 2016-03-11 07:39 -0500
http://bitbucket.org/pypy/pypy/changeset/f20ce35486b5/
Log: split the endswith([tuple]) path into its own function so the JIT
can look inside
diff --git a/pypy/objspace/std/stringmethods.py
b/pypy/objspace/std/stringmethods.py
--- a/pypy/objspace/std/stringmethods.py
+++ b/pypy/objspace/std/stringmethods.py
@@ -629,13 +629,16 @@
def descr_endswith(self, space, w_suffix, w_start=None, w_end=None):
(value, start, end) = self._convert_idx_params(space, w_start, w_end)
if space.isinstance_w(w_suffix, space.w_tuple):
- for w_suffix in space.fixedview(w_suffix):
- if self._endswith(space, value, w_suffix, start, end):
- return space.w_True
- return space.w_False
+ return self._endswith_tuple(space, value, w_suffix, start, end)
return space.newbool(self._endswith(space, value, w_suffix, start,
end))
+ def _endswith_tuple(self, space, value, w_suffix, start, end):
+ for w_suffix in space.fixedview(w_suffix):
+ if self._endswith(space, value, w_suffix, start, end):
+ return space.w_True
+ return space.w_False
+
def _endswith(self, space, value, w_prefix, start, end):
prefix = self._op_val(space, w_prefix)
if start > len(value):
@@ -795,5 +798,3 @@
def _get_buffer(space, w_obj):
return space.buffer_w(w_obj, space.BUF_SIMPLE)
-
-
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit