Commits

Maciej Fijalkowski  committed a67e4ca Merge

merge default

  • Participants
  • Parent commits acc0967, a7f5a71
  • Branches kill-someobject

Comments (0)

Files changed (35)

File py/_io/capture.py

 
 
 class StdCaptureFD(Capture):
-    """ This class allows to capture writes to FD1 and FD2
+    """ This class allows capturing writes to FD1 and FD2
         and may connect a NULL file to FD0 (and prevent
         reads from sys.stdin).  If any of the 0,1,2 file descriptors
         is invalid it will not be captured.
         return l
 
 class StdCapture(Capture):
-    """ This class allows to capture writes to sys.stdout|stderr "in-memory"
-        and will raise errors on tries to read from sys.stdin. It only
+    """ This class allows capturing writes to sys.stdout|stderr "in-memory"
+        and will raise errors on read attempts from sys.stdin. It only
         modifies sys.stdout|stderr|stdin attributes and does not
         touch underlying File Descriptors (use StdCaptureFD for that).
     """

File pypy/bin/reportstaticdata.py

 
 """
 Usage: reportstaticdata.py [-m1|-m2|-t] [OPTION]... FILENAME
-Print a report for the static data informations contained in FILENAME
+Print a report for the static data information contained in FILENAME
 
-The static data informations are saved in the file staticdata.info when
+The static data information is saved in the file staticdata.info when
 passing --dump_static_data_info to translate.py.
 
 Options:

File pypy/doc/architecture.rst

    interpreter`_.
 
 .. _`documentation index`: index.html#project-documentation
-.. _`getting-started`: getting-started.html
+.. _`getting-started`: getting-started-dev.html
 .. _`PyPy's approach to virtual machine construction`: https://bitbucket.org/pypy/extradoc/raw/tip/talk/dls2006/pypy-vm-construction.pdf
 .. _`the translation document`: translation.html
 .. _`RPython toolchain`: translation.html

File pypy/interpreter/generator.py

 from pypy.interpreter.error import OperationError
 from pypy.interpreter.pyopcode import LoopBlock
 from pypy.rlib import jit
-from pypy.rlib.objectmodel import specialize
 
 
 class GeneratorIterator(Wrappable):

File pypy/interpreter/unicodehelper.py

+from pypy.interpreter.error import OperationError
+from pypy.rlib.objectmodel import specialize
+from pypy.rlib import runicode
 from pypy.module._codecs import interp_codecs
 
+@specialize.memo()
+def decode_error_handler(space):
+    def raise_unicode_exception_decode(errors, encoding, msg, s,
+                                       startingpos, endingpos):
+        raise OperationError(space.w_UnicodeDecodeError,
+                             space.newtuple([space.wrap(encoding),
+                                             space.wrap(s),
+                                             space.wrap(startingpos),
+                                             space.wrap(endingpos),
+                                             space.wrap(msg)]))
+    return raise_unicode_exception_decode
+
+@specialize.memo()
+def encode_error_handler(space):
+    def raise_unicode_exception_encode(errors, encoding, msg, u,
+                                       startingpos, endingpos):
+        raise OperationError(space.w_UnicodeEncodeError,
+                             space.newtuple([space.wrap(encoding),
+                                             space.wrap(u),
+                                             space.wrap(startingpos),
+                                             space.wrap(endingpos),
+                                             space.wrap(msg)]))
+    return raise_unicode_exception_encode
+
+# ____________________________________________________________
+
 def PyUnicode_AsEncodedString(space, w_data, w_encoding):
     return interp_codecs.encode(space, w_data, w_encoding)
 
 # These functions take and return unwrapped rpython strings and unicodes
