[pypy-svn] jitviewer default: kill module_finder, it is no longer used here (but a copy is now present in the jitlogparser
antocuni
commits-noreply at bitbucket.org
Fri Feb 25 14:59:43 CET 2011
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch:
Changeset: r98:bee2d3ff0ba1
Date: 2011-02-25 14:52 +0100
http://bitbucket.org/pypy/jitviewer/changeset/bee2d3ff0ba1/
Log: kill module_finder, it is no longer used here (but a copy is now
present in the jitlogparser
diff --git a/_jitviewer/module_finder.py b/_jitviewer/module_finder.py
deleted file mode 100644
--- a/_jitviewer/module_finder.py
+++ /dev/null
@@ -1,25 +0,0 @@
-
-import os, sys, marshal, types, struct, imp
-
-def _all_codes_from(code):
- res = {}
- more = [code]
- while more:
- next = more.pop()
- res[next.co_firstlineno] = next
- more += [co for co in next.co_consts
- if isinstance(co, types.CodeType)]
- return res
-
-def gather_all_code_objs(fname):
- """ Gathers all code objects from a give fname and sorts them by
- starting lineno
- """
- fname = str(fname)
- if fname.endswith('.pyc'):
- code = compile(open(fname[:-1]).read(), fname, 'exec')
- elif fname.endswith('.py'):
- code = compile(open(fname).read(), fname, 'exec')
- else:
- raise Exception("Unknown file extension: %s" % fname)
- return _all_codes_from(code)
diff --git a/_jitviewer/test/test_module.py b/_jitviewer/test/test_module.py
deleted file mode 100644
--- a/_jitviewer/test/test_module.py
+++ /dev/null
@@ -1,21 +0,0 @@
-
-import py
-from _jitviewer.module_finder import gather_all_code_objs
-import re, sys
-
-def setup_module(mod):
- if sys.version_info[:2] != (2.6):
- py.test.skip("Specific python 2.6 tests")
-
-def test_gather_code_py():
- fname = re.__file__
- codes = gather_all_code_objs(fname)
- assert len(codes) == 21
- assert sorted(codes.keys()) == [102, 134, 139, 144, 153, 164, 169, 181, 188, 192, 197, 206, 229, 251, 266, 271, 277, 285, 293, 294, 308]
-
-def test_load_code():
- fname = re.__file__
- code = gather_all_code_objs(fname)[144]
- assert code.co_name == 'sub'
- assert code.co_filename == '/usr/lib/python2.6/re.py'
- assert code.co_firstlineno == 144
More information about the Pypy-commit
mailing list