[pypy-commit] pypy release-2.2.x: Found out that FormatError() is exposed via _rawffi. Would you believe.
arigo
noreply at buildbot.pypy.org
Tue Nov 12 12:51:49 CET 2013
Author: Armin Rigo <arigo at tunes.org>
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)
More information about the pypy-commit
mailing list