Author: Maciej Fijalkowski <fij...@gmail.com> Branch: kill-unary-multimethods Changeset: r47393:0ce0d09dbd8f Date: 2011-09-21 10:55 +0200 http://bitbucket.org/pypy/pypy/changeset/0ce0d09dbd8f/
Log: some more test fixes diff --git a/pypy/objspace/std/ropeobject.py b/pypy/objspace/std/ropeobject.py --- a/pypy/objspace/std/ropeobject.py +++ b/pypy/objspace/std/ropeobject.py @@ -41,6 +41,11 @@ return w_self return W_RopeObject(w_self._node) + def unicode_w(w_self, space): + # XXX should this use the default encoding? + from pypy.objspace.std.unicodetype import plain_str2unicode + return plain_str2unicode(space, w_self._node.flatten_string()) + W_RopeObject.EMPTY = W_RopeObject(rope.LiteralStringNode.EMPTY) W_RopeObject.PREBUILT = [W_RopeObject(rope.LiteralStringNode.PREBUILT[i]) for i in range(256)] diff --git a/pypy/objspace/std/smallintobject.py b/pypy/objspace/std/smallintobject.py --- a/pypy/objspace/std/smallintobject.py +++ b/pypy/objspace/std/smallintobject.py @@ -7,16 +7,30 @@ from pypy.objspace.std.register_all import register_all from pypy.objspace.std.noneobject import W_NoneObject from pypy.objspace.std.intobject import W_IntObject +from pypy.interpreter.error import OperationError from pypy.rlib.objectmodel import UnboxedValue +from pypy.rlib.rbigint import rbigint +from pypy.rlib.rarithmetic import r_uint from pypy.tool.sourcetools import func_with_new_name - class W_SmallIntObject(W_Object, UnboxedValue): __slots__ = 'intval' from pypy.objspace.std.inttype import int_typedef as typedef def unwrap(w_self, space): return int(w_self.intval) + int_w = unwrap + + def uint_w(w_self, space): + intval = w_self.intval + if intval < 0: + raise OperationError(space.w_ValueError, + space.wrap("cannot convert negative integer to unsigned")) + else: + return r_uint(intval) + + def bigint_w(w_self, space): + return rbigint.fromint(w_self.intval) registerimplementation(W_SmallIntObject) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit