Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r60993:170b1c1a475c
Date: 2013-02-08 15:01 -0800
http://bitbucket.org/pypy/pypy/changeset/170b1c1a475c/

Log:    hack around space.warn unicode input for now to fix translation

diff --git a/pypy/module/_io/interp_fileio.py b/pypy/module/_io/interp_fileio.py
--- a/pypy/module/_io/interp_fileio.py
+++ b/pypy/module/_io/interp_fileio.py
@@ -250,7 +250,13 @@
         if self.fd >= 0 and self.closefd:
             try:
                 r = space.unicode_w(space.repr(w_source))
-                space.warn(u"unclosed file %s" % r, space.w_ResourceWarning)
+                # TODO: space.warn is currently typed to str
+                #space.warn(u"unclosed file %s" % r, space.w_ResourceWarning)
+                msg = u"unclosed file %s" % r
+                space.appexec([space.wrap(msg), space.w_ResourceWarning],
+                              """(msg, warningcls):
+                import _warnings
+                _warnings.warn(msg, warningcls, stacklevel=2)""")
             except OperationError as e:
                 # Spurious errors can appear at shutdown
                 if e.match(space, space.w_Warning):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to