[pypy-commit] pypy stm-gc: Improve the error message by displaying the "traceback"
arigo
noreply at buildbot.pypy.org
Sun Feb 19 20:11:04 CET 2012
Author: Armin Rigo <arigo at tunes.org>
Branch: stm-gc
Changeset: r52647:561cb54a9769
Date: 2012-02-19 18:53 +0100
http://bitbucket.org/pypy/pypy/changeset/561cb54a9769/
Log: Improve the error message by displaying the "traceback" that leads
to the malloc(gc) call.
diff --git a/pypy/rpython/memory/gctransform/framework.py b/pypy/rpython/memory/gctransform/framework.py
--- a/pypy/rpython/memory/gctransform/framework.py
+++ b/pypy/rpython/memory/gctransform/framework.py
@@ -643,8 +643,20 @@
func = getattr(graph, 'func', None)
if func and getattr(func, '_gc_no_collect_', False):
if self.collect_analyzer.analyze_direct_call(graph):
+ # 'no_collect' function can trigger collection
+ import cStringIO
+ err = cStringIO.StringIO()
+ prev = sys.stdout
+ try:
+ sys.stdout = err
+ ca = CollectAnalyzer(self.translator)
+ ca.verbose = True
+ ca.analyze_direct_call(graph) # print the "traceback" here
+ sys.stdout = prev
+ except:
+ sys.stdout = prev
raise Exception("'no_collect' function can trigger collection:"
- " %s" % func)
+ " %s\n%s" % (func, err.getvalue()))
if self.write_barrier_ptr:
self.clean_sets = (
More information about the pypy-commit
mailing list