Author: Antonio Cuni <[email protected]>
Branch: 
Changeset: r53723:a8796e060270
Date: 2012-03-16 15:47 +0100
http://bitbucket.org/pypy/pypy/changeset/a8796e060270/

Log:    fix a8f6a9147d27: sometimes we pass an explicit filename but we
        still want to populate the linecache; this is needed e.g. to display
        tracebacks of failing applevel tests. Fix it by always populating
        the cache unless filename exists, in that case we assume that the
        correct source code is on disk

diff --git a/pypy/interpreter/gateway.py b/pypy/interpreter/gateway.py
--- a/pypy/interpreter/gateway.py
+++ b/pypy/interpreter/gateway.py
@@ -907,6 +907,7 @@
         if filename is None:
             f = sys._getframe(1)
             filename = '<%s:%d>' % (f.f_code.co_filename, f.f_lineno)
+        if not os.path.exists(filename):
             # make source code available for tracebacks
             lines = [x + "\n" for x in source.split("\n")]
             py.std.linecache.cache[filename] = (1, None, lines, filename)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to