Author: Antonio Cuni <[email protected]>
Branch: resource_warning
Changeset: r83559:67909a688ba0
Date: 2016-04-07 10:37 +0200
http://bitbucket.org/pypy/pypy/changeset/67909a688ba0/

Log:    (antocuni, florinpapa): fix the test, it was because we returned
        None from space.format_traceback and the following appexec in
        space.resource_warning got confused

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1751,7 +1751,7 @@
         """)
 
     def format_traceback(self):
-        self.appexec([],
+        return self.appexec([],
                      """():
             import traceback
             return "".join(traceback.format_stack())
diff --git a/pypy/module/_file/interp_file.py b/pypy/module/_file/interp_file.py
--- a/pypy/module/_file/interp_file.py
+++ b/pypy/module/_file/interp_file.py
@@ -60,7 +60,7 @@
         if self.space.sys.resource_warning_enabled:
             w_repr = self.space.repr(self)
             str_repr = self.space.str_w(w_repr)
-            w_msg = self.space.wrap("WARNING: unclosed file:" + str_repr)
+            w_msg = self.space.wrap("WARNING: unclosed file: " + str_repr)
             self.space.resource_warning(w_msg, self.w_tb)
         #
         try:
diff --git a/pypy/module/_file/test/test_file.py 
b/pypy/module/_file/test/test_file.py
--- a/pypy/module/_file/test/test_file.py
+++ b/pypy/module/_file/test/test_file.py
@@ -275,12 +275,6 @@
             assert fn() == ""
             sys.pypy_set_resource_warning(True)
             msg = fn()
-
-            #f1 = open("/tmp/test", "w+")
-            #import pdb; pdb.set_trace()
-            print msg
-            #close(f1)
-
             assert msg.startswith("WARNING: unclosed file: <open file ")
             assert "Created at (most recent call last):" in msg
         finally:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to