-PyUnicode_DecodeUnicodeEscape = interp_codecs.make_raw_decoder('unicode_escape')
-PyUnicode_DecodeRawUnicodeEscape = interp_codecs.make_raw_decoder('raw_unicode_escape')
-PyUnicode_DecodeUTF8 = interp_codecs.make_raw_decoder('utf_8')
-PyUnicode_EncodeUTF8 = interp_codecs.make_raw_encoder('utf_8')
+def PyUnicode_DecodeUnicodeEscape(space, string):
+    state = space.fromcache(interp_codecs.CodecState)
+    unicodedata_handler = state.get_unicodedata_handler(space)
+    result, consumed = runicode.str_decode_unicode_escape(
+        string, len(string), "strict",
+        final=True, errorhandler=decode_error_handler(space),
+        unicodedata_handler=unicodedata_handler)
+    return result
+
+def PyUnicode_DecodeRawUnicodeEscape(space, string):
+    result, consumed = runicode.str_decode_raw_unicode_escape(
+        string, len(string), "strict",
+        final=True, errorhandler=decode_error_handler(space))
+    return result
+
+def PyUnicode_DecodeUTF8(space, string):
+    result, consumed = runicode.str_decode_utf_8(
+        string, len(string), "strict",
+        final=True, errorhandler=decode_error_handler(space),
+        allow_surrogates=True)
+    return result
+
+def PyUnicode_EncodeUTF8(space, uni):
+    return runicode.unicode_encode_utf_8(
+        uni, len(uni), "strict",
+        errorhandler=encode_error_handler(space),
+        allow_surrogates=True)

File pypy/jit/backend/cli/methodfactory.py

         return self.dynmeth.CreateDelegate(delegatetype, consts)
 
 
-# the assemblyData singleton contains the informations about the
+# the assemblyData singleton contains the information about the
 # assembly we are currently writing to
 class AssemblyData:
     assembly = None

File pypy/jit/backend/model.py

         The FailDescr is the descr of the original guard that failed.
 
         Optionally, return a ``ops_offset`` dictionary.  See the docstring of
-        ``compiled_loop`` for more informations about it.
+        ``compiled_loop`` for more information about it.
         """
         raise NotImplementedError
 

File pypy/jit/metainterp/optimizeopt/unroll.py

         except BadVirtualState:
             raise InvalidLoop('The state of the optimizer at the end of ' +
                               'peeled loop is inconsistent with the ' +
-                              'VirtualState at the begining of the peeled ' +
+                              'VirtualState at the beginning of the peeled ' +
                               'loop')
         jumpop.initarglist(jumpargs)
 

File pypy/module/__builtin__/operation.py

     # string to the rest of the code.  XXX not entirely sure if these three
     # functions are the only way for non-string objects to reach
     # space.{get,set,del}attr()...
-    # Note that if w_name is already a string (or a subclass of str),
-    # it must be returned unmodified (and not e.g. unwrapped-rewrapped).
+    # Note that if w_name is already an exact string it must be returned
+    # unmodified (and not e.g. unwrapped-rewrapped).
     if not space.is_w(space.type(w_name), space.w_str):
         name = space.str_w(w_name)    # typecheck
         w_name = space.wrap(name)     # rewrap as a real string

File pypy/module/__builtin__/test/test_builtin.py

         assert f() == {}
         assert g() == {'a':0, 'b':0, 'c':0}
 
-    def test_getattr(self):
-        class a(object):
-            i = 5
-        assert getattr(a, 'i') == 5
-        raises(AttributeError, getattr, a, 'k')
-        assert getattr(a, 'k', 42) == 42
-        assert getattr(a, u'i') == 5
-        raises(AttributeError, getattr, a, u'k')
-        assert getattr(a, u'k', 42) == 42
-
-    def test_getattr_typecheck(self):
-        class A(object):
-            def __getattribute__(self, name):
-                pass
-            def __setattr__(self, name, value):
-                pass
-            def __delattr__(self, name):
-                pass
-        raises(TypeError, getattr, A(), 42)
-        raises(TypeError, setattr, A(), 42, 'x')
-        raises(TypeError, delattr, A(), 42)
-
     def test_sum(self):
         assert sum([]) ==0
         assert sum([42]) ==42
         assert vars(C_get_vars()) == {'a':2}
 
 
+class AppTestGetattr:
+    OPTIONS = {}
+
+    def setup_class(cls):
+        cls.space = conftest.gettestobjspace(**cls.OPTIONS)
+
+    def test_getattr(self):
+        class a(object):
+            i = 5
+        assert getattr(a, 'i') == 5
+        raises(AttributeError, getattr, a, 'k')
+        assert getattr(a, 'k', 42) == 42
+        assert getattr(a, u'i') == 5
+        raises(AttributeError, getattr, a, u'k')
+        assert getattr(a, u'k', 42) == 42
+
+    def test_getattr_typecheck(self):
+        class A(object):
+            def __getattribute__(self, name):
+                pass
+            def __setattr__(self, name, value):
+                pass
+            def __delattr__(self, name):
+                pass
+        raises(TypeError, getattr, A(), 42)
+        raises(TypeError, setattr, A(), 42, 'x')
+        raises(TypeError, delattr, A(), 42)
+
+
+class AppTestGetattrWithGetAttributeShortcut(AppTestGetattr):
+    OPTIONS = {"objspace.std.getattributeshortcut": True}
+
+
 class TestInternal:
     def test_execfile(self, space):
         from pypy.tool.udir import udir

File pypy/module/_cffi_backend/newtype.py

         raise OperationError(space.w_ValueError,
                              space.wrap("tuple args must have the same size"))
     enumerators = [space.str_w(w) for w in enumerators_w]
-    enumvalues  = [space.int_w(w) for w in enumvalues_w]
+    enumvalues = []
+    try:
+        for w in enumvalues_w:
+            enumvalues.append(space.c_int_w(w))
+    except OperationError, e:
+        if not e.match(space, space.w_OverflowError):
+            raise
+        i = len(enumvalues)
+        raise operationerrfmt(space.w_OverflowError,
+            "enum '%s' declaration for '%s' does not fit an int",
+                              name, enumerators[i])
     ctype = ctypeenum.W_CTypeEnum(space, name, enumerators, enumvalues)
     return ctype
 

File pypy/module/_cffi_backend/test/_backend_test_c.py

     e = py.test.raises(TypeError, newp, BStructPtr, [None])
     assert "must be a str or int, not NoneType" in str(e.value)
 
+def test_enum_overflow():
+    for ovf in (2**63, -2**63-1, 2**31, -2**31-1):
+        e = py.test.raises(OverflowError, new_enum_type, "foo", ('a', 'b'),
+                           (5, ovf))
+        assert str(e.value) == (
+            "enum 'foo' declaration for 'b' does not fit an int")
+
 def test_callback_returning_enum():
     BInt = new_primitive_type("int")
     BEnum = new_enum_type("foo", ('def', 'c', 'ab'), (0, 1, -20))
     py.test.raises(OverflowError, newp, BBoolP, 2)
     py.test.raises(OverflowError, newp, BBoolP, -1)
     BCharP = new_pointer_type(new_primitive_type("char"))
-    p = newp(BCharP, 'X')
+    p = newp(BCharP, b'X')
     q = cast(BBoolP, p)
-    assert q[0] == ord('X')
+    assert q[0] == ord(b'X')
     py.test.raises(TypeError, string, cast(BBool, False))
     BDouble = new_primitive_type("double")
     assert int(cast(BBool, cast(BDouble, 0.1))) == 1

File pypy/module/_codecs/interp_codecs.py

 
 from pypy.rlib import runicode
 
-def make_raw_encoder(name):
-    rname = "unicode_encode_%s" % (name.replace("_encode", ""), )
-    assert hasattr(runicode, rname)
-    def raw_encoder(space, uni):
-        state = space.fromcache(CodecState)
-        func = getattr(runicode, rname)
-        errors = "strict"
-        return func(uni, len(uni), errors, state.encode_error_handler)
-    raw_encoder.func_name = rname
-    return raw_encoder
-
-def make_raw_decoder(name):
-    rname = "str_decode_%s" % (name.replace("_decode", ""), )
-    assert hasattr(runicode, rname)
-    def raw_decoder(space, string):
-        final = True
-        errors = "strict"
-        state = space.fromcache(CodecState)
-        func = getattr(runicode, rname)
-        kwargs = {}
-        if name == 'unicode_escape':
-            unicodedata_handler = state.get_unicodedata_handler(space)
-            result, consumed = func(string, len(string), errors,
-                                    final, state.decode_error_handler,
-                                    unicodedata_handler=unicodedata_handler)
-        else:
-            result, consumed = func(string, len(string), errors,
-                                    final, state.decode_error_handler)
-        return result
-    raw_decoder.func_name = rname
-    return raw_decoder
-
 def make_encoder_wrapper(name):
     rname = "unicode_encode_%s" % (name.replace("_encode", ""), )
     assert hasattr(runicode, rname)

File pypy/module/marshal/test/test_marshal.py

     def test_unicode(self):
         import marshal, sys
         self.marshal_check(u'\uFFFF')
+        self.marshal_check(u'\ud800')
 
         self.marshal_check(unichr(sys.maxunicode))
 

File pypy/module/micronumpy/compile.py

     def newlist(self, items):
         return ListObject(items)
 
+    def newcomplex(self, r, i):
+        return ComplexObject(r, i)
+
     def listview(self, obj):
         assert isinstance(obj, ListObject)
         return obj.items
             raise OperationError(self.w_TypeError, self.wrap("slice."))
         raise NotImplementedError
 
+    def unpackcomplex(self, w_obj):
+        if isinstance(w_obj, ComplexObject):
+            return w_obj.r, w_obj.i
+        raise NotImplementedError
+
     def index(self, w_obj):
         return self.wrap(self.int_w(w_obj))
 
     def __init__(self, v):
         self.v = v
 
+class ComplexObject(W_Root):
+    tp = FakeSpace.w_complex
+    def __init__(self, r, i):
+        self.r = r
+        self.i = i
+
 class InterpreterState(object):
     def __init__(self, code):
         self.code = code
     def execute(self, interp):
         return interp.space.wrap(self.v)
 
+class ComplexConstant(Node):
+    def __init__(self, r, i):
+        self.r = float(r)
+        self.i = float(i)
+
+    def __repr__(self):
+        return 'ComplexConst(%s, %s)' % (self.r, self.i)
+
+    def wrap(self, space):
+        return space.newcomplex(self.r, self.i)
+
+    def execute(self, interp):
+        return self.wrap(interp.space)
+
 class RangeConstant(Node):
     def __init__(self, v):
         self.v = int(v)
 
     def execute(self, interp):
         w_list = self.wrap(interp.space)
-        dtype = get_dtype_cache(interp.space).w_float64dtype
-        return array(interp.space, w_list, w_dtype=dtype, w_order=None)
+        return array(interp.space, w_list)
 
     def __repr__(self):
         return "[" + ", ".join([repr(item) for item in self.items]) + "]"
                 stack.append(RangeConstant(tokens.pop().v))
                 end = tokens.pop()
                 assert end.name == 'pipe'
+            elif token.name == 'paren_left':
+                stack.append(self.parse_complex_constant(tokens))
             elif accept_comma and token.name == 'comma':
                 continue
             else:
             args += self.parse_expression(tokens, accept_comma=True)
         return FunctionCall(name, args)
 
+    def parse_complex_constant(self, tokens):
+        r = tokens.pop()
+        assert r.name == 'number'
+        assert tokens.pop().name == 'comma'
+        i = tokens.pop()
+        assert i.name == 'number'
+        assert tokens.pop().name == 'paren_right'
+        return ComplexConstant(r.v, i.v)
+
     def parse_array_const(self, tokens):
         elems = []
         while True:
                 elems.append(FloatConstant(token.v))
             elif token.name == 'array_left':
                 elems.append(ArrayConstant(self.parse_array_const(tokens)))
+            elif token.name == 'paren_left':
+                elems.append(self.parse_complex_constant(tokens))
             else:
                 raise BadToken()
             token = tokens.pop()

File pypy/module/micronumpy/interp_boxes.py

         self.imag = imag
 
     def convert_to(self, dtype):
-        from pypy.module.micronumpy.types import ComplexFloating
-        if not isinstance(dtype.itemtype, ComplexFloating):
-            raise TypeError('cannot convert %r to complex' % dtype)
         return dtype.box_complex(self.real, self.imag)
 
     def convert_real_to(self, dtype):
         return space.wrap(box.value)
 
     def descr_float(self, space):
-        try:
-            box = self.convert_to(W_Float64Box._get_dtype(space))
-        except TypeError:
-            raise OperationError(space.w_TypeError,
-                                 space.wrap("Cannot convert %s to float" % self._get_dtype(space).name))
-
+        box = self.convert_to(W_Float64Box._get_dtype(space))
         assert isinstance(box, W_Float64Box)
         return space.wrap(box.value)
 

File pypy/module/micronumpy/interp_ufuncs.py

     return not dtype.itemtype.bool(val)
 
 class W_Ufunc(Wrappable):
-    _attrs_ = ["name", "promote_to_float", "promote_bools", "identity", "allow_complex"]
-    _immutable_fields_ = ["promote_to_float", "promote_bools", "name", "allow_complex"]
+    _attrs_ = ["name", "promote_to_float", "promote_bools", "identity", 
+               "allow_complex", "complex_to_float"]
+    _immutable_fields_ = ["promote_to_float", "promote_bools", "name", 
+            "allow_complex", "complex_to_float"]
 
     def __init__(self, name, promote_to_float, promote_bools, identity,
-                 int_only, allow_complex):
+                 int_only, allow_complex, complex_to_float):
         self.name = name
         self.promote_to_float = promote_to_float
         self.promote_bools = promote_bools
         self.allow_complex = allow_complex
+        self.complex_to_float = complex_to_float
 
         self.identity = identity
         self.int_only = int_only
     _immutable_fields_ = ["func", "name"]
 
     def __init__(self, func, name, promote_to_float=False, promote_bools=False,
-        identity=None, bool_result=False, int_only=False, allow_complex=True):
+        identity=None, bool_result=False, int_only=False,
+        allow_complex=True, complex_to_float=False):
 
         W_Ufunc.__init__(self, name, promote_to_float, promote_bools, identity,
-                         int_only, allow_complex)
+                         int_only, allow_complex, complex_to_float)
         self.func = func
         self.bool_result = bool_result
 
             res_dtype = interp_dtype.get_dtype_cache(space).w_booldtype
         else:
             res_dtype = calc_dtype
+            if self.complex_to_float and calc_dtype.is_complex_type():
+                if calc_dtype.name == 'complex64':
+                    res_dtype = interp_dtype.get_dtype_cache(space).w_float32dtype
+                else:    
+                    res_dtype = interp_dtype.get_dtype_cache(space).w_float64dtype
         if w_obj.is_scalar():
             w_val = self.func(calc_dtype,
                               w_obj.get_scalar_value().convert_to(calc_dtype))
     argcount = 2
 
     def __init__(self, func, name, promote_to_float=False, promote_bools=False,
-        identity=None, comparison_func=False, int_only=False, allow_complex=True):
+        identity=None, comparison_func=False, int_only=False, 
+        allow_complex=True, complex_to_float=False):
 
         W_Ufunc.__init__(self, name, promote_to_float, promote_bools, identity,
-                         int_only, allow_complex)
+                         int_only, allow_complex, complex_to_float)
         self.func = func
         self.comparison_func = comparison_func
         if name == 'logical_and':
 
             ("positive", "pos", 1),
             ("negative", "neg", 1),
-            ("absolute", "abs", 1),
+            ("absolute", "abs", 1, {"complex_to_float": True}),
             ("sign", "sign", 1, {"promote_bools": True}),
             ("signbit", "signbit", 1, {"bool_result": True, 
                                        "allow_complex": False}),
             ("reciprocal", "reciprocal", 1),
             ("conjugate", "conj", 1),
-            ("real", "real", 1),
-            ("imag", "imag", 1),
+            ("real", "real", 1, {"complex_to_float": True}),
+            ("imag", "imag", 1, {"complex_to_float": True}),
 
             ("fabs", "fabs", 1, {"promote_to_float": True,
                                  "allow_complex": False}),

File pypy/module/micronumpy/test/test_compile.py

         d -> 1
         ''')
         assert interp.results[0].value == 0
+
+    def test_complex(self):
+        interp = self.run('''
+        a = (0, 1)
+        b = [(0, 1), (1, 0)]
+        b -> 0
+        ''')
+        assert interp.results[0].real == 0
+        assert interp.results[0].imag == 1
+        

File pypy/module/micronumpy/test/test_complex.py

             assert c[i] == max(a[i], b[i])
 
     def test_basic(self):
-        from _numpypy import (complex128, complex64, add,
+        from _numpypy import (complex128, complex64, add, array, dtype,
             subtract as sub, multiply, divide, negative, abs, floor_divide,
-            reciprocal, real, imag, sign)
+            real, imag, sign)
         from _numpypy import (equal, not_equal, greater, greater_equal, less,
                 less_equal, isnan)
         assert real(4.0) == 4.0
         assert imag(0.0) == 0.0
+        a = array([complex(3.0, 4.0)])
+        b = a.real
+        assert b.dtype == dtype(float)
         for complex_ in complex64, complex128:
 
             O = complex(0, 0)

File pypy/module/micronumpy/test/test_zjit.py

     def setup_class(cls):
         default = """
         a = [1,2,3,4]
+        z = (1, 2)
         c = a + b
         sum(c) -> 1::1
         a -> 3:1:2
                                 'new_with_vtable': 1, 
                                 'int_add': 2, 
                                 'float_ne': 1})
-

File pypy/module/micronumpy/types.py

 
     @complex_unary_op
     def expm1(self, v):
-	#Duplicate exp() so in the future it will be easier
-	# to implement seterr
+        # duplicate exp() so in the future it will be easier
+        # to implement seterr
         if rfloat.isinf(v[1]):
             if rfloat.isinf(v[0]):
                 if v[0] < 0:
                 return rfloat.NAN, rfloat.NAN
         try:
             res = rcomplex.c_exp(*v)
-	    res = (res[0]-1, res[1])
-	    return res
+            res = (res[0]-1, res[1])
+            return res
         except OverflowError:
             if v[1] == 0:
                 return rfloat.INFINITY, 0.0

File pypy/module/posix/app_posix.py

     def wait3(options):
         """ wait3(options) -> (pid, status, rusage)
 
-        Wait for completion of a child process and provides resource usage informations
+        Wait for completion of a child process and provides resource usage information
         """
         from _pypy_wait import wait3
         return wait3(options)
     def wait4(pid, options):
         """ wait4(pid, options) -> (pid, status, rusage)
 
-        Wait for completion of the child process "pid" and provides resource usage informations
+        Wait for completion of the child process "pid" and provides resource usage information
         """
         from _pypy_wait import wait4
         return wait4(pid, options)

File pypy/module/pypyjit/interp_resop.py

     """ set_optimize_hook(hook)
 
     Set a compiling hook that will be called each time a loop is optimized,
-    but before assembler compilation. This allows to add additional
+    but before assembler compilation. This allows adding additional
     optimizations on Python level.
 
     The hook will be called with the pypyjit.JitLoopInfo object. Refer to it's

File pypy/objspace/std/floatobject.py

 import operator
-import sys
 from pypy.interpreter import gateway
 from pypy.interpreter.error import OperationError
 from pypy.objspace.std import model, newformat
     isinf, isnan, isfinite, INFINITY, NAN, copysign, formatd,
     DTSF_ADD_DOT_0, DTSF_STR_PRECISION)
 from pypy.rlib.rbigint import rbigint
-from pypy.rlib.objectmodel import we_are_translated
 from pypy.rlib import rfloat
 from pypy.tool.sourcetools import func_with_new_name
 
     return space.wrap(_hash_float(space, w_value.floatval))
 
 def _hash_float(space, v):
-    from pypy.objspace.std.longobject import hash__Long
-
     if isnan(v):
         return 0
 

File pypy/objspace/std/unicodetype.py

 from pypy.interpreter.error import OperationError, operationerrfmt
 from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault
+from pypy.interpreter import unicodehelper
 from pypy.objspace.std.stdtypedef import StdTypeDef, SMM
 from pypy.objspace.std.register_all import register_all
 from pypy.objspace.std.basestringtype import basestring_typedef
 
 # ____________________________________________________________
 
-def decode_error_handler(space):
-    def raise_unicode_exception_decode(errors, encoding, msg, s,
-                                       startingpos, endingpos):
-        raise OperationError(space.w_UnicodeDecodeError,
-                             space.newtuple([space.wrap(encoding),
-                                             space.wrap(s),
-                                             space.wrap(startingpos),
-                                             space.wrap(endingpos),
-                                             space.wrap(msg)]))
-    return raise_unicode_exception_decode
-decode_error_handler._annspecialcase_ = 'specialize:memo'
-
-def encode_error_handler(space):
-    def raise_unicode_exception_encode(errors, encoding, msg, u,
-                                       startingpos, endingpos):
-        raise OperationError(space.w_UnicodeEncodeError,
-                             space.newtuple([space.wrap(encoding),
-                                             space.wrap(u),
-                                             space.wrap(startingpos),
-                                             space.wrap(endingpos),
-                                             space.wrap(msg)]))
-    return raise_unicode_exception_encode
-encode_error_handler._annspecialcase_ = 'specialize:memo'
-
-# ____________________________________________________________
-
 def getdefaultencoding(space):
     return space.sys.defaultencoding
 
         if errors is None or errors == 'strict':
             if encoding == 'ascii':
                 u = space.unicode_w(w_object)
-                eh = encode_error_handler(space)
+                eh = unicodehelper.encode_error_handler(space)
                 return space.wrap(unicode_encode_ascii(
                         u, len(u), None, errorhandler=eh))
             if encoding == 'utf-8':
                 u = space.unicode_w(w_object)
-                eh = encode_error_handler(space)
+                eh = unicodehelper.encode_error_handler(space)
                 return space.wrap(unicode_encode_utf_8(
                         u, len(u), None, errorhandler=eh,
                         allow_surrogates=True))
         if encoding == 'ascii':
             # XXX error handling
             s = space.bufferstr_w(w_obj)
-            eh = decode_error_handler(space)
+            eh = unicodehelper.decode_error_handler(space)
             return space.wrap(str_decode_ascii(
                     s, len(s), None, final=True, errorhandler=eh)[0])
         if encoding == 'utf-8':
             s = space.bufferstr_w(w_obj)
-            eh = decode_error_handler(space)
+            eh = unicodehelper.decode_error_handler(space)
             return space.wrap(str_decode_utf_8(
                     s, len(s), None, final=True, errorhandler=eh,
                     allow_surrogates=True)[0])

File pypy/rlib/rcomplex.py

 import math
 from math import fabs, pi, e
-from pypy.rlib.rfloat import copysign, asinh, log1p, isinf, isnan
+from pypy.rlib.rfloat import copysign, asinh, log1p, isfinite, isinf, isnan
 from pypy.rlib.constant import DBL_MIN, CM_SCALE_UP, CM_SCALE_DOWN
 from pypy.rlib.constant import CM_LARGE_DOUBLE, DBL_MANT_DIG
 from pypy.rlib.constant import M_LN2, M_LN10
 from pypy.rlib.constant import CM_SQRT_LARGE_DOUBLE, CM_SQRT_DBL_MIN
 from pypy.rlib.constant import CM_LOG_LARGE_DOUBLE
-from pypy.rlib.special_value import isfinite, special_type, INF, NAN
+from pypy.rlib.special_value import special_type, INF, NAN
 from pypy.rlib.special_value import sqrt_special_values
 from pypy.rlib.special_value import acos_special_values
 from pypy.rlib.special_value import acosh_special_values

File pypy/rlib/special_value.py

             else:
                 return ST_NZERO
 
-def isfinite(d):
-    return not isinf(d) and not isnan(d)
-
 
 P   = math.pi
 P14 = 0.25 * math.pi

File pypy/tool/bench/htmlreport.py

         )
 
     def render_revision_header(self, sample):
-        """return a header for a report with informations about
+        """return a header for a report with information about
         committer, messages, revision date.
         """
         revision_id = pyhtml.li('Revision ID: %s' % (sample.revision_id,))

