Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r69066:ff363fceb3c5 Date: 2014-02-04 00:03 +0100 http://bitbucket.org/pypy/pypy/changeset/ff363fceb3c5/
Log: A hack, which very indirectly might fix the failing test_pypy_c (test_decode_ascii). The issue is that str_decode_ascii() calls space.newtuple() indirectly, which before this change would call space.int_w(). Previously, it was thought that it would call any int_w() method, including the one from micronumpy, whereas in truth it can only call W_IntObject.int_w(). The one from micronumpy contains nowadays calls to random other space functions. diff --git a/pypy/objspace/std/specialisedtupleobject.py b/pypy/objspace/std/specialisedtupleobject.py --- a/pypy/objspace/std/specialisedtupleobject.py +++ b/pypy/objspace/std/specialisedtupleobject.py @@ -27,11 +27,11 @@ w_obj = values_w[i] val_type = typetuple[i] if val_type == int: - unwrapped = space.int_w(w_obj) + unwrapped = w_obj.int_w(space) elif val_type == float: - unwrapped = space.float_w(w_obj) + unwrapped = w_obj.float_w(space) elif val_type == str: - unwrapped = space.str_w(w_obj) + unwrapped = w_obj.str_w(space) elif val_type == object: unwrapped = w_obj else: @@ -127,16 +127,15 @@ Cls_ff = make_specialised_class((float, float)) def makespecialisedtuple(space, list_w): + from pypy.objspace.std.intobject import W_IntObject + from pypy.objspace.std.floatobject import W_FloatObject if len(list_w) == 2: w_arg1, w_arg2 = list_w - w_type1 = space.type(w_arg1) - if w_type1 is space.w_int: - w_type2 = space.type(w_arg2) - if w_type2 is space.w_int: + if isinstance(w_arg1, W_IntObject): + if isinstance(w_arg2, W_IntObject): return Cls_ii(space, w_arg1, w_arg2) - elif w_type1 is space.w_float: - w_type2 = space.type(w_arg2) - if w_type2 is space.w_float: + elif isinstance(w_arg1, W_FloatObject): + if isinstance(w_arg2, W_FloatObject): return Cls_ff(space, w_arg1, w_arg2) return Cls_oo(space, w_arg1, w_arg2) else: _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit