Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r370:c39a3b9b0286 Date: 2012-06-15 19:46 +0200 http://bitbucket.org/cffi/cffi/changeset/c39a3b9b0286/
Log: Remove 'ffi.rawload(None).errno', which was a hack that made sense at the time where it was 'ffi.C.errno', but no longer really does now. Moreover, although errno is really coming from the C library, it's strange to have it appear in this library object because we never declared it. diff --git a/cffi/api.py b/cffi/api.py --- a/cffi/api.py +++ b/cffi/api.py @@ -222,9 +222,6 @@ # class FFILibrary(object): def __getattribute__(self, name): - if libname is None and name == 'errno': - return backend.get_errno() - # try: return function_cache[name] except KeyError: @@ -247,10 +244,6 @@ raise AttributeError(name) def __setattr__(self, name, value): - if libname is None and name == 'errno': - backend.set_errno(value) - return - # key = 'variable ' + name if key in ffi._parser._declarations: tp = ffi._parser._declarations[key] diff --git a/doc/source/index.rst b/doc/source/index.rst --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -495,9 +495,7 @@ ``errno``: the value of ``errno`` received from the most recent C call in this thread, and passed to the following C call, is available via -``ffi.dlopen(None).errno`` as a global variable of the C standard -library. It can also be accessed more directly via reads and writes of -``ffi.errno``. +reads and writes of ``ffi.errno``. ``ffi.buffer(pointer)``: return a read-write buffer object that references the raw C data pointed to by the given 'cdata'. The 'cdata' diff --git a/testing/test_ownlib.py b/testing/test_ownlib.py --- a/testing/test_ownlib.py +++ b/testing/test_ownlib.py @@ -34,10 +34,9 @@ int test_getting_errno(void); """) ownlib = ffi.dlopen(self.module) - C = ffi.dlopen(None) res = ownlib.test_getting_errno() assert res == -1 - assert C.errno == 123 + assert ffi.errno == 123 def test_setting_errno(self): if self.Backend is CTypesBackend and '__pypy__' in sys.modules: @@ -47,8 +46,7 @@ int test_setting_errno(void); """) ownlib = ffi.dlopen(self.module) - C = ffi.dlopen(None) - C.errno = 42 + ffi.errno = 42 res = ownlib.test_setting_errno() assert res == 42 - assert C.errno == 42 + assert ffi.errno == 42 _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit