[pypy-commit] pypy unroll-if-alt: revert this; the implicit specialization of methods conflicts with mine
gutworth
noreply at buildbot.pypy.org
Mon Aug 1 17:08:17 CEST 2011
Author: Benjamin Peterson <benjamin at python.org>
Branch: unroll-if-alt
Changeset: r46155:0d17eee15160
Date: 2011-08-01 10:08 -0500
http://bitbucket.org/pypy/pypy/changeset/0d17eee15160/
Log: revert this; the implicit specialization of methods conflicts with
mine
diff --git a/pypy/objspace/std/newformat.py b/pypy/objspace/std/newformat.py
--- a/pypy/objspace/std/newformat.py
+++ b/pypy/objspace/std/newformat.py
@@ -55,7 +55,6 @@
self.auto_numbering_state = ANS_INIT
return self._build_string(0, len(self.template), 2)
- @jit.unroll_if(lambda self, start, end, level: jit.isconstant(self.template))
def _build_string(self, start, end, level):
space = self.space
if self.is_unicode:
@@ -67,6 +66,12 @@
space.wrap("Recursion depth exceeded"))
level -= 1
s = self.template
+ if jit.isconstant(s):
+ return self._do_build_string_unroll(start, end, level, out, s)
+ else:
+ return self._do_build_string(start, end, level, out, s)
+
+ def _do_build_string(self, start, end, level, out, s):
space = self.space
last_literal = i = start
while i < end:
@@ -118,6 +123,11 @@
out.append_slice(s, last_literal, end)
return out.build()
+ f = sourcetools.func_with_new_name(_do_build_string,
+ "_do_build_string_unroll")
+ _do_build_string_unroll = jit.unroll_safe(f)
+ del f
+
def _parse_field(self, start, end):
s = self.template
# Find ":" or "!"
More information about the pypy-commit
mailing list