[pypy-svn] r78153 - pypy/branch/fast-forward/pypy/module/select
afa at codespeak.net
afa at codespeak.net
Thu Oct 21 08:59:15 CEST 2010
Author: afa
Date: Thu Oct 21 08:59:13 2010
New Revision: 78153
Modified:
pypy/branch/fast-forward/pypy/module/select/interp_select.py
Log:
Add Poll.modify()
Modified: pypy/branch/fast-forward/pypy/module/select/interp_select.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/select/interp_select.py (original)
+++ pypy/branch/fast-forward/pypy/module/select/interp_select.py Thu Oct 21 08:59:13 2010
@@ -2,8 +2,10 @@
from pypy.interpreter.typedef import TypeDef
from pypy.interpreter.baseobjspace import Wrappable
from pypy.interpreter.gateway import W_Root, ObjSpace, interp2app
-from pypy.interpreter.error import OperationError, operationerrfmt
+from pypy.interpreter.error import (
+ OperationError, operationerrfmt, wrap_oserror)
from pypy.rlib import rpoll
+import errno
defaultevents = rpoll.POLLIN | rpoll.POLLOUT | rpoll.POLLPRI
@@ -41,6 +43,14 @@
self.fddict[fd] = events
register.unwrap_spec = ['self', ObjSpace, W_Root, int]
+ def modify(self, space, w_fd, events):
+ fd = as_fd_w(space, w_fd)
+ if fd not in self.fddict:
+ raise wrap_oserror(space, OSError(errno.ENOENT, "poll.modify"),
+ exception_name='w_IOError')
+ self.fddict[fd] = events
+ modify.unwrap_spec = ['self', ObjSpace, W_Root, int]
+
def unregister(self, space, w_fd):
fd = as_fd_w(space, w_fd)
try:
@@ -81,7 +91,7 @@
poll.unwrap_spec = ['self', ObjSpace, W_Root]
pollmethods = {}
-for methodname in 'register unregister poll'.split():
+for methodname in 'register modify unregister poll'.split():
method = getattr(Poll, methodname)
assert hasattr(method,'unwrap_spec'), methodname
assert method.im_func.func_code.co_argcount == len(method.unwrap_spec), methodname
More information about the Pypy-commit
mailing list