Commits

Amaury Forgeot d'Arc committed 70eb63c Merge

Merge default

  • Participants
  • Parent commits d7a6c72, 5c272f6
  • Branches move-rfloat

Comments (0)

Files changed (39)

+.hg
+.svn
+
+*.pyc
+*.pyo
+*~
+
+bin/pypy-c
+include/*.h
+lib_pypy/ctypes_config_cache/_[^_]*_*.py
+pypy/_cache
+pypy/translator/goal/pypy-c
+pypy/translator/goal/target*-c
+release/
 ^pypy/doc/image/stackless_informal\.png$
 ^pypy/doc/image/parsing_example.+\.png$
 ^compiled
+^.git/
+^release/
     names = csv.list_dialects()"""
     return list(_dialects)
 
-class Reader:
-
+class Reader(object):
     """CSV reader
 
     Reader objects are responsible for reading and parsing tabular data
         self._parse_reset()
 
     def _parse_reset(self):
-        self.field = []
+        self.field = ''
         self.fields = []
         self.state = self.START_RECORD
         self.numeric_field = False
 
             self.line_num += 1
 
-            for c in line:
-                if c == '\0':
-                    raise Error("line contains NULL byte")
-                self._parse_process_char(c)
-            self._parse_process_char('\0')
+            if '\0' in line:
+                raise Error("line contains NULL byte")
+            pos = 0
+            while pos < len(line):
+                pos = self._parse_process_char(line, pos)
+            self._parse_eol()
 
             if self.state == self.START_RECORD:
                 break
         self.fields = []
         return fields
             
-    def _parse_process_char(self, c):
+    def _parse_process_char(self, line, pos):
+        c = line[pos]
         if self.state == self.IN_FIELD:
             # in unquoted field
-            if c in ('\n', '\r', '\0'):
-                # end of line - return [fields]
-                self._parse_save_field()
-                if c == '\0':
-                    self.state = self.START_RECORD
+            pos2 = pos
+            while True:
+                if c in '\n\r':
+                    # end of line - return [fields]
+                    if pos2 > pos:
+                        self._parse_add_char(line[pos:pos2])
+                        pos = pos2
+                    self._parse_save_field()
+                    self.state = self.EAT_CRNL
+                elif c == self.dialect.escapechar:
+                    # possible escaped character
+                    pos2 -= 1
+                    self.state = self.ESCAPED_CHAR
+                elif c == self.dialect.delimiter:
+                    # save field - wait for new field
+                    if pos2 > pos:
+                        self._parse_add_char(line[pos:pos2])
+                        pos = pos2
+                    self._parse_save_field()
+                    self.state = self.START_FIELD
                 else:
-                    self.state = self.EAT_CRNL
-            elif c == self.dialect.escapechar:
-                # possible escaped character
-                self.state = self.ESCAPED_CHAR
-            elif c == self.dialect.delimiter:
-                # save field - wait for new field
-                self._parse_save_field()
-                self.state = self.START_FIELD
-            else:
-                # normal character - save in field
-                self._parse_add_char(c)
-                
+                    # normal character - save in field
+                    pos2 += 1
+                    if pos2 < len(line):
+                        c = line[pos2]
+                        continue
+                break
+            if pos2 > pos:
+                self._parse_add_char(line[pos:pos2])
+                pos = pos2 - 1
+
         elif self.state == self.START_RECORD:
-            if c == '\0':
-                # empty line - return []
-                pass
-            elif c in ('\n', '\r'):
+            if c in '\n\r':
                 self.state = self.EAT_CRNL
             else:
                 self.state = self.START_FIELD
                 # restart process
-                self._parse_process_char(c)
+                self._parse_process_char(line, pos)
 
         elif self.state == self.START_FIELD:
-            if c in ('\n', '\r', '\0'):
+            if c in '\n\r':
                 # save empty field - return [fields]
                 self._parse_save_field()
-                if c == '\0':
-                    self.state = self.START_RECORD
-                else:
-                    self.state = self.EAT_CRNL
+                self.state = self.EAT_CRNL
             elif (c == self.dialect.quotechar
                   and self.dialect.quoting != QUOTE_NONE):
                 # start quoted field
                 self.state = self.IN_FIELD
         
         elif self.state == self.ESCAPED_CHAR:
-            if c == '\0':
-                c = '\n'
             self._parse_add_char(c)
             self.state = self.IN_FIELD
         
         elif self.state == self.IN_QUOTED_FIELD:
-            if c == '\0':
-                pass
-            elif c == self.dialect.escapechar:
+            if c == self.dialect.escapechar:
                 # possible escape character
                 self.state = self.ESCAPE_IN_QUOTED_FIELD
             elif (c == self.dialect.quotechar
                 self._parse_add_char(c)
                 
         elif self.state == self.ESCAPE_IN_QUOTED_FIELD:
-            if c == '\0':
-                c = '\n'
             self._parse_add_char(c)
             self.state = self.IN_QUOTED_FIELD
                 
                 # save field - wait for new field
                 self._parse_save_field()
                 self.state = self.START_FIELD
-            elif c in ('\r', '\n', '\0'):
+            elif c in '\r\n':
                 # end of line - return [fields]
                 self._parse_save_field()
-                if c == '\0':
-                    self.state = self.START_RECORD
-                else:
-                    self.state = self.EAT_CRNL
+                self.state = self.EAT_CRNL
             elif not self.dialect.strict:
                 self._parse_add_char(c)
                 self.state = self.IN_FIELD
                             (self.dialect.delimiter, self.dialect.quotechar))
 
         elif self.state == self.EAT_CRNL:
-            if c in ('\r', '\n'):
+            if c in '\r\n':
                 pass
-            elif c == '\0':
-                self.state = self.START_RECORD
             else:
                 raise Error("new-line character seen in unquoted field - "
                             "do you need to open the file "
         else:
             raise RuntimeError("unknown state: %r" % (self.state,))
 
+        return pos + 1
+
+    def _parse_eol(self):
+        if self.state == self.EAT_CRNL:
+            self.state = self.START_RECORD
+        elif self.state == self.START_RECORD:
+            # empty line - return []
+            pass
+        elif self.state == self.IN_FIELD:
+            # in unquoted field
+            # end of line - return [fields]
+            self._parse_save_field()
+            self.state = self.START_RECORD
+        elif self.state == self.START_FIELD:
+            # save empty field - return [fields]
+            self._parse_save_field()
+            self.state = self.START_RECORD
+        elif self.state == self.ESCAPED_CHAR:
+            self._parse_add_char('\n')
+            self.state = self.IN_FIELD
+        elif self.state == self.IN_QUOTED_FIELD:
+            pass
+        elif self.state == self.ESCAPE_IN_QUOTED_FIELD:
+            self._parse_add_char('\n')
+            self.state = self.IN_QUOTED_FIELD
+        elif self.state == self.QUOTE_IN_QUOTED_FIELD:
+            # end of line - return [fields]
+            self._parse_save_field()
+            self.state = self.START_RECORD
+        else:
+            raise RuntimeError("unknown state: %r" % (self.state,))
+
     def _parse_save_field(self):
-        field, self.field = self.field, []
-        field = ''.join(field)
+        field, self.field = self.field, ''
         if self.numeric_field:
             self.numeric_field = False
             field = float(field)
         self.fields.append(field)
 
     def _parse_add_char(self, c):
-        if len(self.field) >= _field_limit:
+        if len(self.field) + len(c) > _field_limit:
             raise Error("field larget than field limit (%d)" % (_field_limit))
-        self.field.append(c)
+        self.field += c
         
 
-class Writer:
+class Writer(object):
     """CSV writer
 
     Writer objects are responsible for generating tabular data
     def str_w(self, w_str):
         return w_str
 
-    def newdict(self):
+    def newdict(self, module=None):
         return {}
 
     def newtuple(self, iterable):

pypy/interpreter/pyparser/future.py

 
 from pypy.interpreter.astcompiler.consts import CO_GENERATOR_ALLOWED, \
     CO_FUTURE_DIVISION, CO_FUTURE_WITH_STATEMENT, CO_FUTURE_ABSOLUTE_IMPORT
-            
+
 def get_futures(future_flags, source):
     futures = FutureAutomaton(future_flags, source)
     try:
     except DoneException, e:
         pass
     return futures.flags, (futures.lineno, futures.col_offset)
-    
+
 class DoneException(Exception):
     pass
 
         c = self.getc()
         if c in ("'", '"', "r", "u") and not self.docstring_consumed:
             self.consume_docstring()
-        elif c in whitespace_or_newline:
+        elif c == '\\' or c in whitespace_or_newline:
             self.consume_empty_line()
         elif c == '#':
             self.consume_comment()
                     # Syntax error
                     return
 
+    def consume_continuation(self):
+        c = self.getc()
+        if c in '\n\r':
+            self.pos += 1
+            self.atbol()
+
     def consume_empty_line(self):
         """
         Called when the remainder of the line can only contain whitespace
             self.pos += 1
             self.consume_whitespace()
             self.start()
+        elif self.getc() in '\\':
+            self.pos += 1
+            self.consume_continuation()
+            self.start()
         elif self.getc() in '\r\n':
             c = self.getc()
             self.pos += 1
             if c == '\r':
                 if self.getc() == '\n':
                     self.pos += 1
-                    self.atbol()
+                self.atbol()
             else:
                 self.atbol()
             self.start()
         if self.getc() not in whitespace + '\\':
             raise DoneException
         self.consume_whitespace()
-        
+
     def consume_whitespace(self):
         while 1:
             c = self.getc()
         if paren_list and self.getc() == ')':
             self.pos += 1
             return
-        
         if (self.getc() == 'a' and
             self.getc(+1) == 's' and
             self.getc(+2) in whitespace):

pypy/interpreter/pyparser/test/test_futureautomaton.py

     f = run(s)
     assert f.pos == len(s)
     assert f.flags == fut.CO_FUTURE_DIVISION
+    assert f.lineno == 2
+    assert f.col_offset == 0
 
 def test_comment():
     s = '# A comment about nothing ;\n'
     f = run(s)
     assert f.pos == len(s)
+    assert f.lineno == -1
+    assert f.col_offset == 0
 
 def test_tripledocstring():
     s = '''""" This is a
 '''
     f = run(s)
     assert f.pos == len(s)
+    assert f.lineno == -1
+    assert f.col_offset == 0
 
 def test_escapedquote_in_tripledocstring():
     s = '''""" This is a
 '''
     f = run(s)
     assert f.pos == len(s)
-
-
+    assert f.lineno == -1
+    assert f.col_offset == 0
 
 def test_empty_line():
     s = ' \t   \f \n   \n'
     f = run(s)
     assert f.pos == len(s)
+    assert f.lineno == -1
+    assert f.col_offset == 0
 
 def test_from():
     s = 'from  __future__ import division\n'
     f = run(s)
     assert f.pos == len(s)
     assert f.flags == fut.CO_FUTURE_DIVISION
+    assert f.lineno == 1
+    assert f.col_offset == 0
 
 def test_froms():
     s = 'from  __future__ import division, generators, with_statement\n'
     assert f.flags == (fut.CO_FUTURE_DIVISION |
                        fut.CO_GENERATOR_ALLOWED |
                        fut.CO_FUTURE_WITH_STATEMENT)
+    assert f.lineno == 1
+    assert f.col_offset == 0
 
 def test_from_as():
     s = 'from  __future__ import division as b\n'
     f = run(s)
     assert f.pos == len(s)
     assert f.flags == fut.CO_FUTURE_DIVISION
+    assert f.lineno == 1
+    assert f.col_offset == 0
     
 def test_froms_as():
     s = 'from  __future__ import division as b, generators as c\n'
     assert f.pos == len(s)
     assert f.flags == (fut.CO_FUTURE_DIVISION |
                        fut.CO_GENERATOR_ALLOWED)
+    assert f.lineno == 1
+    assert f.col_offset == 0
 
 def test_from_paren():
     s = 'from  __future__ import (division)\n'
     f = run(s)
     assert f.pos == len(s)
     assert f.flags == fut.CO_FUTURE_DIVISION
+    assert f.lineno == 1
+    assert f.col_offset == 0
 
 def test_froms_paren():
     s = 'from  __future__ import (division, generators)\n'
     assert f.pos == len(s)
     assert f.flags == (fut.CO_FUTURE_DIVISION |
                        fut.CO_GENERATOR_ALLOWED)
+    assert f.lineno == 1
+    assert f.col_offset == 0
 
 def test_froms_paren_as():
     s = 'from  __future__ import (division as b, generators,)\n'
     assert f.pos == len(s)
     assert f.flags == (fut.CO_FUTURE_DIVISION |
                        fut.CO_GENERATOR_ALLOWED)
+    assert f.lineno == 1
+    assert f.col_offset == 0
 
 def test_multiline():
     s = '"abc" #def\n  #ghi\nfrom  __future__ import (division as b, generators,)\nfrom __future__ import with_statement\n'
     assert f.flags == (fut.CO_FUTURE_DIVISION |
                        fut.CO_GENERATOR_ALLOWED |
                        fut.CO_FUTURE_WITH_STATEMENT)
+    assert f.lineno == 4
+    assert f.col_offset == 0
 
 def test_windows_style_lineendings():
     s = '"abc" #def\r\n  #ghi\r\nfrom  __future__ import (division as b, generators,)\r\nfrom __future__ import with_statement\r\n'
     assert f.flags == (fut.CO_FUTURE_DIVISION |
                        fut.CO_GENERATOR_ALLOWED |
                        fut.CO_FUTURE_WITH_STATEMENT)
+    assert f.lineno == 4
+    assert f.col_offset == 0
 
 def test_mac_style_lineendings():
     s = '"abc" #def\r  #ghi\rfrom  __future__ import (division as b, generators,)\rfrom __future__ import with_statement\r'
     assert f.flags == (fut.CO_FUTURE_DIVISION |
                        fut.CO_GENERATOR_ALLOWED |
                        fut.CO_FUTURE_WITH_STATEMENT)
+    assert f.lineno == 4
+    assert f.col_offset == 0
+
 def test_semicolon():
     s = '"abc" #def\n  #ghi\nfrom  __future__ import (division as b, generators,);  from __future__ import with_statement\n'
     f = run(s)
     assert f.flags == (fut.CO_FUTURE_DIVISION |
                        fut.CO_GENERATOR_ALLOWED |
                        fut.CO_FUTURE_WITH_STATEMENT)
+    assert f.lineno == 3
+    assert f.col_offset == 55
 
 def test_full_chain():
     s = '"abc" #def\n  #ghi\nfrom  __future__ import (division as b, generators,);  from __future__ import with_statement\n'
     assert flags & fut.CO_FUTURE_WITH_STATEMENT == 0
     assert pos == (1, 0)
 
-
 def test_nonexisting():
     s = 'from  __future__ import non_existing_feature\n'
     f = run(s)
     assert f.pos == len(s)
     assert f.flags == 0
+    assert f.lineno == 1
+    assert f.col_offset == 0
 
 def test_from_import_abs_import():
     s = 'from  __future__ import absolute_import\n'
     f = run(s)
     assert f.pos == len(s)
     assert f.flags == fut.CO_FUTURE_ABSOLUTE_IMPORT
-
+    assert f.lineno == 1
+    assert f.col_offset == 0
 
 def test_raw_doc():
     s = 'r"Doc"\nfrom __future__ import with_statement\n'
     f = run(s)
     assert f.pos == len(s)
     assert f.flags == fut.CO_FUTURE_WITH_STATEMENT
+    assert f.lineno == 2
+    assert f.col_offset == 0
 
 def test_unicode_doc():
     s = 'u"Doc"\nfrom __future__ import with_statement\n'
     f = run(s)
     assert f.pos == len(s)
     assert f.flags == fut.CO_FUTURE_WITH_STATEMENT
+    assert f.lineno == 2
+    assert f.col_offset == 0
 
 def test_raw_unicode_doc():
     s = 'ru"Doc"\nfrom __future__ import with_statement\n'
     f = run(s)
     assert f.pos == len(s)
     assert f.flags == fut.CO_FUTURE_WITH_STATEMENT
+
+def test_continuation_line():
+    s = "\\\nfrom __future__ import with_statement\n"
+    f = run(s)
+    assert f.pos == len(s)
+    assert f.flags == fut.CO_FUTURE_WITH_STATEMENT
+    assert f.lineno == 2
+    assert f.col_offset == 0
+
+def test_continuation_lines():
+    s = "\\\n  \t\\\nfrom __future__ import with_statement\n"
+    f = run(s)
+    assert f.pos == len(s)
+    assert f.flags == fut.CO_FUTURE_WITH_STATEMENT
+    assert f.lineno == 3
+    assert f.col_offset == 0
+
+# This looks like a bug in cpython parser
+# and would require extensive modifications
+# to future.py in order to emulate the same behaviour
+def test_continuation_lines_raise():
+    py.test.skip("probably a CPython bug")
+    s = "   \\\n  \t\\\nfrom __future__ import with_statement\n"
+    try:
+        f = run(s)
+    except IndentationError, e:
+        assert e.args == 'unexpected indent'
+        assert f.pos == len(s)
+        assert f.flags == 0
+        assert f.lineno == -1
+        assert f.col_offset == 0
+    else:
+        raise AssertionError('IndentationError not raised')
+    assert f.lineno == 2
+    assert f.col_offset == 0

pypy/interpreter/test/test_mixedmodule.py

 from pypy.interpreter.mixedmodule import MixedModule
+import py.test
 
 
 class TestMixedModule(object):
         assert isinstance(self.space.builtin_modules["test_module.sub"], SubModule)
 
 class AppTestMixedModule(object):
+    pytestmark = py.test.mark.skipif("config.option.runappdirect")
+
     def setup_class(cls):
         space = cls.space
 

pypy/interpreter/test/test_module.py

 
     def test_repr(self):
         import sys
+        if not hasattr(sys, "pypy_objspaceclass"):
+            skip("need PyPy for _pypy_interact")
         r = repr(sys)
         assert r == "<module 'sys' (built-in)>"
         

pypy/module/cpyext/api.py

     # exception checking occurs in call_external_function.
     argnames = ', '.join(['a%d' % i for i in range(len(FT.ARGS))])
     source = py.code.Source("""
-        def call_external_function(funcptr, %(argnames)s):
+        def cpy_call_external(funcptr, %(argnames)s):
             # NB. it is essential that no exception checking occurs here!
             res = funcptr(%(argnames)s)
             return res
     miniglobals = {'__name__':    __name__, # for module name propagation
                    }
     exec source.compile() in miniglobals
-    call_external_function = miniglobals['call_external_function']
+    call_external_function = miniglobals['cpy_call_external']
     call_external_function._dont_inline_ = True
     call_external_function._annspecialcase_ = 'specialize:ll'
     call_external_function._gctransformer_hint_close_stack_ = True
-    call_external_function = func_with_new_name(call_external_function,
-                                                'ccall_' + name)
     # don't inline, as a hack to guarantee that no GC pointer is alive
     # anywhere in call_external_function
 

pypy/module/cpyext/longobject.py

         pend[0] = rffi.ptradd(str, len(s))
     return space.call_function(space.w_long, w_str, w_base)
 
-@cpython_api([rffi.VOIDP_real], PyObject)
+@cpython_api([rffi.VOIDP], PyObject)
 def PyLong_FromVoidPtr(space, p):
     """Create a Python integer or long integer from the pointer p. The pointer value
     can be retrieved from the resulting value using PyLong_AsVoidPtr().
     If the integer is larger than LONG_MAX, a positive long integer is returned."""
     return space.wrap(rffi.cast(ADDR, p))
 
-@cpython_api([PyObject], rffi.VOIDP_real, error=lltype.nullptr(rffi.VOIDP_real.TO))
+@cpython_api([PyObject], rffi.VOIDP, error=lltype.nullptr(rffi.VOIDP.TO))
 def PyLong_AsVoidPtr(space, w_long):
     """Convert a Python integer or long integer pylong to a C void pointer.
     If pylong cannot be converted, an OverflowError will be raised.  This
     is only assured to produce a usable void pointer for values created
     with PyLong_FromVoidPtr().
     For values outside 0..LONG_MAX, both signed and unsigned integers are accepted."""
-    return rffi.cast(rffi.VOIDP_real, space.uint_w(w_long))
+    return rffi.cast(rffi.VOIDP, space.uint_w(w_long))
 
 @cpython_api([PyObject], rffi.SIZE_T, error=-1)
 def _PyLong_NumBits(space, w_long):

pypy/module/cpyext/object.py

     return lltype.malloc(rffi.VOIDP.TO, size,
                          flavor='raw', zero=True)
 
-@cpython_api([rffi.VOIDP_real], lltype.Void)
+@cpython_api([rffi.VOIDP], lltype.Void)
 def PyObject_FREE(space, ptr):
     lltype.free(ptr, flavor='raw')
 
         w_obj = PyObject_InitVar(space, py_objvar, type, itemcount)
     return py_obj
 
-@cpython_api([rffi.VOIDP_real], lltype.Void)
+@cpython_api([rffi.VOIDP], lltype.Void)
 def PyObject_Del(space, obj):
     lltype.free(obj, flavor='raw')
 
 @cpython_api([PyObject], lltype.Void)
 def PyObject_dealloc(space, obj):
     pto = obj.c_ob_type
-    obj_voidp = rffi.cast(rffi.VOIDP_real, obj)
+    obj_voidp = rffi.cast(rffi.VOIDP, obj)
     generic_cpy_call(space, pto.c_tp_free, obj_voidp)
     if pto.c_tp_flags & Py_TPFLAGS_HEAPTYPE:
         Py_DecRef(space, rffi.cast(PyObject, pto))
 def _PyObject_GC_New(space, type):
     return _PyObject_New(space, type)
 
-@cpython_api([rffi.VOIDP_real], lltype.Void)
+@cpython_api([rffi.VOIDP], lltype.Void)
 def PyObject_GC_Del(space, obj):
     PyObject_Del(space, obj)
 
-@cpython_api([rffi.VOIDP_real], lltype.Void)
+@cpython_api([rffi.VOIDP], lltype.Void)
 def PyObject_GC_Track(space, op):
     """Adds the object op to the set of container objects tracked by the
     collector.  The collector can run at unexpected times so objects must be
     end of the constructor."""
     pass
 
-@cpython_api([rffi.VOIDP_real], lltype.Void)
+@cpython_api([rffi.VOIDP], lltype.Void)
 def PyObject_GC_UnTrack(space, op):
     """Remove the object op from the set of container objects tracked by the
     collector.  Note that PyObject_GC_Track() can be called again on
                         obj, lltype.nullptr(rffi.INTP.TO)) != 1:
         raise OperationError(space.w_TypeError, space.wrap(
             "expected a single-segment buffer object"))
-    size = generic_cpy_call(space, pb.c_bf_getreadbuffer,
+    size = generic_cpy_call(space, pb.c_bf_getcharbuffer,
                             obj, 0, bufferp)
     if size < 0:
         return -1

pypy/module/cpyext/pyerrors.py

     If the error indicator is not set, set all three variables to NULL.  If it is
     set, it will be cleared and you own a reference to each object retrieved.  The
     value and traceback object may be NULL even when the type object is not.
-    
+
     This function is normally only used by code that needs to handle exceptions or
     by code that needs to save and restore the error indicator temporarily."""
     state = space.fromcache(State)
     reference to each object before the call and after the call you no longer own
     these references.  (If you don't understand this, don't use this function.  I
     warned you.)
-    
+
     This function is normally only used by code that needs to save and restore the
     error indicator temporarily; use PyErr_Fetch() to save the current
     exception state."""
     """This is a shorthand for PyErr_SetString(PyExc_TypeError, message), where
     message indicates that a built-in operation was invoked with an illegal
     argument.  It is mostly for internal use."""
-    raise OperationError(space.w_TypeError, 
+    raise OperationError(space.w_TypeError,
             space.wrap("bad argument type for built-in operation"))
 
 @cpython_api([], lltype.Void)
     the  currently executing line of code in that stack frame.  A stacklevel of 1
     is the function calling PyErr_WarnEx(), 2 is  the function above that,
     and so forth.
-    
+
     This function normally prints a warning message to sys.stderr; however, it is
     also possible that the user has specified that warnings are to be turned into
     errors, and in that case this will raise an exception.  It is also possible that
     intentional.)  If an exception is raised, the caller should do its normal
     exception handling (for example, Py_DECREF() owned references and return
     an error value).
-    
+
     Warning categories must be subclasses of Warning; the default warning
     category is RuntimeWarning.  The standard Python warning categories are
     available as global variables whose names are PyExc_ followed by the Python
     PyExc_FutureWarning.  PyExc_Warning is a subclass of
     PyExc_Exception; the other warning categories are subclasses of
     PyExc_Warning.
-    
+
     For information about warning control, see the documentation for the
     warnings module and the -W option in the command line
     documentation.  There is no C API for warning control."""
     below) or NULL; the message argument is a message string.  The warning will
     appear to be issued from the function calling PyErr_Warn(), equivalent to
     calling PyErr_WarnEx() with a stacklevel of 1.
-    
+
     Deprecated; use PyErr_WarnEx() instead."""
     return PyErr_WarnEx(space, w_category, message, 1)
 
     exception has been set but it is impossible for the interpreter to actually
     raise the exception.  It is used, for example, when an exception occurs in
     an __del__() method.
-    
+
     The function is called with a single argument obj that identifies the
     context in which the unraisable exception occurred. The repr of obj will be
     printed in the warning message."""
-    
+
     state = space.fromcache(State)
     operror = state.clear_exception()
     if operror:
-        operror.write_unraisable(space, w_where)
+        operror.write_unraisable(space, space.str_w(space.repr(w_where)))

pypy/module/cpyext/pyobject.py

 
 #___________________________________________________________
 
-@cpython_api([rffi.VOIDP_real], lltype.Signed, error=CANNOT_FAIL)
+@cpython_api([rffi.VOIDP], lltype.Signed, error=CANNOT_FAIL)
 def _Py_HashPointer(space, ptr):
     return rffi.cast(lltype.Signed, ptr)

pypy/module/cpyext/stringobject.py

 from pypy.module.cpyext.api import (
     cpython_api, cpython_struct, bootstrap_function, build_type_checkers,
     PyObjectFields, Py_ssize_t, CONST_STRING)
+from pypy.module.cpyext.pyerrors import PyErr_BadArgument
 from pypy.module.cpyext.pyobject import (
     PyObject, PyObjectP, Py_DecRef, make_ref, from_ref, track_reference,
     make_typedescr, get_typedescr)
     the parameters of the same name in the string encode() method. The codec to
     be used is looked up using the Python codec registry. Return NULL if an
     exception was raised by the codec.
-    
+
     This function is not available in 3.x and does not have a PyBytes alias."""
     if not PyString_Check(space, w_str):
         PyErr_BadArgument(space)

pypy/module/cpyext/stubgen.py

 
 C_TYPE_TO_PYPY_TYPE_ARGS = C_TYPE_TO_PYPY_TYPE.copy()
 C_TYPE_TO_PYPY_TYPE_ARGS.update({
-    "void": "rffi.VOIDP_real",
+    "void": "rffi.VOIDP",
     })
 
 

pypy/module/cpyext/stubs.py

     reload the module if it was already imported.)"""
     raise NotImplementedError
 
-@cpython_api([rffi.CCHARP, rffi.VOIDP_real], rffi.INT_real, error=-1)
+@cpython_api([rffi.CCHARP, rffi.VOIDP], rffi.INT_real, error=-1)
 def PyImport_AppendInittab(space, name, initfunc):
     """Add a single module to the existing table of built-in modules.  This is a
     convenience wrapper around PyImport_ExtendInittab(), returning -1 if

pypy/module/cpyext/test/test_longobject.py

     def test_as_voidptr(self, space, api):
         w_l = api.PyLong_FromVoidPtr(lltype.nullptr(rffi.VOIDP.TO))
         assert space.unwrap(w_l) == 0L
-        assert api.PyLong_AsVoidPtr(w_l) == lltype.nullptr(rffi.VOIDP_real.TO)
+        assert api.PyLong_AsVoidPtr(w_l) == lltype.nullptr(rffi.VOIDP.TO)
 
     def test_sign_and_bits(self, space, api):
         if space.is_true(space.lt(space.sys.get('version_info'),

pypy/module/cpyext/test/test_pyerrors.py

         api.PyErr_NoMemory()
         assert space.eq_w(state.operror.w_type, space.w_MemoryError)
         api.PyErr_Clear()
-        
+
     def test_BadArgument(self, space, api):
         api.PyErr_BadArgument()
         state = space.fromcache(State)
         w_where = space.wrap("location")
         api.PyErr_WriteUnraisable(w_where)
         out, err = capfd.readouterr()
-        assert ("Exception ValueError: 'message' "
-                "in W_StringObject('location') ignored") == err.strip()
+        assert "Exception ValueError: 'message' in 'location' ignored" == err.strip()
 
 class AppTestFetch(AppTestCpythonExtensionBase):
     def setup_class(cls):

pypy/module/cpyext/test/test_stringobject.py

         assert module.get_hello2() == 'Hello world'
         assert module.test_Size()
         raises(TypeError, module.test_Size_exception)
-    
+
         assert module.test_is_string("")
         assert not module.test_is_string(())
 
             ''')
         res = module.test_string_format_v(1, "xyz")
         assert res == "bla 1 ble xyz\n"
-        
+
     def test_format(self):
         module = self.import_extension('foo', [
             ("test_string_format", "METH_VARARGS",
         assert c_buf.c_bf_getreadbuffer(py_obj, 0, ref) == 10
         lltype.free(ref, flavor='raw')
         Py_DecRef(space, py_obj)
-        
+
     def test_Concat(self, space, api):
         ref = make_ref(space, space.wrap('abc'))
         ptr = lltype.malloc(PyObjectP.TO, 1, flavor='raw')
         ptr[0] = lltype.nullptr(PyObject.TO)
         api.PyString_Concat(ptr, space.wrap('def')) # should not crash
         lltype.free(ptr, flavor='raw')
-    
+
     def test_ConcatAndDel(self, space, api):
         ref1 = make_ref(space, space.wrap('abc'))
         ref2 = make_ref(space, space.wrap('def'))
             api.PyString_Format(space.wrap('%s %d'), space.wrap((1, 2))))
 
     def test_asbuffer(self, space, api):
-        bufp = lltype.malloc(rffi.VOIDPP.TO, 1, flavor='raw')
+        bufp = lltype.malloc(rffi.CCHARPP.TO, 1, flavor='raw')
         lenp = lltype.malloc(Py_ssize_tP.TO, 1, flavor='raw')
 
         w_text = space.wrap("text")
         res = api.PyString_AsEncodedObject(
             ptr, lltype.nullptr(rffi.CCHARP.TO), lltype.nullptr(rffi.CCHARP.TO))
         assert space.unwrap(res) == "abc"
+
+        self.raises(space, api, TypeError, api.PyString_AsEncodedObject,
+            space.wrap(2), lltype.nullptr(rffi.CCHARP.TO), lltype.nullptr(rffi.CCHARP.TO)
+        )

pypy/module/cpyext/typeobject.py

             if not struct:
                 continue
             func = getattr(struct, slot_names[1])
-        func_voidp = rffi.cast(rffi.VOIDP_real, func)
+        func_voidp = rffi.cast(rffi.VOIDP, func)
         if not func:
             continue
         if wrapper_func is None and wrapper_func_kwds is None:
     Py_DecRef(space, pyref)
     return space.len_w(w_str)
 
+@cpython_api([PyObject, lltype.Signed, rffi.CCHARPP], lltype.Signed,
+             external=False, error=-1)
+def str_getcharbuffer(space, w_str, segment, ref):
+    from pypy.module.cpyext.stringobject import PyString_AsString
+    if segment != 0:
+        raise OperationError(space.w_SystemError, space.wrap
+                             ("accessing non-existent string segment"))
+    pyref = make_ref(space, w_str)
+    ref[0] = PyString_AsString(space, pyref)
+    # Stolen reference: the object has better exist somewhere else
+    Py_DecRef(space, pyref)
+    return space.len_w(w_str)
+
 def setup_string_buffer_procs(space, pto):
     c_buf = lltype.malloc(PyBufferProcs, flavor='raw', zero=True)
     c_buf.c_bf_getsegcount = llhelper(str_segcount.api_func.functype,
                                       str_segcount.api_func.get_wrapper(space))
     c_buf.c_bf_getreadbuffer = llhelper(str_getreadbuffer.api_func.functype,
                                  str_getreadbuffer.api_func.get_wrapper(space))
+    c_buf.c_bf_getcharbuffer = llhelper(str_getcharbuffer.api_func.functype,
+                                 str_getcharbuffer.api_func.get_wrapper(space))
     pto.c_tp_as_buffer = c_buf
 
 @cpython_api([PyObject], lltype.Void, external=False)

pypy/module/cpyext/typeobjectdefs.py

 P, FT, PyO = Ptr, FuncType, PyObject
 PyOPtr = Ptr(lltype.Array(PyO, hints={'nolength': True}))
 
-freefunc = P(FT([rffi.VOIDP_real], Void))
+freefunc = P(FT([rffi.VOIDP], Void))
 destructor = P(FT([PyO], Void))
 printfunc = P(FT([PyO, FILEP, rffi.INT_real], rffi.INT))
 getattrfunc = P(FT([PyO, rffi.CCHARP], PyO))
 objobjargproc = P(FT([PyO, PyO, PyO], rffi.INT_real))
 
 objobjproc = P(FT([PyO, PyO], rffi.INT_real))
-visitproc = P(FT([PyO, rffi.VOIDP_real], rffi.INT_real))
-traverseproc = P(FT([PyO, visitproc, rffi.VOIDP_real], rffi.INT_real))
+visitproc = P(FT([PyO, rffi.VOIDP], rffi.INT_real))
+traverseproc = P(FT([PyO, visitproc, rffi.VOIDP], rffi.INT_real))
 
-getter = P(FT([PyO, rffi.VOIDP_real], PyO))
-setter = P(FT([PyO, PyO, rffi.VOIDP_real], rffi.INT_real))
+getter = P(FT([PyO, rffi.VOIDP], PyO))
+setter = P(FT([PyO, PyO, rffi.VOIDP], rffi.INT_real))
 
-wrapperfunc = P(FT([PyO, PyO, rffi.VOIDP_real], PyO))
-wrapperfunc_kwds = P(FT([PyO, PyO, rffi.VOIDP_real, PyO], PyO))
+wrapperfunc = P(FT([PyO, PyO, rffi.VOIDP], PyO))
+wrapperfunc_kwds = P(FT([PyO, PyO, rffi.VOIDP, PyO], PyO))
 
 
 PyGetSetDef = cpython_struct("PyGetSetDef", (
     ("get", getter),
     ("set", setter),
     ("doc", rffi.CCHARP),
-    ("closure", rffi.VOIDP_real),
+    ("closure", rffi.VOIDP),
 ))
 
 PyNumberMethods = cpython_struct("PyNumberMethods", (

pypy/module/signal/interp_signal.py

     globals()[k] = v
 
 def external(name, args, result, **kwds):
-    return rffi.llexternal(name, args, result, compilation_info=eci, **kwds)
+    return rffi.llexternal(name, args, result, compilation_info=eci,
+                           sandboxsafe=True, **kwds)
 
 pypysig_ignore = external('pypysig_ignore', [rffi.INT], lltype.Void)
 pypysig_default = external('pypysig_default', [rffi.INT], lltype.Void)

pypy/module/sys/app.py

     return None
 
 copyright_str = """
-Copyright 2003-2010 PyPy development team.
-All rights reserved.
-For further information see http://www.codespeak.net/pypy.
+Copyright 2003-2011 PyPy development team.
+All Rights Reserved.
+For further information, see <http://pypy.org>
 
 Portions Copyright (c) 2001-2008 Python Software Foundation.
 All Rights Reserved.

pypy/objspace/std/bytearrayobject.py

     if not space.is_w(w_by, space.w_None):
         w_by = space.wrap(space.bufferstr_new_w(w_by))
     w_list = space.call_method(w_str, "split", w_by, w_maxsplit)
-    list_w = space.listview(w_list)
-    for i in range(len(list_w)):
-        list_w[i] = String2Bytearray(space, list_w[i])
+    length = space.int_w(space.len(w_list))
+    for i in range(length):
+        w_i = space.wrap(i)
+        space.setitem(w_list, w_i, String2Bytearray(space, space.getitem(w_list, w_i)))
     return w_list
 
 def str_rsplit__Bytearray_ANY_ANY(space, w_bytearray, w_by, w_maxsplit=-1):
     if not space.is_w(w_by, space.w_None):
         w_by = space.wrap(space.bufferstr_new_w(w_by))
     w_list = space.call_method(w_str, "rsplit", w_by, w_maxsplit)
-    list_w = space.listview(w_list)
-    for i in range(len(list_w)):
-        list_w[i] = String2Bytearray(space, list_w[i])
+    length = space.int_w(space.len(w_list))
+    for i in range(length):
+        w_i = space.wrap(i)
+        space.setitem(w_list, w_i, String2Bytearray(space, space.getitem(w_list, w_i)))
     return w_list
 
 def str_partition__Bytearray_ANY(space, w_bytearray, w_sub):

pypy/rlib/libffi.py

 from pypy.rlib.clibffi import get_libc_name, FUNCFLAG_CDECL, AbstractFuncPtr, \
     push_arg_as_ffiptr, c_ffi_call
 from pypy.rlib.rdynload import dlopen, dlclose, dlsym, dlsym_byordinal
+from pypy.rlib.rdynload import DLLHANDLE
 
 class types(object):
     """
 class CDLL(object):
     def __init__(self, libname):
         """Load the library, or raises DLOpenError."""
-        self.lib = lltype.nullptr(rffi.CCHARP.TO)
+        self.lib = rffi.cast(DLLHANDLE, 0)
         ll_libname = rffi.str2charp(libname)
         try:
             self.lib = dlopen(ll_libname)
     def __del__(self):
         if self.lib:
             dlclose(self.lib)
-            self.lib = lltype.nullptr(rffi.CCHARP.TO)
+            self.lib = rffi.cast(DLLHANDLE, 0)
 
     def getpointer(self, name, argtypes, restype, flags=FUNCFLAG_CDECL):
         return Func(name, argtypes, restype, dlsym(self.lib, name),

pypy/rlib/rsocket.py

+from __future__ import with_statement
 """
 An RPython implementation of sockets based on rffi.
 Note that the interface has to be slightly different - this is not
         self.settimeout(timeout)
 
     def setsockopt(self, level, option, value):
-        res = _c.socketsetsockopt(self.fd, level, option, value, len(value))
-        if res < 0:
-            raise self.error_handler()
+        with rffi.scoped_str2charp(value) as buf:
+            res = _c.socketsetsockopt(self.fd, level, option,
+                                      rffi.cast(rffi.VOIDP, buf),
+                                      len(value))
+            if res < 0:
+                raise self.error_handler()
 
     def setsockopt_int(self, level, option, value):
-        flag_p = lltype.malloc(rffi.INTP.TO, 1, flavor='raw')
-        try:
+        with lltype.scoped_alloc(rffi.INTP.TO, 1) as flag_p:
             flag_p[0] = rffi.cast(rffi.INT, value)
             res = _c.socketsetsockopt(self.fd, level, option,
                                       rffi.cast(rffi.VOIDP, flag_p),
                                       rffi.sizeof(rffi.INT))
-        finally:
-            lltype.free(flag_p, flavor='raw')
-        if res < 0:
-            raise self.error_handler()
+            if res < 0:
+                raise self.error_handler()
 
     def settimeout(self, timeout):
         """Set the timeout of the socket. A timeout < 0 means that

pypy/rlib/rwin32.py

 
     def llimpl_FormatError(code):
         "Return a message corresponding to the given Windows error code."
-        buf = lltype.malloc(rffi.VOIDPP.TO, 1, flavor='raw')
+        buf = lltype.malloc(rffi.CCHARPP.TO, 1, flavor='raw')
 
         try:
             msglen = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
                                    None,
                                    code,
                                    DEFAULT_LANGUAGE,
-                                   rffi.cast(rffi.VOIDP, buf),
+                                   rffi.cast(rffi.CCHARP, buf),
                                    0, None)
 
             if msglen <= 2 or msglen > sys.maxint:
             assert buflen > 0
 
             result = rffi.charpsize2str(buf[0], buflen)
-            LocalFree(buf[0])
+            LocalFree(rffi.cast(rffi.VOIDP, buf[0]))
         finally:
             lltype.free(buf, flavor='raw')
 

pypy/rlib/test/test_libffi.py

         c_file = udir.ensure("test_libffi", dir=1).join("foolib.c")
         # automatically collect the C source from the docstrings of the tests
         snippets = []
+        exports = []
         for name in dir(cls):
             if name.startswith('test_'):
                 meth = getattr(cls, name)
                 # improved: so far we just check that there is a '{' :-)
                 if meth.__doc__ is not None and '{' in meth.__doc__:
                     snippets.append(meth.__doc__)
+                    import re
+                    for match in re.finditer(" ([a-z_]+)\(", meth.__doc__):
+                        exports.append(match.group(1))
         #
         c_file.write(py.code.Source('\n'.join(snippets)))
-        eci = ExternalCompilationInfo(export_symbols=[])
+        eci = ExternalCompilationInfo(export_symbols=exports)
         cls.libfoo_name = str(platform.compile([c_file], eci, 'x',
                                                standalone=False))
 

pypy/rpython/lltypesystem/ll2ctypes.py

             funcname, place))
 
     # get_ctypes_type() can raise NotImplementedError too
-    cfunc.argtypes = [get_ctypes_type(T) for T in FUNCTYPE.ARGS
+    from pypy.rpython.lltypesystem import rffi
+    cfunc.argtypes = [get_ctypes_type(T) if T is not rffi.VOIDP
+                                         else ctypes.c_void_p
+                      for T in FUNCTYPE.ARGS
                       if not T is lltype.Void]
     if FUNCTYPE.RESULT is lltype.Void:
         cfunc.restype = None

pypy/rpython/lltypesystem/lltype.py

                 return "{ %s }" % of._str_fields()
             else:
                 return "%s { %s }" % (of._name, of._str_fields())
+        elif self._hints.get('render_as_void'):
+            return 'void'
         else:
             return str(self.OF)
     _str_fields = saferecursive(_str_fields, '...')
                 return cast_pointer(TGT, value)
         elif ORIG == llmemory.Address:
             return llmemory.cast_adr_to_ptr(value, TGT)
+        elif ORIG == Signed:
+            return cast_int_to_ptr(TGT, value)
     elif TGT == llmemory.Address and isinstance(ORIG, Ptr):
         return llmemory.cast_ptr_to_adr(value)
     elif TGT == Signed and isinstance(ORIG, Ptr) and ORIG.TO._gckind == 'raw':
                 raise TypeError("cannot directly assign to container array items")
             T2 = typeOf(val)
             if T2 != T1:
+                from pypy.rpython.lltypesystem import rffi
+                if T1 is rffi.VOIDP and isinstance(T2, Ptr):
+                    # Any pointer is convertible to void*
+                    val = rffi.cast(rffi.VOIDP, val)
+                else:
                     raise TypeError("%r items:\n"
                                     "expect %r\n"
                                     "   got %r" % (self._T, T1, T2))
             return '* %s' % (self._obj0,)
 
     def __call__(self, *args):
+        from pypy.rpython.lltypesystem import rffi
         if isinstance(self._T, FuncType):
             if len(args) != len(self._T.ARGS):
                 raise TypeError,"calling %r with wrong argument number: %r" % (self._T, args)
                             pass
                         else:
                             assert a == value
+                    # None is acceptable for any pointer
+                    elif isinstance(ARG, Ptr) and a is None:
+                        pass
+                    # Any pointer is convertible to void*
+                    elif ARG is rffi.VOIDP and isinstance(typeOf(a), Ptr):
+                        pass
                     # special case: ARG can be a container type, in which
                     # case a should be a pointer to it.  This must also be
                     # special-cased in the backends.
-                    elif not (isinstance(ARG, ContainerType)
-                            and typeOf(a) == Ptr(ARG)):
+                    elif (isinstance(ARG, ContainerType) and
+                          typeOf(a) == Ptr(ARG)):
+                        pass
+                    else:
                         args_repr = [typeOf(arg) for arg in args]
                         raise TypeError, ("calling %r with wrong argument "
                                           "types: %r" % (self._T, args_repr))

pypy/rpython/lltypesystem/rffi.py

                     # XXX leaks if a unicode2wcharp() fails with MemoryError
                     # and was not the first in this function
                     freeme = arg
+            elif TARGET is VOIDP:
+                if arg is None:
+                    arg = lltype.nullptr(VOIDP.TO)
+                elif isinstance(arg, str):
+                    arg = str2charp(arg)
+                    freeme = arg
+                elif isinstance(arg, unicode):
+                    arg = unicode2wcharp(arg)
+                    freeme = arg
             elif _isfunctype(TARGET) and not _isllptr(arg):
                 # XXX pass additional arguments
                 if invoke_around_handlers:
 r_singlefloat = rarithmetic.r_singlefloat
 
 # void *   - for now, represented as char *
-VOIDP = lltype.Ptr(lltype.Array(lltype.Char, hints={'nolength': True}))
-VOIDP_real = lltype.Ptr(lltype.Array(lltype.Char, hints={'nolength': True, 'render_as_void': True}))
-NULL = lltype.nullptr(VOIDP.TO)
+VOIDP = lltype.Ptr(lltype.Array(lltype.Char, hints={'nolength': True, 'render_as_void': True}))
+NULL = None
 
 # void **
 VOIDPP = CArrayPtr(VOIDP)

pypy/rpython/lltypesystem/test/test_rffi.py

 def test_ptradd_interpret():
     interpret(test_ptradd, [])
 
+def test_voidptr():
+    assert repr(VOIDP) == "<* Array of void >"
+
 class TestCRffi(BaseTestRffi):
     def compile(self, func, args, **kwds):
         return compile_c(func, args, **kwds)

pypy/translator/c/funcgen.py

         return '%s = %s;' % (self.expr(op.result), items)
 
     def OP_DIRECT_PTRADD(self, op):
-        return '%s = %s + %s;' % (self.expr(op.result),
-                                  self.expr(op.args[0]),
-                                  self.expr(op.args[1]))
+        ARRAY = self.lltypemap(op.args[0]).TO
+        if ARRAY._hints.get("render_as_void"):
+            return '%s = (char *)%s + %s;' % (
+                self.expr(op.result), 
+                self.expr(op.args[0]),
+                self.expr(op.args[1]))
+        else:
+            return '%s = %s + %s;' % (
+                self.expr(op.result),
+                self.expr(op.args[0]),
+                self.expr(op.args[1]))
 
     def OP_CAST_POINTER(self, op):
         TYPE = self.lltypemap(op.result)

pypy/translator/c/gcc/trackgcroot.py

         # floating-point operations cannot produce GC pointers
         'f',
         'cvt', 'ucomi', 'comi', 'subs', 'subp' , 'adds', 'addp', 'xorp',
-        'movap', 'movd', 'movlp', 'sqrtsd',
+        'movap', 'movd', 'movlp', 'sqrtsd', 'movhpd',
         'mins', 'minp', 'maxs', 'maxp', 'unpck', 'pxor', 'por', # sse2
         # arithmetic operations should not produce GC pointers
         'inc', 'dec', 'not', 'neg', 'or', 'and', 'sbb', 'adc',
         'shl', 'shr', 'sal', 'sar', 'rol', 'ror', 'mul', 'imul', 'div', 'idiv',
         'bswap', 'bt', 'rdtsc',
-        'punpck', 'pshufd', 'pcmp',
+        'punpck', 'pshufd', 'pcmp', 'pand', 'psslw', 'pssld', 'psslq',
         # zero-extending moves should not produce GC pointers
         'movz', 
         ])
                 insns.append(InsnStackAdjust(int(target.rsplit('@', 1)[1])))
             # Some (intrinsic?) functions use the "fastcall" calling convention
             # XXX without any declaration, how can we guess the stack effect?
-            if target in ['__alldiv', '__allrem', '__allmul', '__alldvrm']:
+            if target in ['__alldiv', '__allrem', '__allmul', '__alldvrm',
+                          '__aulldiv', '__aullrem', '__aullmul', '__aulldvrm']:
                 insns.append(InsnStackAdjust(16))
         return insns
 

pypy/translator/c/node.py

         self.varlength = varlength
         self.dependencies = {}
         contained_type = ARRAY.OF
-        if ARRAY._hints.get("render_as_void"):
-            contained_type = Void
+        # There is no such thing as an array of voids:
+        # we use a an array of chars instead; only the pointer can be void*.
         self.itemtypename = db.gettype(contained_type, who_asks=self)
         self.fulltypename = self.itemtypename.replace('@', '(@)[%d]' %
                                                       (self.varlength,))
-        self.fullptrtypename = self.itemtypename.replace('@', '*@')
+        if ARRAY._hints.get("render_as_void"):
+            self.fullptrtypename = 'void *@'
+        else:
+            self.fullptrtypename = self.itemtypename.replace('@', '*@')
 
     def setup(self):
         """Array loops are forbidden by ForwardReference.become() because
         return self.itemindex_access_expr(baseexpr, index)
 
     def itemindex_access_expr(self, baseexpr, indexexpr):
-        return 'RPyBareItem(%s, %s)' % (baseexpr, indexexpr)
+        if self.ARRAY._hints.get("render_as_void"):
+            return 'RPyBareItem((char*)%s, %s)' % (baseexpr, indexexpr)
+        else:
+            return 'RPyBareItem(%s, %s)' % (baseexpr, indexexpr)
 
     def definition(self):
         return []    # no declaration is needed

pypy/translator/c/test/test_database.py

 from pypy.objspace.flow.model import Constant, Variable, SpaceOperation
 from pypy.objspace.flow.model import Block, Link, FunctionGraph
 from pypy.rpython.typesystem import getfunctionptr
-from pypy.rpython.lltypesystem.rffi import VOIDP_real, INT_real, INT
+from pypy.rpython.lltypesystem.rffi import VOIDP, INT_real, INT
 
 
 def dump_on_stdout(database):
     dump_on_stdout(db)
 
 def test_voidp():
-    A = VOIDP_real
+    A = VOIDP
     db = LowLevelDatabase()
     assert db.gettype(A) == "void *@"
 

pypy/translator/platform/__init__.py

         args = cclist[1:] + args
         returncode, stdout, stderr = _run_subprocess(cc, args, self.c_environ,
                                                      cwd)
-        self._handle_error(returncode, stderr, stdout, outname)
+        self._handle_error(returncode, stdout, stderr, outname)
 
-    def _handle_error(self, returncode, stderr, stdout, outname):
+    def _handle_error(self, returncode, stdout, stderr, outname):
         if returncode != 0:
             errorfile = outname.new(ext='errors')
             errorfile.write(stderr, 'wb')

pypy/translator/platform/maemo.py

         log.execute('/scratchbox/login ' + cc + ' ' + ' '.join(args))
         args = [cc] + args
         returncode, stdout, stderr = _run_subprocess('/scratchbox/login', args)
-        self._handle_error(returncode, stderr, stdout, outname)
+        self._handle_error(returncode, stdout, stderr, outname)
     
     def execute(self, executable, args=[], env=None):
         if isinstance(args, str):

pypy/translator/platform/windows.py

     def _libs(self, libraries):
         libs = []
         for lib in libraries:
+            lib = str(lib)
             if lib.endswith('.dll'):
                 lib = lib[:-4]
             libs.append('%s.lib' % (lib,))
 
         return exe_name
 
-    def _handle_error(self, returncode, stderr, stdout, outname):
+    def _handle_error(self, returncode, stdout, stderr, outname):
         if returncode != 0:
             # Microsoft compilers write compilation errors to stdout
             stderr = stdout + stderr
     def library_dirs_for_libffi(self):
         return []
 
-    def _handle_error(self, returncode, stderr, stdout, outname):
+    def _handle_error(self, returncode, stdout, stderr, outname):
         # Mingw tools write compilation errors to stdout
         super(MingwPlatform, self)._handle_error(
-            returncode, stderr + stdout, '', outname)
+            returncode, '', stderr + stdout, outname)