Author: Armin Rigo <[email protected]>
Branch:
Changeset: r58713:05560d7ead06
Date: 2012-11-04 11:32 +0100
http://bitbucket.org/pypy/pypy/changeset/05560d7ead06/
Log: GetLastError/SetLastError support
diff --git a/pypy/module/_cffi_backend/cerrno.py
b/pypy/module/_cffi_backend/cerrno.py
--- a/pypy/module/_cffi_backend/cerrno.py
+++ b/pypy/module/_cffi_backend/cerrno.py
@@ -1,9 +1,15 @@
+import sys
from pypy.rlib import rposix
from pypy.interpreter.executioncontext import ExecutionContext
from pypy.interpreter.gateway import unwrap_spec
+WIN32 = sys.platform == 'win32'
+if WIN32:
+ from pypy.rlib import rwin32
+
ExecutionContext._cffi_saved_errno = 0
+ExecutionContext._cffi_saved_LastError = 0
def get_errno_container(space):
@@ -13,10 +19,14 @@
def restore_errno_from(ec):
+ if WIN32:
+ rwin32.SetLastError(ec._cffi_saved_LastError)
rposix.set_errno(ec._cffi_saved_errno)
def save_errno_into(ec, errno):
ec._cffi_saved_errno = errno
+ if WIN32:
+ ec._cffi_saved_LastError = rwin32.GetLastError()
def get_errno(space):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit