Author: Armin Rigo <[email protected]>
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 = (
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit