[pypy-svn] r70749 - in pypy/branch/c-traceback/pypy/translator/c: . test
arigo at codespeak.net
arigo at codespeak.net
Thu Jan 21 15:49:37 CET 2010
Author: arigo
Date: Thu Jan 21 15:49:37 2010
New Revision: 70749
Modified:
pypy/branch/c-traceback/pypy/translator/c/funcgen.py
pypy/branch/c-traceback/pypy/translator/c/test/test_standalone.py
Log:
Don't print the prefix 'pypy_g_'.
Modified: pypy/branch/c-traceback/pypy/translator/c/funcgen.py
==============================================================================
--- pypy/branch/c-traceback/pypy/translator/c/funcgen.py (original)
+++ pypy/branch/c-traceback/pypy/translator/c/funcgen.py Thu Jan 21 15:49:37 2010
@@ -817,10 +817,18 @@
self.expr(op.args[1]),
self.expr(op.args[2]))
+ def getdebugfunctionname(self):
+ name = self.functionname
+ if not name:
+ return "?"
+ if name.startswith('pypy_g_'):
+ name = name[7:]
+ return name
+
def OP_DEBUG_RECORD_TRACEBACK(self, op):
#if self.functionname is None, we print "?" as the argument */
return 'PYPY_DEBUG_RECORD_TRACEBACK("%s");' % (
- self.functionname or "?",)
+ self.getdebugfunctionname(),)
def OP_DEBUG_CATCH_EXCEPTION(self, op):
gottype = self.expr(op.args[0])
@@ -828,7 +836,7 @@
for c_limited_type in op.args[1:]:
exprs.append('%s == %s' % (gottype, self.expr(c_limited_type)))
return 'PYPY_DEBUG_CATCH_EXCEPTION("%s", %s, %s);' % (
- self.functionname or "?", gottype, ' || '.join(exprs))
+ self.getdebugfunctionname(), gottype, ' || '.join(exprs))
assert not USESLOTS or '__dict__' not in dir(FunctionCodeGenerator)
Modified: pypy/branch/c-traceback/pypy/translator/c/test/test_standalone.py
==============================================================================
--- pypy/branch/c-traceback/pypy/translator/c/test/test_standalone.py (original)
+++ pypy/branch/c-traceback/pypy/translator/c/test/test_standalone.py Thu Jan 21 15:49:37 2010
@@ -399,8 +399,8 @@
assert len(lines) >= 4
l0, l1, l2 = lines[-4:-1]
assert l0 == 'RPython traceback:'
- assert re.match(r' File "\w+.c", line \d+, in pypy_g_entry_point', l1)
- assert re.match(r' File "\w+.c", line \d+, in pypy_g_g', l2)
+ assert re.match(r' File "\w+.c", line \d+, in entry_point', l1)
+ assert re.match(r' File "\w+.c", line \d+, in g', l2)
#
out2, err2 = cbuilder.cmdexec("x", expect_crash=True)
assert out2.strip() == ''
@@ -408,8 +408,8 @@
assert lines2[-1] == 'Fatal RPython error: KeyError'
l0, l1, l2 = lines2[-4:-1]
assert l0 == 'RPython traceback:'
- assert re.match(r' File "\w+.c", line \d+, in pypy_g_entry_point', l1)
- assert re.match(r' File "\w+.c", line \d+, in pypy_g_g', l2)
+ assert re.match(r' File "\w+.c", line \d+, in entry_point', l1)
+ assert re.match(r' File "\w+.c", line \d+, in g', l2)
assert lines2[-2] != lines[-2] # different line number
assert lines2[-3] == lines[-3] # same line number
@@ -436,9 +436,9 @@
assert len(lines) >= 5
l0, l1, l2, l3 = lines[-5:-1]
assert l0 == 'RPython traceback:'
- assert re.match(r' File "\w+.c", line \d+, in pypy_g_entry_point', l1)
- assert re.match(r' File "\w+.c", line \d+, in pypy_g_h', l2)
- assert re.match(r' File "\w+.c", line \d+, in pypy_g_g', l3)
+ assert re.match(r' File "\w+.c", line \d+, in entry_point', l1)
+ assert re.match(r' File "\w+.c", line \d+, in h', l2)
+ assert re.match(r' File "\w+.c", line \d+, in g', l3)
def test_fatal_error_finally_2(self):
# a try:finally: in which we raise and catch another exception
@@ -472,9 +472,9 @@
assert len(lines) >= 5
l0, l1, l2, l3 = lines[-5:-1]
assert l0 == 'RPython traceback:'
- assert re.match(r' File "\w+.c", line \d+, in pypy_g_entry_point', l1)
- assert re.match(r' File "\w+.c", line \d+, in pypy_g_h', l2)
- assert re.match(r' File "\w+.c", line \d+, in pypy_g_g', l3)
+ assert re.match(r' File "\w+.c", line \d+, in entry_point', l1)
+ assert re.match(r' File "\w+.c", line \d+, in h', l2)
+ assert re.match(r' File "\w+.c", line \d+, in g', l3)
def test_fatal_error_finally_3(self):
py.test.skip("not implemented: "
@@ -507,9 +507,9 @@
assert len(lines) >= 5
l0, l1, l2, l3 = lines[-5:-1]
assert l0 == 'RPython traceback:'
- assert re.match(r' File "\w+.c", line \d+, in pypy_g_entry_point', l1)
- assert re.match(r' File "\w+.c", line \d+, in pypy_g_h', l2)
- assert re.match(r' File "\w+.c", line \d+, in pypy_g_raiseme', l3)
+ assert re.match(r' File "\w+.c", line \d+, in entry_point', l1)
+ assert re.match(r' File "\w+.c", line \d+, in h', l2)
+ assert re.match(r' File "\w+.c", line \d+, in raiseme', l3)
def test_assertion_error(self):
def g(x):
@@ -530,8 +530,8 @@
assert len(lines) >= 4
l0, l1, l2 = lines[-4:-1]
assert l0 == 'RPython traceback:'
- assert re.match(r' File "\w+.c", line \d+, in pypy_g_f', l1)
- assert re.match(r' File "\w+.c", line \d+, in pypy_g_g', l2)
+ assert re.match(r' File "\w+.c", line \d+, in f', l1)
+ assert re.match(r' File "\w+.c", line \d+, in g', l2)
# The traceback stops at f() because it's the first function that
# captures the AssertionError, which makes the program abort.
@@ -555,8 +555,8 @@
assert len(lines) >= 4
l0, l1, l2 = lines[-4:-1]
assert l0 == 'RPython traceback:'
- assert re.match(r' File "\w+.c", line \d+, in pypy_g_f', l1)
- assert re.match(r' File "\w+.c", line \d+, in pypy_g_g', l2)
+ assert re.match(r' File "\w+.c", line \d+, in f', l1)
+ assert re.match(r' File "\w+.c", line \d+, in g', l2)
# The traceback stops at f() because it's the first function that
# captures the AssertionError, which makes the program abort.
More information about the Pypy-commit
mailing list