[pypy-svn] pypy improve-unwrap_spec: update modules rctime, sys
amauryfa
commits-noreply at bitbucket.org
Wed Feb 16 19:20:18 CET 2011
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: improve-unwrap_spec
Changeset: r42083:4d86f5056570
Date: 2011-02-16 18:22 +0100
http://bitbucket.org/pypy/pypy/changeset/4d86f5056570/
Log: update modules rctime, sys
diff --git a/pypy/module/sys/vm.py b/pypy/module/sys/vm.py
--- a/pypy/module/sys/vm.py
+++ b/pypy/module/sys/vm.py
@@ -2,7 +2,7 @@
Implementation of interpreter-level 'sys' routines.
"""
from pypy.interpreter.error import OperationError
-from pypy.interpreter.gateway import ObjSpace, NoneNotWrapped
+from pypy.interpreter.gateway import unwrap_spec, NoneNotWrapped
from pypy.rlib.runicode import MAXUNICODE
from pypy.rlib import jit
import sys
@@ -64,11 +64,11 @@
"""
return space.wrap(space.sys.recursionlimit)
+ at unwrap_spec(interval=int)
def setcheckinterval(space, interval):
"""Tell the Python interpreter to check for asynchronous events every
n instructions. This also affects how often thread switches occur."""
space.actionflag.setcheckinterval(interval)
-setcheckinterval.unwrap_spec = [ObjSpace, int]
def getcheckinterval(space):
"""Return the current check interval; see setcheckinterval()."""
diff --git a/pypy/module/sys/state.py b/pypy/module/sys/state.py
--- a/pypy/module/sys/state.py
+++ b/pypy/module/sys/state.py
@@ -3,7 +3,7 @@
"""
import pypy
from pypy.interpreter.error import OperationError
-from pypy.interpreter.gateway import ObjSpace
+from pypy.interpreter.gateway import unwrap_spec
import sys, os, stat, errno
@@ -64,6 +64,7 @@
#
return importlist
+ at unwrap_spec(srcdir=str)
def pypy_initial_path(space, srcdir):
try:
path = getinitialpath(srcdir)
@@ -76,8 +77,6 @@
space.wrap(srcdir))
return space.newlist([space.wrap(p) for p in path])
-pypy_initial_path.unwrap_spec = [ObjSpace, str]
-
def get(space):
return space.fromcache(State)
diff --git a/pypy/module/rctime/interp_time.py b/pypy/module/rctime/interp_time.py
--- a/pypy/module/rctime/interp_time.py
+++ b/pypy/module/rctime/interp_time.py
@@ -1,7 +1,7 @@
from pypy.rpython.tool import rffi_platform as platform
from pypy.rpython.lltypesystem import rffi
from pypy.interpreter.error import OperationError, operationerrfmt
-from pypy.interpreter.baseobjspace import W_Root, ObjSpace
+from pypy.interpreter.gateway import unwrap_spec
from pypy.rpython.lltypesystem import lltype
from pypy.rlib.rarithmetic import ovfcheck_float_to_int
from pypy.rlib import rposix
@@ -244,6 +244,7 @@
return os.strerror(errno)
if sys.platform != 'win32':
+ @unwrap_spec(secs=float)
def sleep(space, secs):
pytime.sleep(secs)
else:
@@ -263,6 +264,7 @@
pytime.sleep(0.001)
raise wrap_oserror(space,
OSError(EINTR, "sleep() interrupted"))
+ @unwrap_spec(secs=float)
def sleep(space, secs):
# as decreed by Guido, only the main thread can be
# interrupted.
@@ -273,7 +275,6 @@
_simple_sleep(space, MAX, interruptible)
secs -= MAX
_simple_sleep(space, secs, interruptible)
-sleep.unwrap_spec = [ObjSpace, float]
def _get_module_object(space, obj_name):
w_module = space.getbuiltinmodule('time')
@@ -429,7 +430,6 @@
space.wrap("unconvertible time"))
return space.wrap(rffi.charp2str(p)[:-1]) # get rid of new line
-ctime.unwrap_spec = [ObjSpace, W_Root]
# by now w_tup is an optional argument (and not *args)
# because of the ext. compiler bugs in handling such arguments (*args, **kwds)
@@ -446,7 +446,6 @@
space.wrap("unconvertible time"))
return space.wrap(rffi.charp2str(p)[:-1]) # get rid of new line
-asctime.unwrap_spec = [ObjSpace, W_Root]
def gmtime(space, w_seconds=None):
"""gmtime([seconds]) -> (tm_year, tm_mon, tm_day, tm_hour, tm_min,
@@ -467,7 +466,6 @@
if not p:
raise OperationError(space.w_ValueError, space.wrap(_get_error_msg()))
return _tm_to_tuple(space, p)
-gmtime.unwrap_spec = [ObjSpace, W_Root]
def localtime(space, w_seconds=None):
"""localtime([seconds]) -> (tm_year, tm_mon, tm_day, tm_hour, tm_min,
@@ -485,7 +483,6 @@
if not p:
raise OperationError(space.w_ValueError, space.wrap(_get_error_msg()))
return _tm_to_tuple(space, p)
-localtime.unwrap_spec = [ObjSpace, W_Root]
def mktime(space, w_tup):
"""mktime(tuple) -> floating point number
@@ -499,7 +496,6 @@
space.wrap("mktime argument out of range"))
return space.wrap(float(tt))
-mktime.unwrap_spec = [ObjSpace, W_Root]
if _POSIX:
def tzset(space):
@@ -519,8 +515,8 @@
# reset timezone, altzone, daylight and tzname
_init_timezone(space)
- tzset.unwrap_spec = [ObjSpace]
+ at unwrap_spec(format=str)
def strftime(space, format, w_tup=None):
"""strftime(format[, tuple]) -> string
@@ -586,4 +582,3 @@
finally:
lltype.free(outbuf, flavor='raw')
i += i
-strftime.unwrap_spec = [ObjSpace, str, W_Root]
More information about the Pypy-commit
mailing list