Author: Armin Rigo <[email protected]>
Branch: release-2.2.x
Changeset: r67972:f262c7a6776c
Date: 2013-11-12 12:51 +0100
http://bitbucket.org/pypy/pypy/changeset/f262c7a6776c/

Log:    Found out that FormatError() is exposed via _rawffi. Would you
        believe.

diff --git a/pypy/module/posix/app_startfile.py 
b/pypy/module/posix/app_startfile.py
--- a/pypy/module/posix/app_startfile.py
+++ b/pypy/module/posix/app_startfile.py
@@ -40,6 +40,10 @@
         raise TypeError("argument 1 must be str or unicode")
     rc = int(w.cast("uintptr_t", rc))
     if rc <= 32:
-        # sorry, no way to get the error message in less than one page of code
         code = w.libK.GetLastError()
-        raise WindowsError(code, "Error %s" % code, filepath)
+        try:
+            import _rawffi
+            msg = _rawffi.FormatError(code)
+        except ImportError:
+            msg = 'Error %s' % code
+        raise WindowsError(code, msg, filepath)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to