Author: Armin Rigo <ar...@tunes.org> Branch: ffi-backend Changeset: r56011:6504ddebfafb Date: 2012-07-10 13:00 +0200 http://bitbucket.org/pypy/pypy/changeset/6504ddebfafb/
Log: Oups, forgot this file. diff --git a/pypy/module/_cffi_backend/cerrno.py b/pypy/module/_cffi_backend/cerrno.py new file mode 100644 --- /dev/null +++ b/pypy/module/_cffi_backend/cerrno.py @@ -0,0 +1,24 @@ +from pypy.rlib import rposix +from pypy.interpreter.gateway import unwrap_spec + + +class ErrnoContainer(object): + # XXXXXXXXXXXXXX! thread-safety + errno = 0 + +errno_container = ErrnoContainer() + + +def restore_errno(): + rposix.set_errno(errno_container.errno) + +def save_errno(): + errno_container.errno = rposix.get_errno() + + +def get_errno(space): + return space.wrap(errno_container.errno) + +@unwrap_spec(errno=int) +def set_errno(space, errno): + errno_container.errno = errno _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit