Maciej Fijalkowski avatar Maciej Fijalkowski committed fb4daf6 Merge

merge

Comments (0)

Files changed (47)

 ^rpython/translator/cli/src/pypylib\.dll$
 ^rpython/translator/cli/src/query\.exe$
 ^rpython/translator/cli/src/main\.exe$
+^lib_pypy/__pycache__$
 ^lib_pypy/ctypes_config_cache/_.+_cache\.py$
 ^lib_pypy/ctypes_config_cache/_.+_.+_\.py$
 ^rpython/translator/cli/query-descriptions$

lib-python/conftest.py

 """
 
 test configuration(s) for running CPython's regression
-test suite on top of PyPy 
+test suite on top of PyPy
 
 """
 import py
 import sys
 import pypy
 import re
-from pypy.interpreter.gateway import ApplevelClass 
+from pypy.interpreter.gateway import ApplevelClass
 from pypy.interpreter.error import OperationError
-from pypy.interpreter.module import Module as PyPyModule 
+from pypy.interpreter.module import Module as PyPyModule
 from pypy.interpreter.main import run_string, run_file
 
-# the following adds command line options as a side effect! 
-from pypy.conftest import option as pypy_option 
+# the following adds command line options as a side effect!
+from pypy.conftest import option as pypy_option
 
-from pypy.tool.pytest import appsupport 
+from pypy.tool.pytest import appsupport
 from pypy.tool.pytest.confpath import pypydir, rpythondir, testdir, testresultdir
 from rpython.config.parse import parse_info
 
 pytest_plugins = "resultlog",
 rsyncdirs = ['.', '../pypy/']
 
-# 
-# Interfacing/Integrating with py.test's collection process 
+#
+# Interfacing/Integrating with py.test's collection process
 #
 
 def pytest_addoption(parser):
-    group = parser.getgroup("complicance testing options") 
-    group.addoption('-T', '--timeout', action="store", type="string", 
-       default="1000", dest="timeout", 
-       help="fail a test module after the given timeout. "
-            "specify in seconds or 'NUMmp' aka Mega-Pystones")
-    group.addoption('--pypy', action="store", type="string",
-       dest="pypy",  help="use given pypy executable to run lib-python tests. "
-                          "This will run the tests directly (i.e. not through py.py)")
+    group = parser.getgroup("complicance testing options")
+    group.addoption('-T', '--timeout', action="store", type="string",
+                    default="1000", dest="timeout",
+                    help="fail a test module after the given timeout. "
+                         "specify in seconds or 'NUMmp' aka Mega-Pystones")
+    group.addoption('--pypy', action="store", type="string", dest="pypy",
+                    help="use given pypy executable to run lib-python tests. "
+                         "This will run the tests directly (i.e. not through py.py)")
     group.addoption('--filter', action="store", type="string", default=None,
-                    dest="unittest_filter",  help="Similar to -k, XXX")
+                    dest="unittest_filter", help="Similar to -k, XXX")
 
-def gettimeout(timeout): 
+def gettimeout(timeout):
     from rpython.translator.test import rpystone
-    if timeout.endswith('mp'): 
+    if timeout.endswith('mp'):
         megapystone = float(timeout[:-2])
         t, stone = pystone.Proc0(10000)
-        pystonetime = t/stone 
-        seconds = megapystone  * 1000000 * pystonetime
-        return seconds 
-    return float(timeout) 
+        pystonetime = t/stone
+        seconds = megapystone * 1000000 * pystonetime
+        return seconds
+    return float(timeout)
 
 # ________________________________________________________________________
 #
-# classification of all tests files (this is ongoing work) 
+# classification of all tests files (this is ongoing work)
 #
 
-class RegrTest: 
-    """ Regression Test Declaration.""" 
-    def __init__(self, basename, core=False,
-                                 compiler=None, 
-                                 usemodules = '',
-                                 skip=None): 
-        self.basename = basename 
+class RegrTest:
+    """ Regression Test Declaration."""
+    def __init__(self, basename, core=False, compiler=None, usemodules='',
+                 skip=None):
+        self.basename = basename
         self._usemodules = usemodules.split() + ['signal', 'rctime', 'itertools', '_socket']
-        self._compiler = compiler 
+        self._compiler = compiler
         self.core = core
         self.skip = skip
         assert self.getfspath().check(), "%r not found!" % (basename,)
 
     def usemodules(self):
-        return self._usemodules #+ pypy_option.usemodules
+        return self._usemodules  # + pypy_option.usemodules
     usemodules = property(usemodules)
 
-    def compiler(self): 
-        return self._compiler #or pypy_option.compiler 
+    def compiler(self):
+        return self._compiler  # or pypy_option.compiler
     compiler = property(compiler)
 
-    def ismodified(self): 
+    def ismodified(self):
         #XXX: ask hg
         return None
 
-    def getfspath(self): 
+    def getfspath(self):
         return testdir.join(self.basename)
 
-    def run_file(self, space): 
+    def run_file(self, space):
         fspath = self.getfspath()
         assert fspath.check()
-        modname = fspath.purebasename 
+        modname = fspath.purebasename
         space.appexec([], '''():
             from test import %(modname)s
             m = %(modname)s
     RegrTest('test_textwrap.py'),
     RegrTest('test_thread.py', usemodules="thread", core=True),
     RegrTest('test_threaded_import.py', usemodules="thread", core=True),
-    RegrTest('test_threadedtempfile.py', 
+    RegrTest('test_threadedtempfile.py',
              usemodules="thread", core=False),
     RegrTest('test_threading.py', usemodules="thread", core=True),
     RegrTest('test_threading_local.py', usemodules="thread", core=True),
 
 def pytest_configure(config):
     config._basename2spec = cache = {}
-    for x in testmap: 
+    for x in testmap:
         cache[x.basename] = x
 
 def pytest_collect_file(path, parent, __multicall__):
     return RunFileExternal(path.basename, parent=parent, regrtest=regrtest)
 
 class RunFileExternal(py.test.collect.File):
-    def __init__(self, name, parent, regrtest): 
-        super(RunFileExternal, self).__init__(name, parent) 
-        self.regrtest = regrtest 
+    def __init__(self, name, parent, regrtest):
+        super(RunFileExternal, self).__init__(name, parent)
+        self.regrtest = regrtest
         self.fspath = regrtest.getfspath()
 
-    def collect(self): 
-        if self.regrtest.ismodified(): 
+    def collect(self):
+        if self.regrtest.ismodified():
             name = 'modified'
         else:
             name = 'unmodified'
-        return [ReallyRunFileExternal(name, parent=self)] 
+        return [ReallyRunFileExternal(name, parent=self)]
 
 #
-# testmethod: 
+# testmethod:
 # invoking in a separate process: py.py TESTFILE
 #
 import os
 import time
 import getpass
 
-class ReallyRunFileExternal(py.test.collect.Item): 
+class ReallyRunFileExternal(py.test.collect.Item):
     class ExternalFailure(Exception):
         """Failure in running subprocess"""
 
-    def getinvocation(self, regrtest): 
-        fspath = regrtest.getfspath() 
-        python = sys.executable 
+    def getinvocation(self, regrtest):
+        fspath = regrtest.getfspath()
+        python = sys.executable
         pypy_script = pypydir.join('bin', 'pyinteractive.py')
         alarm_script = pypydir.join('tool', 'alarm.py')
         if sys.platform == 'win32':
             watchdog_name = 'watchdog.py'
         watchdog_script = rpythondir.join('tool', watchdog_name)
 
-        regr_script = pypydir.join('tool', 'pytest', 
+        regr_script = pypydir.join('tool', 'pytest',
                                    'run-script', 'regrverbose.py')
-        
+
         regrrun = str(regr_script)
         option = self.config.option
         TIMEOUT = gettimeout(option.timeout.lower())
             if not execpath.check():
                 execpath = py.path.local.sysfind(option.pypy)
             if not execpath:
-                raise LookupError("could not find executable %r" %
-                                  (option.pypy,))
+                raise LookupError("could not find executable %r" % option.pypy)
 
             # check modules
             info = py.process.cmdexec("%s --info" % execpath)
                 if info.get('objspace.usemodules.%s' % mod) is not True:
                     py.test.skip("%s module not included in %s" % (mod,
                                                                    execpath))
-                    
-            cmd = "%s %s %s" %(
-                execpath, 
-                regrrun, fspath.purebasename)
 
+            cmd = "%s %s %s" % (execpath, regrrun, fspath.purebasename)
             # add watchdog for timing out
-            cmd = "%s %s %s %s" %(
-                python, watchdog_script, TIMEOUT,
-                cmd)
+            cmd = "%s %s %s %s" % (python, watchdog_script, TIMEOUT, cmd)
         else:
             pypy_options = []
             pypy_options.extend(
                 ['--withmod-%s' % mod for mod in regrtest.usemodules])
-            sopt = " ".join(pypy_options) 
-            cmd = "%s %s %d %s -S %s %s %s -v" %(
-                python, alarm_script, TIMEOUT, 
-                pypy_script, sopt, 
+            sopt = " ".join(pypy_options)
+            cmd = "%s %s %d %s -S %s %s %s -v" % (
+                python, alarm_script, TIMEOUT,
+                pypy_script, sopt,
                 regrrun, fspath.purebasename)
-        return cmd 
+        return cmd
 
-    def runtest(self): 
-        """ invoke a subprocess running the test file via PyPy. 
-            record its output into the 'result/user@host' subdirectory. 
-            (we might want to create subdirectories for 
-            each user, because we will probably all produce 
+    def runtest(self):
+        """ invoke a subprocess running the test file via PyPy.
+            record its output into the 'result/user@host' subdirectory.
+            (we might want to create subdirectories for
+            each user, because we will probably all produce
             such result runs and they will not be the same
-            i am afraid. 
-        """ 
+            i am afraid.
+        """
         regrtest = self.parent.regrtest
         if regrtest.skip:
             if regrtest.skip is True:
             else:
                 msg = regrtest.skip
             py.test.skip(msg)
-        (skipped, exit_status, test_stdout,
-                               test_stderr) = self.getresult(regrtest)
+        (skipped, exit_status, test_stdout, test_stderr) = \
+            self.getresult(regrtest)
         if skipped:
             py.test.skip(test_stderr.splitlines()[-1])
         if exit_status:
         out, err = excinfo.value.args
         return out + err
 
-    def getstatusouterr(self, cmd): 
+    def getstatusouterr(self, cmd):
         tempdir = py.test.ensuretemp(self.fspath.basename)
         stdout = tempdir.join(self.fspath.basename) + '.out'
         stderr = tempdir.join(self.fspath.basename) + '.err'
         if sys.platform == 'win32':
-            status = os.system("%s >%s 2>%s" %(cmd, stdout, stderr))
-            if status>=0:
+            status = os.system("%s >%s 2>%s" % (cmd, stdout, stderr))
+            if status >= 0:
                 status = status
             else:
                 status = 'abnormal termination 0x%x' % status
                 stdout.write('')
                 stderr.write('')
             else:
-                status = os.system("%s >>%s 2>>%s" %(cmd, stdout, stderr))
+                status = os.system("%s >>%s 2>>%s" % (cmd, stdout, stderr))
             if os.WIFEXITED(status):
                 status = os.WEXITSTATUS(status)
             else:
                 status = 'abnormal termination 0x%x' % status
         return status, stdout.read(mode='rU'), stderr.read(mode='rU')
 
-    def getresult(self, regrtest): 
+    def getresult(self, regrtest):
         cmd = self.getinvocation(regrtest)
         tempdir = py.test.ensuretemp(self.fspath.basename)
         oldcwd = tempdir.chdir()
         exit_status, test_stdout, test_stderr = self.getstatusouterr(cmd)
         oldcwd.chdir()
         skipped = False
-        timedout = test_stderr.rfind(26*"=" + "timedout" + 26*"=") != -1 
-        if not timedout: 
+        timedout = test_stderr.rfind(26*"=" + "timedout" + 26*"=") != -1
+        if not timedout:
             timedout = test_stderr.rfind("KeyboardInterrupt") != -1
         if test_stderr.rfind(26*"=" + "skipped" + 26*"=") != -1:
             skipped = True
             # test in test_zipimport_support.py
             if re.search(r'\bFAIL\b', test_stdout) or re.search('[^:]ERROR', test_stderr):
                 outcome = 'FAIL'
-                exit_status = 2  
-        elif timedout: 
-            outcome = "T/O"    
-        else: 
+                exit_status = 2
+        elif timedout:
+            outcome = "T/O"
+        else:
             outcome = "ERR"
-        
+
         return skipped, exit_status, test_stdout, test_stderr
 
     def _keywords(self):
         if regrtest.core:
             lst.append('core')
         return lst
-

lib_pypy/_collections.py

 # Note that PyPy also contains a built-in module '_collections' which will hide
 # this one if compiled in.
 
-import operator
 try:
     from threading import _get_ident as _thread_ident
 except ImportError:

lib_pypy/_ctypes/function.py

 import _ffi
 import sys
 import traceback
-import warnings
 
 try: from __pypy__ import builtinify
 except ImportError: builtinify = lambda f: f
             return
 
         if argtypes is None:
-            warnings.warn('C function without declared arguments called',
-                          RuntimeWarning, stacklevel=2)
+            # XXX this warning was originally meaning "it's going to be
+            # really slow".  Now we don't worry that much about slowness
+            # of ctypes, and it's strange to get warnings for perfectly-
+            # legal code.
+            #warnings.warn('C function without declared arguments called',
+            #              RuntimeWarning, stacklevel=2)
             argtypes = []
 
         if self._com_index:
         if not outargs:
             return result
 
+        from ctypes import c_void_p
         simple_cdata = type(c_void_p()).__bases__[0]
         outargs = [x.value if type(x).__bases__[0] is simple_cdata else x
                    for x in outargs]

lib_pypy/_curses.py

     if not lib._m_NetBSD:
         for key in range(lib.KEY_MIN, lib.KEY_MAX):
             key_n = lib.keyname(key)
-            if key_n == ffi.NULL or ffi.string(key_n) == "UNKNOWN KEY":
+            if key_n == ffi.NULL:
                 continue
-            key_n = ffi.string(key_n).replace('(', '').replace(')', '')
+            key_n = ffi.string(key_n)
+            if key_n == b"UNKNOWN KEY":
+                continue
+            key_n = key_n.decode().replace('(', '').replace(')', '')
             globals()[key_n] = key
 
 _setup()

lib_pypy/_pypy_interact.py

 # ____________________________________________________________
 
 if __name__ == '__main__':    # for testing
-    import os
     if os.getenv('PYTHONSTARTUP'):
         execfile(os.getenv('PYTHONSTARTUP'))
     interactive_console()

lib_pypy/_sha512.py

 
 def sha_transform(sha_info):
     W = []
-    
+
     d = sha_info['data']
     for i in xrange(0,16):
         W.append( (d[8*i]<<56) + (d[8*i+1]<<48) + (d[8*i+2]<<40) + (d[8*i+3]<<32) + (d[8*i+4]<<24) + (d[8*i+5]<<16) + (d[8*i+6]<<8) + d[8*i+7])
-    
+
     for i in xrange(16,80):
         W.append( (Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) + W[i - 16]) & 0xffffffffffffffff )
-    
+
     ss = sha_info['digest'][:]
-    
+
     def RND(a,b,c,d,e,f,g,h,i,ki):
         t0 = (h + Sigma1(e) + Ch(e, f, g) + ki + W[i]) & 0xffffffffffffffff
         t1 = (Sigma0(a) + Maj(a, b, c)) & 0xffffffffffffffff
         d = (d + t0) & 0xffffffffffffffff
         h = (t0 + t1) & 0xffffffffffffffff
         return d & 0xffffffffffffffff, h & 0xffffffffffffffff
-    
+
     ss[3], ss[7] = RND(ss[0],ss[1],ss[2],ss[3],ss[4],ss[5],ss[6],ss[7],0,0x428a2f98d728ae22)
     ss[2], ss[6] = RND(ss[7],ss[0],ss[1],ss[2],ss[3],ss[4],ss[5],ss[6],1,0x7137449123ef65cd)
     ss[1], ss[5] = RND(ss[6],ss[7],ss[0],ss[1],ss[2],ss[3],ss[4],ss[5],2,0xb5c0fbcfec4d3b2f)
     ss[6], ss[2] = RND(ss[3],ss[4],ss[5],ss[6],ss[7],ss[0],ss[1],ss[2],77,0x597f299cfc657e2a)
     ss[5], ss[1] = RND(ss[2],ss[3],ss[4],ss[5],ss[6],ss[7],ss[0],ss[1],78,0x5fcb6fab3ad6faec)
     ss[4], ss[0] = RND(ss[1],ss[2],ss[3],ss[4],ss[5],ss[6],ss[7],ss[0],79,0x6c44198c4a475817)
-    
-    
+
     dig = []
     for i, x in enumerate(sha_info['digest']):
         dig.append( (x + ss[i]) & 0xffffffffffffffff )
     if clo < sha_info['count_lo']:
         sha_info['count_hi'] += 1
     sha_info['count_lo'] = clo
-    
+
     sha_info['count_hi'] += (count >> 29)
-    
+
     if sha_info['local']:
         i = SHA_BLOCKSIZE - sha_info['local']
         if i > count:
             i = count
-        
+
         # copy buffer
         for x in enumerate(buffer[buffer_idx:buffer_idx+i]):
             sha_info['data'][sha_info['local']+x[0]] = struct.unpack('B', x[1])[0]
-        
+
         count -= i
         buffer_idx += i
-        
+
         sha_info['local'] += i
         if sha_info['local'] == SHA_BLOCKSIZE:
             sha_transform(sha_info)
             sha_info['local'] = 0
         else:
             return
-    
+
     while count >= SHA_BLOCKSIZE:
         # copy buffer
         sha_info['data'] = [struct.unpack('B',c)[0] for c in buffer[buffer_idx:buffer_idx + SHA_BLOCKSIZE]]
         count -= SHA_BLOCKSIZE
         buffer_idx += SHA_BLOCKSIZE
         sha_transform(sha_info)
-    
-    
+
     # copy buffer
     pos = sha_info['local']
     sha_info['data'][pos:pos+count] = [struct.unpack('B',c)[0] for c in buffer[buffer_idx:buffer_idx + count]]
         sha_info['data'] = [0] * SHA_BLOCKSIZE
     else:
         sha_info['data'] = sha_info['data'][:count] + ([0] * (SHA_BLOCKSIZE - count))
-    
+
     sha_info['data'][112] = 0;
     sha_info['data'][113] = 0;
     sha_info['data'][114] = 0;
     sha_info['data'][117] = 0;
     sha_info['data'][118] = 0;
     sha_info['data'][119] = 0;
-    
+
     sha_info['data'][120] = (hi_bit_count >> 24) & 0xff
     sha_info['data'][121] = (hi_bit_count >> 16) & 0xff
     sha_info['data'][122] = (hi_bit_count >>  8) & 0xff
     sha_info['data'][125] = (lo_bit_count >> 16) & 0xff
     sha_info['data'][126] = (lo_bit_count >>  8) & 0xff
     sha_info['data'][127] = (lo_bit_count >>  0) & 0xff
-    
+
     sha_transform(sha_info)
-    
+
     dig = []
     for i in sha_info['digest']:
         dig.extend([ ((i>>56) & 0xff), ((i>>48) & 0xff), ((i>>40) & 0xff), ((i>>32) & 0xff), ((i>>24) & 0xff), ((i>>16) & 0xff), ((i>>8) & 0xff), (i & 0xff) ])
         self._sha = sha_init()
         if s:
             sha_update(self._sha, getbuf(s))
-    
+
     def update(self, s):
         sha_update(self._sha, getbuf(s))
-    
+
     def digest(self):
         return sha_final(self._sha.copy())[:self._sha['digestsize']]
-    
+
     def hexdigest(self):
         return ''.join(['%.2x' % ord(i) for i in self.digest()])
 
         return new
 
 def test():
+    import _sha512
+
     a_str = "just a test string"
-    
+
     assert _sha512.sha512().hexdigest() == sha512().hexdigest()
     assert _sha512.sha512(a_str).hexdigest() == sha512(a_str).hexdigest()
     assert _sha512.sha512(a_str*7).hexdigest() == sha512(a_str*7).hexdigest()
-    
+
     s = sha512(a_str)
     s.update(a_str)
     assert _sha512.sha512(a_str+a_str).hexdigest() == s.hexdigest()

lib_pypy/_sqlite3.py

 import string
 import sys
 import weakref
-import array
 from threading import _get_ident as _thread_get_ident
 try:
     from __pypy__ import newlist_hint
     const char **pzTail     /* OUT: Pointer to unused portion of zSql */
 );
 
-void sqlite3_result_blob(sqlite3_context*, const char*, int, void(*)(void*));
+void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
 void sqlite3_result_double(sqlite3_context*, double);
 void sqlite3_result_error(sqlite3_context*, const char*, int);
 void sqlite3_result_error16(sqlite3_context*, const void*, int);
         self._reset = False
         self.__locked = False
         self.__closed = False
-        self.__description = None
+        self.__lastrowid = None
         self.__rowcount = -1
 
         con._check_thread()
                 elif typ == _lib.SQLITE_BLOB:
                     blob = _lib.sqlite3_column_blob(self.__statement._statement, i)
                     blob_len = _lib.sqlite3_column_bytes(self.__statement._statement, i)
-                    # make a copy of the data into an array, in order to get
-                    # a read-write buffer in the end, and one that own the
-                    # memory for a more predictable length of time than 'blob'
-                    copy = array.array("c", _ffi.buffer(blob, blob_len))
-                    val = _BLOB_TYPE(copy)
+                    val = _BLOB_TYPE(_ffi.buffer(blob, blob_len)[:])
             row.append(val)
         return tuple(row)
 
         try:
             if not isinstance(sql, basestring):
                 raise ValueError("operation parameter must be str or unicode")
-            self.__description = None
+            try:
+                del self.__description
+            except AttributeError:
+                pass
             self.__rowcount = -1
             self.__statement = self.__connection._statement_cache.get(sql)
 
             if self.__connection._isolation_level is not None:
-                if self.__statement._kind == Statement._DDL:
+                if self.__statement._type in ("UPDATE", "DELETE", "INSERT", "REPLACE"):
+                    if not self.__connection._in_transaction:
+                        self.__connection._begin()
+                elif self.__statement._type == "OTHER":
                     if self.__connection._in_transaction:
                         self.__connection.commit()
-                elif self.__statement._kind == Statement._DML:
-                    if not self.__connection._in_transaction:
-                        self.__connection._begin()
-
-            if multiple and self.__statement._kind != Statement._DML:
-                raise ProgrammingError("executemany is only for DML statements")
+                elif self.__statement._type == "SELECT":
+                    if multiple:
+                        raise ProgrammingError("You cannot execute SELECT "
+                                               "statements in executemany().")
 
             for params in many_params:
                 self.__statement._set_params(params)
                     self.__statement._reset()
                     raise self.__connection._get_exception(ret)
 
-                if self.__statement._kind == Statement._DML:
+                if ret == _lib.SQLITE_ROW:
+                    if multiple:
+                        raise ProgrammingError("executemany() can only execute DML statements.")
+                    self.__build_row_cast_map()
+                    self.__next_row = self.__fetch_one_row()
+                elif ret == _lib.SQLITE_DONE and not multiple:
                     self.__statement._reset()
 
-                if ret == _lib.SQLITE_ROW:
-                    self.__build_row_cast_map()
-                    self.__next_row = self.__fetch_one_row()
-
-                if self.__statement._kind == Statement._DML:
+                if self.__statement._type in ("UPDATE", "DELETE", "INSERT", "REPLACE"):
                     if self.__rowcount == -1:
                         self.__rowcount = 0
                     self.__rowcount += _lib.sqlite3_changes(self.__connection._db)
+
+                if not multiple and self.__statement._type == "INSERT":
+                    self.__lastrowid = _lib.sqlite3_last_insert_rowid(self.__connection._db)
+                else:
+                    self.__lastrowid = None
+
+                if multiple:
+                    self.__statement._reset()
         finally:
             self.__connection._in_transaction = \
                 not _lib.sqlite3_get_autocommit(self.__connection._db)
     rowcount = property(__get_rowcount)
 
     def __get_description(self):
-        if self.__description is None:
+        try:
+            return self.__description
+        except AttributeError:
             self.__description = self.__statement._get_description()
-        return self.__description
+            return self.__description
     description = property(__get_description)
 
     def __get_lastrowid(self):
-        return _lib.sqlite3_last_insert_rowid(self.__connection._db)
+        return self.__lastrowid
     lastrowid = property(__get_lastrowid)
 
     def setinputsizes(self, *args):
 
 
 class Statement(object):
-    _DML, _DQL, _DDL = range(3)
-
     _statement = None
 
     def __init__(self, connection, sql):
 
         if not isinstance(sql, basestring):
             raise Warning("SQL is of wrong type. Must be string or unicode.")
-        first_word = self._statement_kind = sql.lstrip().split(" ")[0].upper()
-        if first_word in ("INSERT", "UPDATE", "DELETE", "REPLACE"):
-            self._kind = Statement._DML
-        elif first_word in ("SELECT", "PRAGMA"):
-            self._kind = Statement._DQL
+
+        first_word = sql.lstrip().split(" ")[0].upper()
+        if first_word == "":
+            self._type = "INVALID"
+        elif first_word in ("SELECT", "INSERT", "UPDATE", "DELETE", "REPLACE"):
+            self._type = first_word
         else:
-            self._kind = Statement._DDL
+            self._type = "OTHER"
 
         if isinstance(sql, unicode):
             sql = sql.encode('utf-8')
 
         if ret == _lib.SQLITE_OK and not self._statement:
             # an empty statement, work around that, as it's the least trouble
+            self._type = "SELECT"
             c_sql = _ffi.new("char[]", b"select 42")
             ret = _lib.sqlite3_prepare_v2(self.__con._db, c_sql, -1,
                                           statement_star, next_char)
             self._statement = statement_star[0]
-            self._kind = Statement._DQL
+
         if ret != _lib.SQLITE_OK:
             raise self.__con._get_exception(ret)
 
             raise ValueError("parameters are of unsupported type")
 
     def _get_description(self):
-        if self._kind == Statement._DML:
+        if self._type in ("INSERT", "UPDATE", "DELETE", "REPLACE"):
             return None
         desc = []
         for i in xrange(_lib.sqlite3_column_count(self._statement)):
         elif typ == _lib.SQLITE_BLOB:
             blob = _lib.sqlite3_value_blob(params[i])
             blob_len = _lib.sqlite3_value_bytes(params[i])
-            val = _BLOB_TYPE(_ffi.buffer(blob, blob_len))
+            val = _BLOB_TYPE(_ffi.buffer(blob, blob_len)[:])
         else:
             raise NotImplementedError
         _params.append(val)
             'c': os.O_RDWR | os.O_CREAT,
             'n': os.O_RDWR | os.O_CREAT | os.O_TRUNC,
             }[flag]
-    except KeyError, e:
+    except KeyError:
         raise error("arg 2 to open should be 'r', 'w', 'c', or 'n'")
 
     a_db = getattr(lib, funcs['open'])(filename, openflag, mode)

lib_pypy/greenlet.py

-import _continuation, sys
+import _continuation
 
 __version__ = "0.4.0"
 
Add a comment to this file

pypy/doc/whatsnew-2.0.0-beta1.rst

File contents unchanged.

pypy/doc/whatsnew-head.rst

 .. branch: remove-list-smm
 .. branch: bridge-logging
 .. branch: curses_cffi
-
 cffi implementation of _curses
 
 .. branch: sqlite-cffi
+cffi implementation of sqlite3
 
-cffi implementation of sqlite3
+.. branch: release-2.0-beta2

pypy/interpreter/astcompiler/misc.py

 from pypy.interpreter import gateway
-from pypy.interpreter.astcompiler import ast
 from rpython.rlib.objectmodel import we_are_translated
 from rpython.rlib.unroll import unrolling_iterable
 
 
 
 def parse_future(tree, feature_flags):
+    from pypy.interpreter.astcompiler import ast
     future_lineno = 0
     future_column = 0
     flags = 0
     return lookup
 
 
-MANGLE_LEN = 256 # magic constant from compile.c
-
 def mangle(name, klass):
     if not name.startswith('__'):
         return name
-    if len(name) + 2 >= MANGLE_LEN:
-        return name
     # Don't mangle __id__ or names with dots. The only time a name with a dot
     # can occur is when we are compiling an import statement that has a package
     # name.
             i = i + 1
     except IndexError:
         return name
-    klass = klass[i:]
-
-    tlen = len(klass) + len(name)
-    if tlen > MANGLE_LEN:
-        end = len(klass) + MANGLE_LEN-tlen
-        if end < 0:
-            klass = ''     # slices of negative length are invalid in RPython
-        else:
-            klass = klass[:end]
-
-    return "_%s%s" % (klass, name)
+    return "_%s%s" % (klass[i:], name)

pypy/interpreter/astcompiler/test/test_misc.py

+from pypy.interpreter.astcompiler.misc import mangle
+
+def test_mangle():
+    assert mangle("foo", "Bar") == "foo"
+    assert mangle("__foo__", "Bar") == "__foo__"
+    assert mangle("foo.baz", "Bar") == "foo.baz"
+    assert mangle("__", "Bar") == "__"
+    assert mangle("___", "Bar") == "___"
+    assert mangle("____", "Bar") == "____"
+    assert mangle("__foo", "Bar") == "_Bar__foo"
+    assert mangle("__foo", "_Bar") == "_Bar__foo"
+    assert mangle("__foo", "__Bar") == "_Bar__foo"
+    assert mangle("__foo", "___") == "__foo"
+    assert mangle("___foo", "__Bar") == "_Bar___foo"
Add a comment to this file

pypy/module/_minimal_curses/__init__.py

File contents unchanged.

Add a comment to this file

pypy/module/_minimal_curses/fficurses.py

File contents unchanged.

Add a comment to this file

pypy/module/_minimal_curses/interp_curses.py

File contents unchanged.

Add a comment to this file

pypy/module/_minimal_curses/test/test_curses.py

File contents unchanged.

pypy/module/_socket/test/test_sock_app.py

 
 def test_unknown_addr_as_object():
     from pypy.module._socket.interp_socket import addr_as_object
-    c_addr = lltype.malloc(rsocket._c.sockaddr, flavor='raw')
+    c_addr = lltype.malloc(rsocket._c.sockaddr, flavor='raw', track_allocation=False)
     c_addr.c_sa_data[0] = 'c'
     rffi.setintfield(c_addr, 'c_sa_family', 15)
     # XXX what size to pass here? for the purpose of this test it has

pypy/module/cpyext/include/patchlevel.h

 #define PY_VERSION		"2.7.3"
 
 /* PyPy version as a string */
-#define PYPY_VERSION "2.0.0-beta1"
+#define PYPY_VERSION "2.0.0-beta2"
 
 /* Subversion Revision number of this file (not of the repository).
  * Empty since Mercurial migration. */

pypy/module/sys/version.py

 #XXX # sync CPYTHON_VERSION with patchlevel.h, package.py
 CPYTHON_API_VERSION        = 1013   #XXX # sync with include/modsupport.h
 
-PYPY_VERSION               = (2, 0, 0, "beta", 1)    #XXX # sync patchlevel.h
+PYPY_VERSION               = (2, 0, 0, "beta", 2)    #XXX # sync patchlevel.h
 
 if platform.name == 'msvc':
     COMPILER_INFO = 'MSC v.%d 32 bit' % (platform.version * 10 + 600)

pypy/module/test_lib_pypy/ctypes_tests/test_functions.py

         assert seen == ["yadda"]
 
     def test_warnings(self):
+        py.test.skip("warnings are disabled")
         import warnings
         warnings.simplefilter("always")
         with warnings.catch_warnings(record=True) as w:

pypy/module/test_lib_pypy/test_sqlite3.py

 """Tests for _sqlite3.py"""
 
-import sys
+import pytest, sys
+
 if sys.version_info < (2, 7):
-    skip("lib_pypy._sqlite3 doesn't work with python < 2.7")
+    pytest.skip("_sqlite3 requires Python 2.7")
+try:
+    import _cffi_backend
+except ImportError:
+    # On CPython, "pip install cffi".  On old PyPy's, no chance
+    pytest.skip("_sqlite3 requires _cffi_backend to be installed")
 
-import pytest
 from lib_pypy import _sqlite3
 
-def test_list_ddl():
+def pytest_funcarg__con(request):
+    con = _sqlite3.connect(':memory:')
+    request.addfinalizer(lambda: con.close())
+    return con
+
+def test_list_ddl(con):
     """From issue996.  Mostly just looking for lack of exceptions."""
-    connection = _sqlite3.connect(':memory:')
-    cursor = connection.cursor()
+    cursor = con.cursor()
     cursor.execute('CREATE TABLE foo (bar INTEGER)')
     result = list(cursor)
     assert result == []
     result = list(cursor)
     assert result == [(42,)]
 
-def test_total_changes_after_close():
-    con = _sqlite3.connect(':memory:')
+def test_total_changes_after_close(con):
     con.close()
     pytest.raises(_sqlite3.ProgrammingError, "con.total_changes")
 
     e = pytest.raises(_sqlite3.ProgrammingError, "con.cursor()")
     assert '__init__' in e.value.message
 
-def test_cursor_check_init():
+def test_cursor_check_init(con):
     class Cursor(_sqlite3.Cursor):
         def __init__(self, name):
             pass
 
-    con = _sqlite3.connect(":memory:")
     cur = Cursor(con)
     e = pytest.raises(_sqlite3.ProgrammingError, "cur.execute('select 1')")
     assert '__init__' in e.value.message
 
-def test_connection_after_close():
-    con = _sqlite3.connect(':memory:')
+def test_connection_after_close(con):
     pytest.raises(TypeError, "con()")
     con.close()
     # raises ProgrammingError because should check closed before check args
     pytest.raises(_sqlite3.ProgrammingError, "con()")
 
-def test_cursor_iter():
-    con = _sqlite3.connect(':memory:')
+def test_cursor_iter(con):
     cur = con.cursor()
     with pytest.raises(StopIteration):
         next(cur)
     with pytest.raises(StopIteration):
         next(cur)
 
-def test_cursor_after_close():
-     con = _sqlite3.connect(':memory:')
+def test_cursor_after_close(con):
      cur = con.execute('select 1')
      cur.close()
      con.close()
     finally:
         resource.setrlimit(resource.RLIMIT_NOFILE, limit)
 
-def test_on_conflict_rollback_executemany():
+def test_on_conflict_rollback_executemany(con):
     major, minor, micro = _sqlite3.sqlite_version.split('.')
     if (int(major), int(minor), int(micro)) < (3, 2, 2):
         pytest.skip("requires sqlite3 version >= 3.2.2")
-    con = _sqlite3.connect(":memory:")
     con.execute("create table foo(x, unique(x) on conflict rollback)")
     con.execute("insert into foo(x) values (1)")
     try:
         con.commit()
     except _sqlite3.OperationalError:
         pytest.fail("_sqlite3 knew nothing about the implicit ROLLBACK")
-    con.close()
 
-def test_statement_arg_checking():
-    con = _sqlite3.connect(':memory:')
+def test_statement_arg_checking(con):
     with pytest.raises(_sqlite3.Warning) as e:
         con(123)
     assert str(e.value) == 'SQL is of wrong type. Must be string or unicode.'
         con.executescript(123)
     assert str(e.value) == 'script argument must be unicode or string.'
 
-def test_statement_param_checking():
-    con = _sqlite3.connect(':memory:')
+def test_statement_param_checking(con):
     con.execute('create table foo(x)')
     con.execute('insert into foo(x) values (?)', [2])
     con.execute('insert into foo(x) values (?)', (2,))
     with pytest.raises(ValueError) as e:
         con.execute('insert into foo(x) values (?)', 2)
     assert str(e.value) == 'parameters are of unsupported type'
-    con.close()
 
-def test_explicit_begin():
-    con = _sqlite3.connect(':memory:')
+def test_explicit_begin(con):
     con.execute('BEGIN')
     con.execute('BEGIN ')
     con.execute('BEGIN')
     con.execute('BEGIN')
     con.commit()
 
-def test_row_factory_use():
-    con = _sqlite3.connect(':memory:')
+def test_row_factory_use(con):
     con.row_factory = 42
     con.execute('select 1')
 
-def test_returning_blob_must_own_memory():
+def test_returning_blob_must_own_memory(con):
     import gc
-    con = _sqlite3.connect(":memory:")
     con.create_function("returnblob", 0, lambda: buffer("blob"))
-    cur = con.cursor()
-    cur.execute("select returnblob()")
+    cur = con.execute("select returnblob()")
     val = cur.fetchone()[0]
     for i in range(5):
         gc.collect()
         got = (val[0], val[1], val[2], val[3])
         assert got == ('b', 'l', 'o', 'b')
+    # in theory 'val' should be a read-write buffer
+    # but it's not right now
+    pytest.skip("in theory 'val' should be a read-write buffer")
+    val[1] = 'X'
+    got = (val[0], val[1], val[2], val[3])
+    assert got == ('b', 'X', 'o', 'b')
 
-def test_description_after_fetchall():
-    con = _sqlite3.connect(":memory:")
+def test_description_after_fetchall(con):
     cur = con.cursor()
     cur.execute("select 42").fetchall()
     assert cur.description is not None
+
+def test_executemany_lastrowid(con):
+    cur = con.cursor()
+    cur.execute("create table test(a)")
+    cur.executemany("insert into test values (?)", [[1], [2], [3]])
+    assert cur.lastrowid is None

pypy/objspace/std/typeobject.py

 from pypy.interpreter.function import Function, StaticMethod
 from pypy.interpreter.typedef import weakref_descr, GetSetProperty,\
      descr_get_dict
+from pypy.interpreter.astcompiler.misc import mangle
 from pypy.objspace.std.model import W_Object
 from pypy.objspace.std.register_all import register_all
 from pypy.objspace.std.stdtypedef import std_dict_descr, issubtypedef, Member
         return w_value.w_value
     return w_value
 
-# from compiler/misc.py
-
-MANGLE_LEN = 256 # magic constant from compile.c
-
-def _mangle(name, klass):
-    if not name.startswith('__'):
-        return name
-    if len(name) + 2 >= MANGLE_LEN:
-        return name
-    if name.endswith('__'):
-        return name
-    try:
-        i = 0
-        while klass[i] == '_':
-            i = i + 1
-    except IndexError:
-        return name
-    klass = klass[i:]
-
-    tlen = len(klass) + len(name)
-    if tlen > MANGLE_LEN:
-        end = len(klass) + MANGLE_LEN-tlen
-        if end < 0:
-            klass = ''     # annotator hint
-        else:
-            klass = klass[:end]
-
-    return "_%s%s" % (klass, name)
 
 class VersionTag(object):
     pass
         raise OperationError(space.w_TypeError,
                              space.wrap('__slots__ must be identifiers'))
     # create member
-    slot_name = _mangle(slot_name, w_self.name)
+    slot_name = mangle(slot_name, w_self.name)
     if slot_name not in w_self.dict_w:
         # Force interning of slot names.
         slot_name = space.str_w(space.new_interned_str(slot_name))

pypy/tool/release/package.py

                 'Bogus path: %r does not exist (see docstring for more info)'
                 % (os.path.dirname(str(pypy_c)),))
     subprocess.check_call([str(pypy_c), '-c', 'import _sqlite3'])
-    subprocess.check_call([str(pypy_c), '-c', 'import _curses'])
+    if not sys.platform == 'win32':
+        subprocess.check_call([str(pypy_c), '-c', 'import _curses'])
     if sys.platform == 'win32' and not rename_pypy_c.lower().endswith('.exe'):
         rename_pypy_c += '.exe'
     binaries = [(pypy_c, rename_pypy_c)]

pypy/tool/release/test/test_package.py

         exe_name_in_archive = 'bin/pypy'
     pypy_c = py.path.local(pypydir).join('goal', basename)
     if not pypy_c.check():
-        os.system("echo faked_pypy_c> %s" % (pypy_c,))
+        pypy_c.write("#!/bin/sh")
         pypy_c.chmod(0755)
         fake_pypy_c = True
     else:

pypy/tool/test/test_tab.py

 import os
 from pypy.conftest import pypydir
 
-ROOT = pypydir
+ROOT = os.path.abspath(os.path.join(pypydir, '..'))
 EXCLUDE = {}
 
 

rpython/flowspace/framestate.py

 from rpython.rlib.unroll import SpecTag
 
 
-class FrameState:
+class FrameState(object):
     def __init__(self, mergeable, blocklist, next_instr):
         self.mergeable = mergeable
         self.blocklist = blocklist
 class UnionError(Exception):
     "The two states should be merged."
 
+
 def union(w1, w2):
     "Union of two variables or constants."
     if w1 is None or w2 is None:
             key = unroller.__class__, len(vars)
             try:
                 tag = PICKLE_TAGS[key]
-            except:
+            except KeyError:
                 tag = PICKLE_TAGS[key] = Constant(PickleTag())
                 UNPICKLE_TAGS[tag] = key
             lst[i:i + 1] = [tag] + vars
Add a comment to this file

rpython/jit/backend/arm/arch.py

File contents unchanged.

rpython/jit/backend/arm/assembler.py

             self._restore_exception(mc, exc0, exc1)
             mc.VPOP([vfpr.value for vfpr in r.caller_vfp_resp])
             assert exc0 is not None
-	    assert exc1 is not None
+            assert exc1 is not None
             mc.POP([gpr.value for gpr in r.caller_resp] +
                             [exc0.value, exc1.value])
         #
             self.gen_shadowstack_header(gcrootmap)
 
     def gen_shadowstack_header(self, gcrootmap):
-        # we need to put two words into the shadowstack: the MARKER_FRAME
-        # and the address of the frame (fp, actually)
-        # lr = rst addr
+        # lr = shadow stack top addr
         # ip = *lr
         rst = gcrootmap.get_root_stack_top_addr()
         self.mc.gen_load_int(r.lr.value, rst)
             self.mc.PUSH([helper.value], cond=cond)
         self.load_reg(self.mc, loc, r.fp, offset, cond=cond, helper=helper)
         if save_helper:
-	    self.mc.POP([helper.value], cond=cond)
-
+            self.mc.POP([helper.value], cond=cond)
 
     def _mov_imm_float_to_loc(self, prev_loc, loc, cond=c.AL):
         if loc.is_vfp_reg():
Add a comment to this file

rpython/jit/backend/arm/codebuilder.py

File contents unchanged.

rpython/jit/backend/arm/opassembler.py

                                     bool(self._regalloc.vfprm.reg_bindings))
             assert self.wb_slowpath[helper_num] != 0
         #
-        if not is_frame and loc_base is not r.r0:
+        if loc_base is not r.r0:
             # push two registers to keep stack aligned
             mc.PUSH([r.r0.value, loc_base.value])
-            remap_frame_layout(self, [loc_base], [r.r0], r.ip)
+            mc.MOV_rr(r.r0.value, loc_base.value)
+            if is_frame:
+                assert loc_base is r.fp
         mc.BL(self.wb_slowpath[helper_num])
-        if not is_frame and loc_base is not r.r0:
+        if loc_base is not r.r0:
             mc.POP([r.r0.value, loc_base.value])
 
         if card_marking:
Add a comment to this file

rpython/jit/backend/arm/regalloc.py

File contents unchanged.

rpython/jit/backend/arm/runner.py

     """ARM v7 uses hardfp ABI, requires vfp"""
     hf_abi = True
     backend_name = "armv7hf"
-    supports_floats = False
+    supports_floats = True
     supports_singlefloats = False
 
 
     hf_abi = True
     arch_version = 6
     backend_name = "armv6hf"
-    supports_floats = False
+    supports_floats = True
     supports_singlefloats = False

rpython/jit/backend/arm/test/test_calling_convention.py

         callargs = []
         def func(f0, f1, f2, f3, f4, f5, f6, i0, f7, i1, f8, f9):
             callargs.append(zip(range(12),
-			[f0, f1, f2, f3, f4, f5, f6, i0, f7, i1, f8, f9]))
+                        [f0, f1, f2, f3, f4, f5, f6, i0, f7, i1, f8, f9]))
             return f0 + f1 + f2 + f3 + f4 + f5 + f6 + float(i0 + i1) + f7 + f8 + f9
         F = lltype.Float
         I = lltype.Signed
         callargs = []
         def func(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9):
             callargs.append(zip(range(10),
-			[f0, f1, f2, f3, f4, f5, f6, f7, f8, f9]))
+                        [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9]))
             return f0 + f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9
         F = lltype.Float
         FUNC = self.FuncType([F] * 10, F)
         callargs = []
         def func(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9):
             callargs.append(zip(range(10),
-			[f0, f1, f2, f3, f4, f5, f6, f7, f8, f9]))
+                        [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9]))
             return f0 + f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9
 
         I = lltype.Signed
Add a comment to this file

rpython/jit/backend/arm/test/test_float.py

File contents unchanged.

rpython/jit/backend/arm/test/test_runner.py

     else:
         bridge_loop_instructions = ['ldr', 'mov', 'nop', 'nop', 'nop', 'cmp', 'bge',
                               'push', 'ldr', 'mov',
-                              '', # inline constant
+                              '*', # inline constant
                               'push', 'ldr', 'mov',
-                              'ldrsblt', #inline constant (decodes as instruction)
+                              '*', # inline constant
                               'blx', 'ldr', 'mov',
-                              '', # inline constant
+                              '*', # inline constant
                               'bx']
 
     def get_cpu(self):

rpython/jit/backend/llsupport/test/test_gc_integration.py

             if self.cpu.IS_64_BIT:
                 assert frame.jf_gcmap[idx] == (1<<29) | (1 << 30)
             else:
-                assert frame.jf_gcmap[idx] == (1<<24) | (1 << 23)
+                assert frame.jf_gcmap[idx]
+                exp_idx = self.cpu.JITFRAME_FIXED_SIZE - 32 * idx + 1 # +1 from i0
+                assert frame.jf_gcmap[idx] == (1 << (exp_idx + 1)) | (1 << exp_idx)
 
         self.cpu = self.getcpu(check)
         ops = '''
 
         def f(frame, x):
             # all the gc pointers are alive p1 -> p7 (but not p0)
-            assert bin(frame.jf_gcmap[0]).count('1') == 7
+            assert getmap(frame).count('1') == 7 #
             assert x == 1
             return 2
         
         def f(frame, arg, x):
             assert not arg
             assert frame.jf_gcmap[0] & 31 == 0
-            assert bin(frame.jf_gcmap[0]).count('1') == 3 # p1, p2, p3, but
+            assert getmap(frame).count('1') == 3 # p1, p2, p3, but
             # not in registers
             frame.jf_descr = frame.jf_force_descr # make guard_not_forced fail
             assert x == 1
         cpu.compile_loop(loop.inputargs, loop.operations, token)
         frame = lltype.cast_opaque_ptr(JITFRAMEPTR,
                                        cpu.execute_token(token, 1, a))
-        assert bin(frame.jf_gcmap[0]).count('1') == 4
+        
+        assert getmap(frame).count('1') == 4
 
     def test_call_gcmap_no_guard(self):
         cpu = self.cpu
         def f(frame, arg, x):
             assert not arg
             assert frame.jf_gcmap[0] & 31 == 0
-            assert bin(frame.jf_gcmap[0]).count('1') == 3 # p1, p2, p3
+            assert getmap(frame).count('1') == 3 # p1, p2, p3
             frame.jf_descr = frame.jf_force_descr # make guard_not_forced fail
             assert x == 1
             return lltype.nullptr(llmemory.GCREF.TO)
         cpu.compile_loop(loop.inputargs, loop.operations, token)
         frame = lltype.cast_opaque_ptr(JITFRAMEPTR,
                                        cpu.execute_token(token, 1, a))
-        assert bin(frame.jf_gcmap[0]).count('1') == 4
+        assert getmap(frame).count('1') == 4
+

rpython/jit/backend/test/calling_convention_test.py

 
     def test_call_aligned_explicit_check(self):
         if (not platform.machine().startswith('arm') and
-		sys.maxint == 2 ** 31 - 1): # XXX is still necessary on x86?
+                sys.maxint == 2 ** 31 - 1): # XXX is still necessary on x86?
             py.test.skip("libffi on 32bit is broken")
         cpu = self.cpu
         if not cpu.supports_floats:

rpython/jit/backend/test/runner_test.py

         def checkops(mc, ops):
             assert len(mc) == len(ops)
             for i in range(len(mc)):
+                if ops[i] == '*':
+                    continue # ingore ops marked as '*', i.e. inline constants
                 assert mc[i].split("\t")[2].startswith(ops[i])
 
         data = ctypes.string_at(info.asmaddr, info.asmlen)

rpython/jit/backend/x86/runner.py

         self.assembler = Assembler386(self, self.translate_support_code)
 
     def build_regalloc(self):
-	''' for tests'''
-	from rpython.jit.backend.x86.regalloc import RegAlloc
-	assert self.assembler is not None
-	return RegAlloc(self.assembler, False)
+        ''' for tests'''
+        from rpython.jit.backend.x86.regalloc import RegAlloc
+        assert self.assembler is not None
+        return RegAlloc(self.assembler, False)
 
     def setup_once(self):
         self.profile_agent.startup()

rpython/jit/metainterp/optimizeopt/rewrite.py

                                       [op.getarg(1),
                                        ConstInt(index + source_start)], resbox,
                                        descr=arraydescr)
-                    self.optimizer.propagate_forward(newop)
+                    self.optimizer.send_extra_operation(newop)
                     val = self.getvalue(resbox)
                 if dest_value.is_virtual():
                     dest_value.setitem(index + dest_start, val)

rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py

         self.optimize_loop(ops, expected)
 
     def test_add_sub_ovf_second_operation_regular(self):
-	py.test.skip("Smalltalk would like this to pass")
-	# This situation occurs in Smalltalk because it uses 1-based indexing.
-	# The below code is equivalent to a loop over an array.
+        py.test.skip("Smalltalk would like this to pass")
+        # This situation occurs in Smalltalk because it uses 1-based indexing.
+        # The below code is equivalent to a loop over an array.
         ops = """
         [i1]
         i2 = int_sub(i1, 1)
         """
         self.optimize_loop(ops, ops)
 
+    def test_setarrayitem_followed_by_arraycopy_2(self):
+        ops = """
+        [i1, i2]
+        p1 = new_array(i1, descr=arraydescr)
+        setarrayitem_gc(p1, 0, i2, descr=arraydescr)
+        p3 = new_array(5, descr=arraydescr)
+        call(0, p1, p3, 0, 1, 1, descr=arraycopydescr)
+        i4 = getarrayitem_gc(p3, 1, descr=arraydescr)
+        jump(i1, i4)
+        """
+        expected = """
+        [i1, i2]
+        # operations are not all removed because this new_array() is var-sized
+        p1 = new_array(i1, descr=arraydescr)
+        setarrayitem_gc(p1, 0, i2, descr=arraydescr)
+        jump(i1, i2)
+        """
+        self.optimize_loop(ops, expected)
+
     def test_heap_cache_virtuals_forced_by_delayed_setfield(self):
         py.test.skip('not yet supoprted')
         ops = """

rpython/jit/tl/tla/tla_assembler.py

 
 import sys
 import py
+from rpython.jit.tl.tla.test_tla import assemble
 py.path.local(__file__)
-from rpython.jit.tl.tla.test_tla import assemble
 
 def usage():
     print >> sys.stderr, 'Usage: tla_assembler.py filename.tla.py'

rpython/rtyper/lltypesystem/lltype.py

         return obj
 
     def __init__(self, OF, length, **kwds):
-        if hasattr(self, '_name'):
+        if '_name' in self.__dict__:
             assert self.OF == OF
             assert self.length == length
             return

rpython/translator/platform/arm.py

         return ExecutionResult(returncode, stdout, stderr)
 
     def include_dirs_for_libffi(self):
-        return [SB2 + '/usr/include/arm-linux-gnueabi/']
+        return [SB2 + '/usr/include/arm-linux-gnueabi/',
+                SB2 + '/usr/include/arm-linux-gnueabihf/']
 
     def library_dirs_for_libffi(self):
-        # on the other hand, library lands in usual place...
-        return []
+        return [SB2 + '/usr/lib/arm-linux-gnueabi/',
+                SB2 + '/usr/lib/arm-linux-gnueabihf/']
 
     def execute_makefile(self, path_to_makefile, extra_opts=[]):
         if isinstance(path_to_makefile, GnuMakefile):
Add a comment to this file

rpython/translator/platform/darwin.py

File contents unchanged.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.