Commits

Antonio Cuni committed 244019c Merge

hg merge default; this fixes the problem with raw_malloc and integers, they are now optimized as well

Comments (0)

Files changed (33)

README

-=====================================
-PyPy: Python in Python Implementation 
-=====================================
-
-Welcome to PyPy!
-
-PyPy is both an implementation of the Python programming language, and
-an extensive compiler framework for dynamic language implementations.
-You can build self-contained Python implementations which execute
-independently from CPython.
-
-The home page is:
-
-    http://pypy.org/
-
-The getting-started document will help guide you:
-
-    http://doc.pypy.org/en/latest/getting-started.html
-
-It will also point you to the rest of the documentation which is generated
-from files in the pypy/doc directory within the source repositories. Enjoy
-and send us feedback!
-
-    the pypy-dev team <pypy-dev@python.org>
+=====================================
+PyPy: Python in Python Implementation 
+=====================================
+
+Welcome to PyPy!
+
+PyPy is both an implementation of the Python programming language, and
+an extensive compiler framework for dynamic language implementations.
+You can build self-contained Python implementations which execute
+independently from CPython.
+
+The home page is:
+
+    http://pypy.org/
+
+The getting-started document will help guide you:
+
+    http://doc.pypy.org/en/latest/getting-started.html
+
+It will also point you to the rest of the documentation which is generated
+from files in the pypy/doc directory within the source repositories. Enjoy
+and send us feedback!
+
+    the pypy-dev team <pypy-dev@python.org>

lib-python/2.7/timeit.py

         else:
             it = [None] * number
         gcold = gc.isenabled()
-        gc.disable()
+        if '__pypy__' not in sys.builtin_module_names:
+            gc.disable()    # only do that on CPython
         try:
             timing = self.inner(it, self.timer)
         finally:

pypy/annotation/annrpython.py

 from pypy.objspace.flow.model import (Variable, Constant, FunctionGraph,
                                       c_last_exception, checkgraph)
 from pypy.translator import simplify, transform
-from pypy.annotation import model as annmodel, signature
+from pypy.annotation import model as annmodel, signature, unaryop, binaryop
 from pypy.annotation.bookkeeper import Bookkeeper
 import py
 log = py.log.Producer("annrpython")
         # occour for this specific, typed operation.
         if block.exitswitch == c_last_exception:
             op = block.operations[-1]
-            if op.opname in annmodel.BINARY_OPERATIONS:
+            if op.opname in binaryop.BINARY_OPERATIONS:
                 arg1 = self.binding(op.args[0])
                 arg2 = self.binding(op.args[1])
                 binop = getattr(pair(arg1, arg2), op.opname, None)
                 can_only_throw = annmodel.read_can_only_throw(binop, arg1, arg2)
-            elif op.opname in annmodel.UNARY_OPERATIONS:
+            elif op.opname in unaryop.UNARY_OPERATIONS:
                 arg1 = self.binding(op.args[0])
                 opname = op.opname
                 if opname == 'contains': opname = 'op_contains'
         return self.bookkeeper.newdict()
 
 
-    def _registeroperations(cls, model):
+    def _registeroperations(cls, unary_ops, binary_ops):
         # All unary operations
         d = {}
-        for opname in model.UNARY_OPERATIONS:
+        for opname in unary_ops:
             fnname = 'consider_op_' + opname
             exec py.code.Source("""
 def consider_op_%s(self, arg, *args):
 """ % (opname, opname)).compile() in globals(), d
             setattr(cls, fnname, d[fnname])
         # All binary operations
-        for opname in model.BINARY_OPERATIONS:
+        for opname in binary_ops:
             fnname = 'consider_op_' + opname
             exec py.code.Source("""
 def consider_op_%s(self, arg1, arg2, *args):
     _registeroperations = classmethod(_registeroperations)
 
 # register simple operations handling
-RPythonAnnotator._registeroperations(annmodel)
+RPythonAnnotator._registeroperations(unaryop.UNARY_OPERATIONS, binaryop.BINARY_OPERATIONS)
 
 
 class BlockedInference(Exception):

pypy/annotation/binaryop.py

 from pypy.tool.pairtype import pair, pairtype
 from pypy.annotation.model import SomeObject, SomeInteger, SomeBool, s_Bool
 from pypy.annotation.model import SomeString, SomeChar, SomeList, SomeDict
-from pypy.annotation.model import SomeUnicodeCodePoint, SomeStringOrUnicode
+from pypy.annotation.model import SomeUnicodeCodePoint, SomeUnicodeString
 from pypy.annotation.model import SomeTuple, SomeImpossibleValue, s_ImpossibleValue
 from pypy.annotation.model import SomeInstance, SomeBuiltin, SomeIterator
 from pypy.annotation.model import SomePBC, SomeFloat, s_None
 from pypy.annotation.model import read_can_only_throw
 from pypy.annotation.model import add_knowntypedata, merge_knowntypedata
 from pypy.annotation.model import SomeGenericCallable
-from pypy.annotation.model import SomeUnicodeString
 from pypy.annotation.bookkeeper import getbookkeeper
 from pypy.objspace.flow.model import Variable, Constant
 from pypy.rlib import rarithmetic
         for s_item in s_tuple.items:
             if isinstance(s_item, SomeFloat):
                 pass   # or s_item is a subclass, like SomeInteger
-            elif isinstance(s_item, SomeStringOrUnicode) and s_item.no_nul:
+            elif (isinstance(s_item, SomeString) or
+                  isinstance(s_item, SomeUnicodeString)) and s_item.no_nul:
                 pass
             else:
                 no_nul = False

pypy/annotation/model.py

             self.knowntypedata = knowntypedata
 
 class SomeStringOrUnicode(SomeObject):
+    """Base class for shared implementation of SomeString and SomeUnicodeString.
+
+    Cannot be an annotation."""
+
     immutable = True
     can_be_None=False
     no_nul = False  # No NUL character in the string.
 
     def __init__(self, can_be_None=False, no_nul=False):
+        assert type(self) is not SomeStringOrUnicode
         if can_be_None:
             self.can_be_None = True
         if no_nul:
             d2 = d2.copy(); d2['no_nul'] = 0   # ignored
         return d1 == d2
 
+    def nonnoneify(self):
+        return self.__class__(can_be_None=False, no_nul=self.no_nul)
+
 class SomeString(SomeStringOrUnicode):
     "Stands for an object which is known to be a string."
     knowntype = str
 
-    def nonnoneify(self):
-        return SomeString(can_be_None=False, no_nul=self.no_nul)
-
 class SomeUnicodeString(SomeStringOrUnicode):
     "Stands for an object which is known to be an unicode string"
     knowntype = unicode
 
-    def nonnoneify(self):
-        return SomeUnicodeString(can_be_None=False, no_nul=self.no_nul)
-
 class SomeChar(SomeString):
     "Stands for an object known to be a string of length 1."
     can_be_None = False
     else:
         raise RuntimeError("The annotator relies on 'assert' statements from the\n"
                      "\tannotated program: you cannot run it with 'python -O'.")
-
-# this has the side-effect of registering the unary and binary operations
-from pypy.annotation.unaryop  import UNARY_OPERATIONS
-from pypy.annotation.binaryop import BINARY_OPERATIONS

pypy/annotation/signature.py

     actualtypes[:] = params_s
 
 def enforce_signature_return(funcdesc, sigtype, inferredtype):
-    return finish_type(sigtype, funcdesc.bookkeeper, funcdesc.pyobj)
+    s_sigret = finish_type(sigtype, funcdesc.bookkeeper, funcdesc.pyobj)
+    if not s_sigret.contains(inferredtype):
+        raise Exception("%r return value:\n"
+                        "expected %s,\n"
+                        "     got %s" % (funcdesc, s_sigret, inferredtype))
+    return s_sigret

pypy/doc/config/objspace.usemodules.time.txt

 Use the 'time' module. 
 
 Obsolete; use :config:`objspace.usemodules.rctime` for our up-to-date version
-of the application-level 'time' module.
+of the application-level 'time' module, at least for C-like targets (the C
+and LLVM backends).

pypy/module/_cffi_backend/misc.py

 from __future__ import with_statement
 from pypy.interpreter.error import OperationError, operationerrfmt
 from pypy.rpython.lltypesystem import lltype, llmemory, rffi
-from pypy.rlib.rarithmetic import r_uint, r_ulonglong
+from pypy.rlib.rarithmetic import r_uint, r_ulonglong, is_signed_integer_type
 from pypy.rlib.unroll import unrolling_iterable
 from pypy.rlib.objectmodel import keepalive_until_here, specialize
 from pypy.rlib import jit
 
 @specialize.argtype(1)
 def write_raw_integer_data(target, source, size):
-    for TP, TPP in _prim_unsigned_types:
-        if size == rffi.sizeof(TP):
-            rffi.cast(TPP, target)[0] = rffi.cast(TP, source)
-            return
+    if is_signed_integer_type(lltype.typeOf(source)):
+        for TP, TPP in _prim_signed_types:
+            if size == rffi.sizeof(TP):
+                rffi.cast(TPP, target)[0] = rffi.cast(TP, source)
+                return
+    else:
+        for TP, TPP in _prim_unsigned_types:
+            if size == rffi.sizeof(TP):
+                rffi.cast(TPP, target)[0] = rffi.cast(TP, source)
+                return
     raise NotImplementedError("bad integer size")
 
 def write_raw_float_data(target, source, size):

pypy/module/_hashlib/interp_hashlib.py

         + rffi.sizeof(ropenssl.EVP_MD) * 2 + 208
 
 class W_Hash(Wrappable):
-    ctx = lltype.nullptr(ropenssl.EVP_MD_CTX.TO)
+    NULL_CTX = lltype.nullptr(ropenssl.EVP_MD_CTX.TO)
+    ctx = NULL_CTX
 
-    def __init__(self, space, name):
+    def __init__(self, space, name, copy_from=NULL_CTX):
         self.name = name
         digest_type = self.digest_type_by_name(space)
         self.digest_size = rffi.getintfield(digest_type, 'c_md_size')
         ctx = lltype.malloc(ropenssl.EVP_MD_CTX.TO, flavor='raw')
         rgc.add_memory_pressure(HASH_MALLOC_SIZE + self.digest_size)
         try:
-            ropenssl.EVP_DigestInit(ctx, digest_type)
+            if copy_from:
+                ropenssl.EVP_MD_CTX_copy(ctx, copy_from)
+            else:
+                ropenssl.EVP_DigestInit(ctx, digest_type)
             self.ctx = ctx
         except:
             lltype.free(ctx, flavor='raw')
             raise
 
     def __del__(self):
-        # self.lock.free()
         if self.ctx:
             ropenssl.EVP_MD_CTX_cleanup(self.ctx)
             lltype.free(self.ctx, flavor='raw')
 
     def copy(self, space):
         "Return a copy of the hash object."
-        w_hash = W_Hash(space, self.name)
         with self.lock:
-            ropenssl.EVP_MD_CTX_copy(w_hash.ctx, self.ctx)
-        return w_hash
+            return W_Hash(space, self.name, copy_from=self.ctx)
 
     def digest(self, space):
         "Return the digest value as a string of binary data."

pypy/module/cpyext/src/pythread.c

 int
 PyThread_acquire_lock(PyThread_type_lock lock, int waitflag)
 {
-    return RPyThreadAcquireLock((struct RPyOpaqueThreadLock*)lock, waitflag);
+    return RPyThreadAcquireLock((struct RPyOpaque_ThreadLock*)lock, waitflag);
 }
 
 void
 PyThread_release_lock(PyThread_type_lock lock)
 {
-    RPyThreadReleaseLock((struct RPyOpaqueThreadLock*)lock);
+    RPyThreadReleaseLock((struct RPyOpaque_ThreadLock*)lock);
 }
 
 

pypy/module/fcntl/test/test_fcntl.py

             os.unlink(i)
 
 class AppTestFcntl:
-    spaceconfig = dict(usemodules=('fcntl', 'array', 'struct', 'termios', 'select', 'time'))
+    spaceconfig = dict(usemodules=('fcntl', 'array', 'struct', 'termios', 'select', 'rctime'))
     def setup_class(cls):
         tmpprefix = str(udir.ensure('test_fcntl', dir=1).join('tmp_'))
         cls.w_tmp = cls.space.wrap(tmpprefix)
         if child_pid == 0:
             # We're the child
             time.sleep(1)
-            return
+            os._exit(0)
         try:
+            # We're the parent, we want TIOCGPGRP calls after child started but before it dies
+            time.sleep(0)
+
             buf = array.array('i', [0])
             res = fcntl.ioctl(mfd, TIOCGPGRP, buf, True)
             assert res == 0

pypy/module/imp/test/test_import.py

 
 
 class AppTestMultithreadedImp(object):
-    spaceconfig = dict(usemodules=['thread', 'time'])
+    spaceconfig = dict(usemodules=['thread', 'rctime'])
 
     def setup_class(cls):
         #if not conftest.option.runappdirect:

pypy/module/thread/test/support.py

 
 
 class GenericTestThread:
-    spaceconfig = dict(usemodules=('thread', 'time', 'signal'))
+    spaceconfig = dict(usemodules=('thread', 'rctime', 'signal'))
 
     def setup_class(cls):
         if cls.runappdirect:

pypy/rlib/objectmodel.py

     def decorator(f):
         def get_annotation(t):
             from pypy.annotation.signature import annotation
-            from pypy.annotation.model import SomeObject, SomeStringOrUnicode
+            from pypy.annotation.model import SomeObject, SomeString, SomeUnicodeString
             if isinstance(t, SomeObject):
                 return t
             s_result = annotation(t)
-            if isinstance(s_result, SomeStringOrUnicode):
+            if (isinstance(s_result, SomeString) or
+                isinstance(s_result, SomeUnicodeString)):
                 return s_result.__class__(can_be_None=True)
             return s_result
         def get_type_descr_of_argument(arg):

pypy/rlib/rarithmetic.py

         return r_class(0)
 most_neg_value_of._annspecialcase_ = 'specialize:memo'
 
+def is_signed_integer_type(tp):
+    from pypy.rpython.lltypesystem import lltype, rffi
+    if tp is lltype.Signed:
+        return True
+    try:
+        r_class = rffi.platform.numbertype_to_rclass[tp]
+        return r_class.SIGNED
+    except KeyError:
+        return False   # not an integer type
+is_signed_integer_type._annspecialcase_ = 'specialize:memo'
+
 def highest_bit(n):
     """
     Calculates the highest set bit in n.  This function assumes that n is a

pypy/rlib/test/test_rarithmetic.py

     assert most_neg_value_of_same_type(r_longlong(123)) == llmin
     assert most_neg_value_of_same_type(r_ulonglong(123)) == 0
 
+def test_is_signed_integer_type():
+    from pypy.rpython.lltypesystem import lltype, rffi
+    assert is_signed_integer_type(lltype.Signed)
+    assert is_signed_integer_type(rffi.SIGNEDCHAR)
+    assert is_signed_integer_type(lltype.SignedLongLong)
+    assert not is_signed_integer_type(lltype.Unsigned)
+    assert not is_signed_integer_type(lltype.UnsignedLongLong)
+    assert not is_signed_integer_type(lltype.Char)
+    assert not is_signed_integer_type(lltype.UniChar)
+    assert not is_signed_integer_type(lltype.Bool)
+
 def test_r_ulonglong():
     x = r_longlong(-1)
     y = r_ulonglong(x)

pypy/rlib/test/test_signature.py

 from pypy.rlib import types
 from pypy.annotation import model
 from pypy.translator.translator import TranslationContext, graphof
+from pypy.rpython.lltypesystem import rstr
+from pypy.rpython.annlowlevel import LowLevelAnnotatorPolicy
 
 
-def annotate_at(f):
+def annotate_at(f, policy=None):
     t = TranslationContext()
-    a = t.buildannotator()
-    a.annotate_helper(f, [model.s_ImpossibleValue]*f.func_code.co_argcount)
+    a = t.buildannotator(policy=policy)
+    a.annotate_helper(f, [model.s_ImpossibleValue]*f.func_code.co_argcount, policy=policy)
     return a
 
 def sigof(a, f):
     g = graphof(a.translator, f)
     return [a.bindings[v] for v in g.startblock.inputargs] + [a.bindings[g.getreturnvar()]]
 
-def getsig(f):
-    a = annotate_at(f)
+def getsig(f, policy=None):
+    a = annotate_at(f, policy=policy)
     return sigof(a, f)
 
 def check_annotator_fails(caller):
     assert caller.func_name in repr(exc.args)
 
 
-def test_signature_bookkeeping():
+def test_bookkeeping():
     @signature('x', 'y', returns='z')
     def f(a, b):
         return a + len(b)
     assert f.foo == 'foo'
     assert f(1, 'hello') == 6
 
-def test_signature_basic():
+def test_basic():
     @signature(types.int(), types.str(), returns=types.char())
     def f(a, b):
         return b[a]
     assert getsig(f) == [model.SomeInteger(), model.SomeString(), model.SomeChar()]
 
-def test_signature_arg_errors():
+def test_arg_errors():
     @signature(types.int(), types.str(), returns=types.int())
     def f(a, b):
         return a + len(b)
     def bad_for_body(): # would give error inside 'f' body, instead errors at call
         f('a', 'b')
 
-def test_signature_return():
+def test_return():
     @signature(returns=types.str())
     def f():
         return 'a'
     a = annotate_at(g)
     assert sigof(a, f) == [model.SomeString(), model.SomeString()]
 
-def test_signature_return_errors():
+def test_return_errors():
     @check_annotator_fails
     @signature(returns=types.int())
     def int_not_char():
         return 'a'
+
     @check_annotator_fails
     @signature(types.str(), returns=types.int())
     def str_to_int(s):
         return s
 
+    @signature(returns=types.str())
+    def str_not_None():
+        return None
+    @check_annotator_fails
+    def caller_of_str_not_None():
+        return str_not_None()
 
-def test_signature_none():
+@py.test.mark.xfail
+def test_return_errors_xfail():
+    @check_annotator_fails
+    @signature(returns=types.str())
+    def str_not_None():
+        return None
+
+
+def test_none():
     @signature(returns=types.none())
     def f():
         pass
     assert getsig(f) == [model.s_None]
 
-def test_signature_float():
+def test_float():
     @signature(types.longfloat(), types.singlefloat(), returns=types.float())
     def f(a, b):
         return 3.0
     assert getsig(f) == [model.SomeLongFloat(), model.SomeSingleFloat(), model.SomeFloat()]
 
-def test_signature_unicode():
+def test_unicode():
     @signature(types.unicode(), returns=types.int())
     def f(u):
         return len(u)
     assert getsig(f) == [model.SomeUnicodeString(), model.SomeInteger()]
 
 
-def test_signature_list():
+def test_ptr():
+    policy = LowLevelAnnotatorPolicy()
+    @signature(types.ptr(rstr.STR), returns=types.none())
+    def f(buf):
+        pass
+    argtype = getsig(f, policy=policy)[0]
+    assert isinstance(argtype, model.SomePtr)
+    assert argtype.ll_ptrtype.TO == rstr.STR
+
+    def g():
+        f(rstr.mallocstr(10))
+    getsig(g, policy=policy)
+
+
+def test_list():
     @signature(types.list(types.int()), returns=types.int())
     def f(a):
         return len(a)
         l.append('b')
     getsig(can_append)
 
-def test_signature_array():
+def test_array():
     @signature(returns=types.array(types.int()))
     def f():
         return [1]
         l.append(2)
     check_annotator_fails(try_append)
 
-def test_signature_dict():
+def test_dict():
     @signature(returns=types.dict(types.str(), types.int()))
     def f():
         return {'a': 1, 'b': 2}
     assert rettype.dictdef.dictvalue.s_value == model.SomeInteger()
 
 
-def test_signature_instance():
+def test_instance():
     class C1(object):
         pass
     class C2(C1):
     def bad_for_body():
         f(C1())
 
-def test_signature_self():
+def test_self():
     @finishsigs
     class C(object):
         @signature(types.self(), types.self(), returns=types.none())
     assert isinstance(argtype, model.SomeInstance)
     assert argtype.classdef.classdesc.pyobj == C
 
-def test_signature_self_error():
+def test_self_error():
     class C(object):
         @signature(types.self(), returns=types.none())
         def incomplete_sig_meth(self):

pypy/rlib/types.py

     return model.SomeChar()
 
 
+def ptr(ll_type):
+    from pypy.rpython.lltypesystem.lltype import Ptr
+    return model.SomePtr(Ptr(ll_type))
+
+
 def list(element):
     listdef = ListDef(None, element, mutated=True, resized=True)
     return model.SomeList(listdef)

pypy/rpython/lltypesystem/lltype.py

         assert n is None
         o = _opaque(T, initialization=initialization)
     else:
-        raise TypeError, "malloc for Structs and Arrays only"
-    if T._gckind != 'gc' and not immortal and flavor.startswith('gc'):
+        raise TypeError, "malloc: unmallocable type"
+    if flavor == 'gc' and T._gckind != 'gc' and not immortal:
         raise TypeError, "gc flavor malloc of a non-GC non-immortal structure"
     if flavor == "raw" and not immortal and track_allocation:
         leakfinder.remember_malloc(o, framedepth=2)
-    solid = immortal or not flavor.startswith('gc') # immortal or non-gc case
+    solid = immortal or flavor == 'raw'
     return _ptr(Ptr(T), o, solid)
 
 def free(p, flavor, track_allocation=True):

pypy/rpython/rmodel.py

 from pypy.tool.pairtype import pairtype, extendabletype, pair
-from pypy.annotation import model as annmodel
+from pypy.annotation import model as annmodel, unaryop, binaryop
 from pypy.annotation import description
 from pypy.objspace.flow.model import Constant
 from pypy.rpython.lltypesystem.lltype import \
                                         "'%s' on %r" % (opname, self))
         setattr(rcls, attr, missing_rtype_operation)
 
-for opname in annmodel.UNARY_OPERATIONS:
+for opname in unaryop.UNARY_OPERATIONS:
     make_missing_op(Repr, opname)
 
-for opname in annmodel.BINARY_OPERATIONS:
+for opname in binaryop.BINARY_OPERATIONS:
     make_missing_op(pairtype(Repr, Repr), opname)
 
 # not in BINARY_OPERATIONS

pypy/rpython/rtyper.py

 import os
 import py
 from pypy.tool.pairtype import pair
-from pypy.annotation import model as annmodel
+from pypy.annotation import model as annmodel, unaryop, binaryop
 from pypy.annotation.annrpython import FAIL
 from pypy.objspace.flow.model import Variable, Constant
 from pypy.objspace.flow.model import SpaceOperation, c_last_exception
 
     # __________ regular operations __________
 
-    def _registeroperations(cls, model):
+    def _registeroperations(cls, unary_ops, binary_ops):
         d = {}
         # All unary operations
-        for opname in model.UNARY_OPERATIONS:
+        for opname in unary_ops:
             fnname = 'translate_op_' + opname
             exec py.code.compile("""
                 def translate_op_%s(self, hop):
                 """ % (opname, opname)) in globals(), d
             setattr(cls, fnname, d[fnname])
         # All binary operations
-        for opname in model.BINARY_OPERATIONS:
+        for opname in binary_ops:
             fnname = 'translate_op_' + opname
             exec py.code.compile("""
                 def translate_op_%s(self, hop):
         attachRuntimeTypeInfo(GCSTRUCT, funcptr, destrptr, None)
 
 # register operations from annotation model
-RPythonTyper._registeroperations(annmodel)
+RPythonTyper._registeroperations(unaryop.UNARY_OPERATIONS, binaryop.BINARY_OPERATIONS)
 
 # ____________________________________________________________
 

pypy/rpython/test/test_rbool.py

 from pypy.translator.translator import TranslationContext
-from pypy.annotation import model as annmodel
+from pypy.annotation import unaryop, binaryop
 from pypy.rpython.test import snippet
 from pypy.rpython.test.tool import BaseRtypingTest, LLRtypeMixin, OORtypeMixin
 
 
     def DONTtest_unary_operations(self):
         # XXX TODO test if all unary operations are implemented
-        for opname in annmodel.UNARY_OPERATIONS:
+        for opname in unaryop.UNARY_OPERATIONS:
             print 'UNARY_OPERATIONS:', opname
 
     def DONTtest_binary_operations(self):
         # XXX TODO test if all binary operations are implemented
-        for opname in annmodel.BINARY_OPERATIONS:
+        for opname in binaryop.BINARY_OPERATIONS:
             print 'BINARY_OPERATIONS:', opname
 
 class BaseTestRbool(BaseRtypingTest):

pypy/rpython/test/test_rfloat.py

 import sys
 from pypy.translator.translator import TranslationContext
+from pypy.annotation import unaryop, binaryop
 from pypy.rpython.test import snippet
 from pypy.rpython.test.tool import BaseRtypingTest, LLRtypeMixin, OORtypeMixin
 from pypy.rlib.rarithmetic import (
 
     def DONTtest_unary_operations(self):
         # XXX TODO test if all unary operations are implemented
-        for opname in annmodel.UNARY_OPERATIONS:
+        for opname in unaryop.UNARY_OPERATIONS:
             print 'UNARY_OPERATIONS:', opname
 
     def DONTtest_binary_operations(self):
         # XXX TODO test if all binary operations are implemented
-        for opname in annmodel.BINARY_OPERATIONS:
+        for opname in binaryop.BINARY_OPERATIONS:
             print 'BINARY_OPERATIONS:', opname
 
 class BaseTestRfloat(BaseRtypingTest):
     def test_formatd_huge(self):
         skip('formatd is broken on ootype')
 
-    def test_string_to_float(self):
-        skip('string_to_float is broken on ootype')
+    def test_parts_to_float(self):
+        skip('parts_to_float is broken on ootype')

pypy/rpython/test/test_rint.py

 import py
 import sys, operator
 from pypy.translator.translator import TranslationContext
-from pypy.annotation import model as annmodel
+from pypy.annotation import unaryop, binaryop
 from pypy.rpython.test import snippet
 from pypy.rlib.rarithmetic import r_int, r_uint, r_longlong, r_ulonglong
 from pypy.rlib.rarithmetic import ovfcheck, r_int64, intmask, int_between
 
     def DONTtest_unary_operations(self):
         # XXX TODO test if all unary operations are implemented
-        for opname in annmodel.UNARY_OPERATIONS:
+        for opname in unaryop.UNARY_OPERATIONS:
             print 'UNARY_OPERATIONS:', opname
 
     def DONTtest_binary_operations(self):
         # XXX TODO test if all binary operations are implemented
-        for opname in annmodel.BINARY_OPERATIONS:
+        for opname in binaryop.BINARY_OPERATIONS:
             print 'BINARY_OPERATIONS:', opname
 
 

pypy/tool/genstatistic.py

 pypydir = py.path.local(autopath.pypydir)
 
 def isdocfile(p):
-    return p.ext == '.txt' or p.basename in ('README', 'NOTES', 'LICENSE')
+    return (p.ext in ('.txt', '.rst') or
+            p.basename in ('README', 'NOTES', 'LICENSE'))
 
 def istestfile(p):
     if not p.check(file=1, ext='.py'): 

pypy/tool/pytest/objspace.py

             if key == 'usemodules':
                 if info is not None:
                     for modname in value:
+                        if modname == 'time':
+                            continue   # always either 'time' or 'rctime',
+                                       # and any is fine
                         ok = info.get('objspace.usemodules.%s' % modname,
                                       False)
                         if not ok:

pypy/tool/release/package.py

     shutil.copytree(str(basedir.join('lib_pypy')),
                     str(pypydir.join('lib_pypy')),
                     ignore=ignore_patterns('.svn', 'py', '*.pyc', '*~'))
-    for file in ['LICENSE', 'README']:
+    for file in ['LICENSE', 'README.rst']:
         shutil.copy(str(basedir.join(file)), str(pypydir))
     pypydir.ensure('include', dir=True)
     if sys.platform == 'win32':

pypy/tool/release/test/test_package.py

         assert not prefix.join('lib_pypy', 'py').check()
         assert not prefix.join('lib_pypy', 'ctypes_configure').check()
         assert prefix.join('LICENSE').check()
-        assert prefix.join('README').check()
+        assert prefix.join('README.rst').check()
         if package.USE_ZIPFILE_MODULE:
             zh = zipfile.ZipFile(str(builddir.join('%s.zip' % test)))
             assert zh.open('%s/lib_pypy/syslog.py' % test)

pypy/translator/c/gcc/trackgcroot.py

         'movz', 
         # locked operations should not move GC pointers, at least so far
         'lock', 'pause',
+        # non-temporal moves should be reserved for areas containing
+        # raw data, not GC pointers
+        'movnt', 'mfence', 'lfence', 'sfence',
         ])
 
     # a partial list is hopefully good enough for now; it's all to support

pypy/translator/cli/test/test_float.py

 
     def test_r_singlefloat(self):
         py.test.skip("not implemented: single-precision floats")
+
+    def test_formatd(self):
+        py.test.skip('formatd is broken on ootype')
+
+    def test_formatd_repr(self):
+        py.test.skip('formatd is broken on ootype')
+
+    def test_formatd_huge(self):
+        py.test.skip('formatd is broken on ootype')
+
+    def test_parts_to_float(self):
+        py.test.skip('parts_to_float is broken on ootype')

pypy/translator/jvm/genjvm.py

 import sys
 
 import py
+from pypy.rpython.ootypesystem import ootype
 from pypy.tool.udir import udir
-from pypy.translator.translator import TranslationContext
-from pypy.translator.oosupport.genoo import GenOO
 from pypy.translator.backendopt.all import backend_optimizations
 from pypy.translator.backendopt.checkvirtual import check_virtual_methods
+from pypy.translator.oosupport.genoo import GenOO
+from pypy.translator.translator import TranslationContext
 
+from pypy.translator.jvm.constant import (
+    JVMConstantGenerator, JVMStaticMethodConst, JVMCustomDictConst,
+    JVMWeakRefConst)
+from pypy.translator.jvm.database import Database
 from pypy.translator.jvm.generator import JasminGenerator
-from pypy.translator.jvm.option import getoption
-from pypy.translator.jvm.database import Database
 from pypy.translator.jvm.log import log
 from pypy.translator.jvm.node import EntryPoint, Function
 from pypy.translator.jvm.opcodes import opcodes
-from pypy.rpython.ootypesystem import ootype
-from pypy.translator.jvm.constant import \
-     JVMConstantGenerator, JVMStaticMethodConst, JVMCustomDictConst, \
-     JVMWeakRefConst
+from pypy.translator.jvm.option import getoption
 from pypy.translator.jvm.prebuiltnodes import create_interlink_node
 
 MIN_JAVA_VERSION = '1.6.0'
 
     def __str__(self):
         return "Error code %d running %s" % (self.res, repr(self.args))
-        
+
     def pretty_print(self):
         JvmError.pretty_print(self)
         print "vvv Stdout vvv\n"
         print self.stdout
         print "vvv Stderr vvv\n"
         print self.stderr
-        
+
 
 class JvmGeneratedSource(object):
-    
+
     """
     An object which represents the generated sources. Contains methods
     to find out where they are located, to compile them, and to execute
         self.package = package
         self.compiled = False
         self.jasmin_files = None
-        
+
         # Determine various paths:
         self.thisdir = py.path.local(__file__).dirpath()
         self.rootdir = self.thisdir.join('src')
         self.srcdir = self.rootdir.join('pypy')
         self.jnajar = self.rootdir.join('jna.jar')
-        self.jasminjar = self.rootdir.join('jasmin.jar')        
+        self.jasminjar = self.rootdir.join('jasmin.jar')
 
         # Compute directory where .j files are
         self.javadir = self.tmpdir
         Compiles the .java sources into .class files, ready for execution.
         """
         jascmd = [
-            getoption('java'), 
+            getoption('java'),
+            '-Djava.awt.headless=true',
             '-jar', str(self.jasminjar),
-            '-g', 
-            '-d', 
+            '-g',
+            '-d',
             str(self.javadir)]
 
         def split_list(files):
             #     path_to_jre/java -jar path_to_jasmin/jasmin.jar $*
             # So we limit the length of arguments files to:
             MAXLINE = 1500
-    
+
             chunk = []
             chunklen = 0
             for f in files:
             #print "Invoking jasmin on %s" % files
             self._invoke(jascmd + files, False)
             #print "... completed!"
-                           
+
         self.compiled = True
         self._compile_helper()
 
         strargs = [self._make_str(a) for a in args]
         cmd = [getoption('java'),
                '-Xmx256M', # increase the heapsize so the microbenchmarks run
+               '-Djava.awt.headless=true',
                '-cp',
                str(self.javadir)+os.pathsep+str(self.jnajar),
                self.package+".Main"] + strargs
         return stdout, stderr, retval
 
 def generate_source_for_function(func, annotation, backendopt=False):
-    
+
     """
     Given a Python function and some hints about its argument types,
     generates JVM sources that call it and print the result.  Returns
     the JvmGeneratedSource object.
     """
-    
+
     if hasattr(func, 'im_func'):
         func = func.im_func
     t = TranslationContext()
     generate_source().  *You can not use one of these objects more than
     once.* """
 
-    TypeSystem = lambda X, db: db # TypeSystem and Database are the same object 
+    TypeSystem = lambda X, db: db # TypeSystem and Database are the same object
     Function = Function
     Database = Database
     opcodes = opcodes
     CustomDictConst   = JVMCustomDictConst
     StaticMethodConst = JVMStaticMethodConst
     WeakRefConst = JVMWeakRefConst
-    
+
     def __init__(self, tmpdir, translator, entrypoint):
         """
         'tmpdir' --- where the generated files will go.  In fact, we will
         configuration.  Right now, however, there is only one kind of
         generator: JasminGenerator """
         return JasminGenerator(self.db, self.jvmsrc.javadir)
-        
-        

pypy/translator/jvm/test/test_float.py

 
         res = self.interpret(fn, [1])
         assert res == "10.0"
+
+    def test_formatd(self):
+        py.test.skip('formatd is broken on ootype')
+
+    def test_formatd_repr(self):
+        py.test.skip('formatd is broken on ootype')
+
+    def test_formatd_huge(self):
+        py.test.skip('formatd is broken on ootype')
+
+    def test_parts_to_float(self):
+        py.test.skip('parts_to_float is broken on ootype')