1. Pypy
  2. Untitled project
  3. pypy


Armin Rigo  committed 2d41724

Copy the checkin message as comment to the newly introduced function.

  • Participants
  • Parent commits d4f1606
  • Branches default

Comments (0)

Files changed (1)

File lib-python/2.7/timeit.py

View file
  • Ignore whitespace
                 raise ValueError("setup is neither a string nor callable")
             self.src = src # Save for traceback display
             def make_inner():
+                # PyPy tweak: recompile the source code each time before
+                # calling inner(). There are situations like Issue #1776
+                # where PyPy tries to reuse the JIT code from before,
+                # but that's not going to work: the first thing the
+                # function does is the "-s" statement, which may declare
+                # new classes (here a namedtuple). We end up with
+                # bridges from the inner loop; more and more of them
+                # every time we call inner().
                 code = compile(src, dummy_src_name, "exec")
                 exec code in globals(), ns
                 return ns["inner"]