Author: Alex Gaynor <[email protected]>
Branch: dynamic-specialized-tuple
Changeset: r53564:9f01756bfee4
Date: 2012-03-14 11:34 -0700
http://bitbucket.org/pypy/pypy/changeset/9f01756bfee4/
Log: Use the untyped API for floats here, even though it's not done for
translated yet
diff --git a/pypy/objspace/std/tupletype.py b/pypy/objspace/std/tupletype.py
--- a/pypy/objspace/std/tupletype.py
+++ b/pypy/objspace/std/tupletype.py
@@ -4,7 +4,8 @@
from pypy.interpreter.baseobjspace import W_Root
from pypy.objspace.std.register_all import register_all
from pypy.objspace.std.stdtypedef import StdTypeDef, SMM
-from pypy.rlib.rerased_raw import UntypedStorage, INT, BOOL, INSTANCE, STRING
+from pypy.rlib.rerased_raw import (UntypedStorage, INT, BOOL, FLOAT, INSTANCE,
+ STRING)
from pypy.rlib.unroll import unrolling_iterable
@@ -31,6 +32,13 @@
def _get_bool(space, storage, idx):
return space.wrap(storage.getbool(idx))
+def _check_float(space, w_obj):
+ return space.is_w(space.type(w_obj), space.w_float)
+def _store_float(space, storage, idx, w_obj):
+ storage.setfloat(idx, space.float_w(w_obj))
+def _get_float(space, storage, idx):
+ return space.wrap(storage.getfloat(idx))
+
def _check_str(space, w_obj):
return space.is_w(space.type(w_obj), space.w_str)
def _store_str(space, storage, idx, w_obj):
@@ -48,6 +56,7 @@
SPECIALIZED_TYPES = unrolling_iterable([
(INT, _check_int, _store_int, _get_int),
(BOOL, _check_bool, _store_bool, _get_bool),
+ (FLOAT, _check_float, _store_float, _get_float),
(STRING, _check_str, _store_str, _get_str),
(INSTANCE, _check_instance, _store_instance, _get_instance)
])
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit