[pypy-commit] pypy py3k: s/func_code/__code__, and fix one import of StringIO

antocuni noreply at buildbot.pypy.org
Tue Feb 21 16:07:35 CET 2012


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k
Changeset: r52732:fa465e45bc43
Date: 2012-02-21 13:34 +0100
http://bitbucket.org/pypy/pypy/changeset/fa465e45bc43/

Log:	s/func_code/__code__, and fix one import of StringIO

diff --git a/pypy/module/_lsprof/test/test_cprofile.py b/pypy/module/_lsprof/test/test_cprofile.py
--- a/pypy/module/_lsprof/test/test_cprofile.py
+++ b/pypy/module/_lsprof/test/test_cprofile.py
@@ -107,8 +107,8 @@
         entries = {}
         for entry in stats:
             entries[entry.code] = entry
-        efoo = entries[foo.func_code]
-        ebar = entries[bar.func_code]
+        efoo = entries[foo.__code__]
+        ebar = entries[bar.__code__]
         assert 0.9 < efoo.totaltime < 2.9
         # --- cannot test .inlinetime, because it does not include
         # --- the time spent doing the call to time.time()
diff --git a/pypy/module/pypyjit/test/test_jit_hook.py b/pypy/module/pypyjit/test/test_jit_hook.py
--- a/pypy/module/pypyjit/test/test_jit_hook.py
+++ b/pypy/module/pypyjit/test/test_jit_hook.py
@@ -120,8 +120,8 @@
         int_add = elem[3][0]
         dmp = elem[3][1]
         assert isinstance(dmp, pypyjit.DebugMergePoint)
-        assert dmp.pycode is self.f.func_code
-        assert dmp.greenkey == (self.f.func_code, 0, False)
+        assert dmp.pycode is self.f.__code__
+        assert dmp.greenkey == (self.f.__code__, 0, False)
         assert dmp.call_depth == 0
         assert int_add.name == 'int_add'
         assert int_add.num == self.int_add_num
@@ -132,13 +132,14 @@
         assert len(all) == 2
 
     def test_on_compile_exception(self):
-        import pypyjit, sys, cStringIO
+        import pypyjit, sys
+        from io import StringIO
 
         def hook(*args):
             1/0
 
         pypyjit.set_compile_hook(hook)
-        s = cStringIO.StringIO()
+        s = StringIO()
         prev = sys.stderr
         sys.stderr = s
         try:


More information about the pypy-commit mailing list