Commits

Armin Rigo committed f262c7a

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

  • Participants
  • Parent commits 7adf80f
  • Branches release-2.2.x

Comments (0)

Files changed (1)

pypy/module/posix/app_startfile.py

         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)