[pypy-commit] pypy ffi-backend: revert the checkin that is missing a pretty crucial file
fijal
noreply at buildbot.pypy.org
Sun Jul 8 14:58:10 CEST 2012
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: ffi-backend
Changeset: r55995:842e37163ebb
Date: 2012-07-08 14:57 +0200
http://bitbucket.org/pypy/pypy/changeset/842e37163ebb/
Log: revert the checkin that is missing a pretty crucial file
diff --git a/pypy/module/_cffi_backend/__init__.py b/pypy/module/_cffi_backend/__init__.py
--- a/pypy/module/_cffi_backend/__init__.py
+++ b/pypy/module/_cffi_backend/__init__.py
@@ -30,7 +30,4 @@
'getcname': 'func.getcname',
'buffer': 'cbuffer.buffer',
-
- 'get_errno': 'cerrno.get_errno',
- 'set_errno': 'cerrno.set_errno',
}
diff --git a/pypy/module/_cffi_backend/ccallback.py b/pypy/module/_cffi_backend/ccallback.py
--- a/pypy/module/_cffi_backend/ccallback.py
+++ b/pypy/module/_cffi_backend/ccallback.py
@@ -9,7 +9,6 @@
from pypy.module._cffi_backend.cdataobj import W_CData, W_CDataApplevelOwning
from pypy.module._cffi_backend.ctypefunc import SIZE_OF_FFI_ARG
-from pypy.module._cffi_backend import cerrno
# ____________________________________________________________
@@ -109,7 +108,6 @@
ll_userdata - a special structure which holds necessary information
(what the real callback is for example), casted to VOIDP
"""
- cerrno.save_errno()
ll_res = rffi.cast(rffi.CCHARP, ll_res)
unique_id = rffi.cast(lltype.Signed, ll_userdata)
callback = global_callback_mapping.get(unique_id)
@@ -143,4 +141,3 @@
except OSError:
pass
callback.write_error_return_value(ll_res)
- cerrno.restore_errno()
diff --git a/pypy/module/_cffi_backend/ctypefunc.py b/pypy/module/_cffi_backend/ctypefunc.py
--- a/pypy/module/_cffi_backend/ctypefunc.py
+++ b/pypy/module/_cffi_backend/ctypefunc.py
@@ -13,7 +13,7 @@
from pypy.module._cffi_backend.ctypevoid import W_CTypeVoid
from pypy.module._cffi_backend.ctypestruct import W_CTypeStructOrUnion
from pypy.module._cffi_backend import ctypeprim, ctypestruct, ctypearray
-from pypy.module._cffi_backend import cdataobj, cerrno
+from pypy.module._cffi_backend import cdataobj
class W_CTypeFunc(W_CTypePtrBase):
@@ -129,12 +129,10 @@
argtype.convert_from_object(data, w_obj)
resultdata = rffi.ptradd(buffer, cif_descr.exchange_result)
- cerrno.restore_errno()
clibffi.c_ffi_call(cif_descr.cif,
rffi.cast(rffi.VOIDP, funcaddr),
resultdata,
buffer_array)
- cerrno.save_errno()
if isinstance(self.ctitem, W_CTypeVoid):
w_res = space.w_None
diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py b/pypy/module/_cffi_backend/test/_backend_test_c.py
--- a/pypy/module/_cffi_backend/test/_backend_test_c.py
+++ b/pypy/module/_cffi_backend/test/_backend_test_c.py
@@ -1378,22 +1378,3 @@
BUChar = new_primitive_type("unsigned char")
BArray = new_array_type(new_pointer_type(BUChar), 123)
assert getcname(BArray, "<-->") == "unsigned char<-->[123]"
-
-def test_errno():
- BVoid = new_void_type()
- BFunc5 = new_function_type((), BVoid)
- f = cast(BFunc5, _testfunc(5))
- set_errno(50)
- f()
- assert get_errno() == 65
- f(); f()
- assert get_errno() == 95
- #
- def cb():
- e = get_errno()
- set_errno(e - 6)
- f = callback(BFunc5, cb)
- f()
- assert get_errno() == 89
- f(); f()
- assert get_errno() == 77
diff --git a/pypy/module/_cffi_backend/test/_test_lib.c b/pypy/module/_cffi_backend/test/_test_lib.c
--- a/pypy/module/_cffi_backend/test/_test_lib.c
+++ b/pypy/module/_cffi_backend/test/_test_lib.c
@@ -1,6 +1,5 @@
#include <stdio.h>
#include <stdarg.h>
-#include <errno.h>
static char _testfunc0(char a, char b)
{
@@ -24,7 +23,6 @@
}
static void _testfunc5(void)
{
- errno = errno + 15;
}
static int *_testfunc6(int *x)
{
diff --git a/pypy/rpython/lltypesystem/ll2ctypes.py b/pypy/rpython/lltypesystem/ll2ctypes.py
--- a/pypy/rpython/lltypesystem/ll2ctypes.py
+++ b/pypy/rpython/lltypesystem/ll2ctypes.py
@@ -331,12 +331,7 @@
restype = None
else:
restype = get_ctypes_type(T.TO.RESULT)
- try:
- kwds = {'use_errno': True}
- return ctypes.CFUNCTYPE(restype, *argtypes, **kwds)
- except TypeError:
- # unexpected 'use_errno' argument, old ctypes version
- return ctypes.CFUNCTYPE(restype, *argtypes)
+ return ctypes.CFUNCTYPE(restype, *argtypes)
elif isinstance(T.TO, lltype.OpaqueType):
return ctypes.c_void_p
else:
More information about the pypy-commit
mailing list