File pypy/tool/bench/result.py

 
         
 class PerfResultCollection(object):
-    """Holds informations about several PerfResult objects. The
+    """Holds information about several PerfResult objects. The
     objects should have the same test_id and revision_id"""
     
     def __init__(self, results=None):
     count = py.std.itertools.count() 
     def annotate(self, result):
         """Try to put extra information for each revision on the
-        PerfResult objects. These informations are retrieved from a
+        PerfResult objects. These information are retrieved from a
         branch object.
         """
         #if self.branch is None:

File pypy/tool/memusage/log2gnumeric.py

 
     $ PYPYLOG=gc-collect,jit-mem:logfile pypy your-program.py
 
-This will produce "logfile", containing informations about the memory used by
+This will produce "logfile", containing information about the memory used by
 the GC and the number of loops created/freed by the JIT.
 
 If you want, you can also measure the amout of used memory as seen by the OS

File pypy/tool/sourcetools.py

 # various helper functions
 #
 class MyStr(str):
-    """ custom string which allows to add attributes. """
+    """ custom string which allows adding attributes. """
 
 def newcode(fromcode, **kwargs):
     names = [x for x in dir(fromcode) if x[:3] == 'co_']

File pypy/translator/goal/timing.py

 
-""" Module for keeping detailed informations about
+""" Module for keeping detailed information about
 times of certain driver parts
 """
 

File pypy/translator/microbench/pybench/platform.py

                  split=re.compile('[\s,]').split):
 
     """ Queries the given executable (defaults to the Python interpreter
-        binary) for various architecture informations.
+        binary) for various architecture information.
 
         Returns a tuple (bits,linkage) which contain information about
         the bit architecture and the linkage format used for the

File pypy/translator/platform/__init__.py

         largs = self._link_args_from_eci(eci, standalone)
         return self._link(cc_link, ofiles, largs, standalone, exe_name)
 
-    # below are some detailed informations for platforms
+    # below are some detailed information for platforms
 
     def include_dirs_for_libffi(self):
         dirs = self._include_dirs_for_libffi()

File pypy/translator/tool/staticsizereport.py

     f = infofile.open('w')
     pickle.dump(info, f)
     f.close()
-    log.info('static data informations dumped to %s' % infofile)
+    log.info('static data information dumped to %s' % infofile)
     return infofile