[pypy-commit] pypy default: issue1242 resolved
arigo
noreply at buildbot.pypy.org
Mon Sep 3 19:51:24 CEST 2012
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r57106:2071a44dfde1
Date: 2012-09-03 19:51 +0200
http://bitbucket.org/pypy/pypy/changeset/2071a44dfde1/
Log: issue1242 resolved
Fix for the ctypes "use_last_error=True" on non-Windows platforms.
diff --git a/pypy/module/_rawffi/__init__.py b/pypy/module/_rawffi/__init__.py
--- a/pypy/module/_rawffi/__init__.py
+++ b/pypy/module/_rawffi/__init__.py
@@ -30,13 +30,11 @@
'get_libc' : 'interp_rawffi.get_libc',
'get_errno' : 'interp_rawffi.get_errno',
'set_errno' : 'interp_rawffi.set_errno',
+ 'get_last_error' : 'interp_rawffi.get_last_error',
+ 'set_last_error' : 'interp_rawffi.set_last_error',
'SegfaultException' : 'space.new_exception_class("_rawffi.SegfaultException")',
}
- if sys.platform == 'win32':
- interpleveldefs['get_last_error'] = 'interp_rawffi.get_last_error'
- interpleveldefs['set_last_error'] = 'interp_rawffi.set_last_error'
-
appleveldefs = {
}
diff --git a/pypy/module/_rawffi/interp_rawffi.py b/pypy/module/_rawffi/interp_rawffi.py
--- a/pypy/module/_rawffi/interp_rawffi.py
+++ b/pypy/module/_rawffi/interp_rawffi.py
@@ -539,11 +539,19 @@
def set_errno(space, w_errno):
rposix.set_errno(space.int_w(w_errno))
-def get_last_error(space):
- from pypy.rlib.rwin32 import GetLastError
- return space.wrap(GetLastError())
-
- at unwrap_spec(error=int)
-def set_last_error(space, error):
- from pypy.rlib.rwin32 import SetLastError
- SetLastError(error)
+if sys.platform == 'win32':
+ def get_last_error(space):
+ from pypy.rlib.rwin32 import GetLastError
+ return space.wrap(GetLastError())
+ @unwrap_spec(error=int)
+ def set_last_error(space, error):
+ from pypy.rlib.rwin32 import SetLastError
+ SetLastError(error)
+else:
+ # always have at least a dummy version of these functions
+ # (https://bugs.pypy.org/issue1242)
+ def get_last_error(space):
+ return space.wrap(0)
+ @unwrap_spec(error=int)
+ def set_last_error(space, error):
+ pass
More information about the pypy-commit
mailing list