[pypy-commit] pypy default: a test and a fix

fijal noreply at buildbot.pypy.org
Tue Jan 17 20:46:31 CET 2012


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: 
Changeset: r51419:80570f9631d7
Date: 2012-01-17 21:29 +0200
http://bitbucket.org/pypy/pypy/changeset/80570f9631d7/

Log:	a test and a fix

diff --git a/pypy/tool/jitlogparser/parser.py b/pypy/tool/jitlogparser/parser.py
--- a/pypy/tool/jitlogparser/parser.py
+++ b/pypy/tool/jitlogparser/parser.py
@@ -140,13 +140,15 @@
     bytecode_name = None
     is_bytecode = True
     inline_level = None
+    has_dmp = False
 
     def parse_code_data(self, arg):
         m = re.search('<code object ([<>\w]+)[\.,] file \'(.+?)\'[\.,] line (\d+)> #(\d+) (\w+)',
                       arg)
         if m is None:
             # a non-code loop, like StrLiteralSearch or something
-            self.bytecode_name = arg
+            if arg:
+                self.bytecode_name = arg
         else:
             self.name, self.filename, lineno, bytecode_no, self.bytecode_name = m.groups()
             self.startlineno = int(lineno)
@@ -218,7 +220,7 @@
         self.inputargs = inputargs
         self.chunks = chunks
         for chunk in self.chunks:
-            if chunk.filename is not None:
+            if chunk.bytecode_name is not None:
                 self.startlineno = chunk.startlineno
                 self.filename = chunk.filename
                 self.name = chunk.name
diff --git a/pypy/tool/jitlogparser/test/test_parser.py b/pypy/tool/jitlogparser/test/test_parser.py
--- a/pypy/tool/jitlogparser/test/test_parser.py
+++ b/pypy/tool/jitlogparser/test/test_parser.py
@@ -283,3 +283,13 @@
     assert loops[-1].count == 1234
     assert loops[1].count == 123
     assert loops[2].count == 12
+
+def test_parse_nonpython():
+    loop = parse("""
+    []
+    debug_merge_point(0, 'random')
+    debug_merge_point(0, '<code object f. file 'x.py'. line 2> #15 COMPARE_OP')
+    """)
+    f = Function.from_operations(loop.operations, LoopStorage())
+    assert f.chunks[-1].filename == 'x.py'
+    assert f.filename is None


More information about the pypy-commit mailing list