[pypy-commit] pypy py3k: merge default

pjenvey noreply at buildbot.pypy.org
Thu Oct 30 20:24:53 CET 2014


Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k
Changeset: r74306:72fb7148be52
Date: 2014-10-30 12:21 -0700
http://bitbucket.org/pypy/pypy/changeset/72fb7148be52/

Log:	merge default

diff --git a/pypy/module/array/interp_array.py b/pypy/module/array/interp_array.py
--- a/pypy/module/array/interp_array.py
+++ b/pypy/module/array/interp_array.py
@@ -1,5 +1,3 @@
-from __future__ import with_statement
-
 from rpython.rlib import jit
 from rpython.rlib.buffer import Buffer
 from rpython.rlib.objectmodel import keepalive_until_here
diff --git a/pypy/objspace/std/complexobject.py b/pypy/objspace/std/complexobject.py
--- a/pypy/objspace/std/complexobject.py
+++ b/pypy/objspace/std/complexobject.py
@@ -1,19 +1,20 @@
 import math
 
+from rpython.rlib import jit, rcomplex
+from rpython.rlib.rarithmetic import intmask, r_ulonglong
+from rpython.rlib.rbigint import rbigint
+from rpython.rlib.rfloat import (
+    DTSF_STR_PRECISION, copysign, formatd, isinf, isnan, string_to_float)
+from rpython.rlib.rstring import ParseStringError
+from rpython.tool.sourcetools import func_with_new_name
+
 from pypy.interpreter.baseobjspace import W_Root
 from pypy.interpreter.error import OperationError, oefmt
-from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault
+from pypy.interpreter.gateway import WrappedDefault, interp2app, unwrap_spec
 from pypy.interpreter.typedef import GetSetProperty, TypeDef
 from pypy.objspace.std import newformat
 from pypy.objspace.std.floatobject import _hash_float
 from pypy.objspace.std.unicodeobject import unicode_to_decimal_w
-from rpython.rlib import jit, rcomplex
-from rpython.rlib.rarithmetic import intmask, r_ulonglong
-from rpython.rlib.rbigint import rbigint
-from rpython.rlib.rfloat import (
-    formatd, DTSF_STR_PRECISION, isinf, isnan, copysign, string_to_float)
-from rpython.rlib.rstring import ParseStringError
-from rpython.tool.sourcetools import func_with_new_name
 
 HASH_IMAG = 1000003
 
diff --git a/pypy/objspace/std/dictproxyobject.py b/pypy/objspace/std/dictproxyobject.py
--- a/pypy/objspace/std/dictproxyobject.py
+++ b/pypy/objspace/std/dictproxyobject.py
@@ -1,8 +1,9 @@
-from pypy.objspace.std.dictmultiobject import DictStrategy, create_iterator_classes
+from rpython.rlib import rerased
+
+from pypy.interpreter.error import OperationError, oefmt
+from pypy.objspace.std.dictmultiobject import (
+    DictStrategy, create_iterator_classes)
 from pypy.objspace.std.typeobject import unwrap_cell
-from pypy.interpreter.error import OperationError, oefmt
-
-from rpython.rlib import rerased
 
 
 class DictProxyStrategy(DictStrategy):
diff --git a/pypy/objspace/std/floatobject.py b/pypy/objspace/std/floatobject.py
--- a/pypy/objspace/std/floatobject.py
+++ b/pypy/objspace/std/floatobject.py
@@ -2,9 +2,20 @@
 import operator
 import sys
 
+from rpython.rlib import rarithmetic, rfloat
+from rpython.rlib.rarithmetic import LONG_BIT, intmask, ovfcheck_float_to_int
+from rpython.rlib.rbigint import rbigint
+from rpython.rlib.rfloat import (
+    DTSF_ADD_DOT_0, INFINITY, NAN, copysign,
+    float_as_rbigint_ratio, formatd, isfinite, isinf, isnan)
+from rpython.rlib.rstring import ParseStringError
+from rpython.rlib.unroll import unrolling_iterable
+from rpython.rtyper.lltypesystem.module.ll_math import math_fmod
+from rpython.tool.sourcetools import func_with_new_name
+
 from pypy.interpreter.baseobjspace import W_Root
 from pypy.interpreter.error import OperationError, oefmt
-from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault
+from pypy.interpreter.gateway import WrappedDefault, interp2app, unwrap_spec
 from pypy.interpreter.typedef import GetSetProperty, TypeDef
 from pypy.objspace.std import newformat
 from pypy.objspace.std.intobject import HASH_BITS, HASH_MODULUS, W_IntObject
@@ -13,15 +24,6 @@
 from rpython.rlib.rarithmetic import (
     LONG_BIT, intmask, ovfcheck_float_to_int, r_uint)
 from pypy.objspace.std.util import wrap_parsestringerror
-from rpython.rlib import rarithmetic, rfloat
-from rpython.rlib.rbigint import rbigint
-from rpython.rlib.rfloat import (
-    isinf, isnan, isfinite, INFINITY, NAN, copysign, formatd,
-    DTSF_ADD_DOT_0, float_as_rbigint_ratio)
-from rpython.rlib.rstring import ParseStringError
-from rpython.tool.sourcetools import func_with_new_name
-from rpython.rlib.unroll import unrolling_iterable
-from rpython.rtyper.lltypesystem.module.ll_math import math_fmod
 
 HASH_INF  = 314159
 HASH_NAN  = 0
diff --git a/pypy/objspace/std/listobject.py b/pypy/objspace/std/listobject.py
--- a/pypy/objspace/std/listobject.py
+++ b/pypy/objspace/std/listobject.py
@@ -10,27 +10,28 @@
 import operator
 import sys
 
+from rpython.rlib import debug, jit, rerased
+from rpython.rlib.listsort import make_timsort_class
+from rpython.rlib.objectmodel import (
+    import_from_mixin, instantiate, newlist_hint, resizelist_hint, specialize)
+from rpython.tool.sourcetools import func_with_new_name
+
 from pypy.interpreter.baseobjspace import W_Root
 from pypy.interpreter.error import OperationError, oefmt
-from pypy.interpreter.gateway import (WrappedDefault, unwrap_spec, applevel,
-    interp2app)
+from pypy.interpreter.gateway import (
+    WrappedDefault, applevel, interp2app, unwrap_spec)
 from pypy.interpreter.generator import GeneratorIterator
 from pypy.interpreter.signature import Signature
 from pypy.interpreter.typedef import TypeDef
 from pypy.objspace.std.bytesobject import W_BytesObject
 from pypy.objspace.std.floatobject import W_FloatObject
 from pypy.objspace.std.intobject import W_IntObject
-from pypy.objspace.std.iterobject import (W_FastListIterObject,
-    W_ReverseSeqIterObject)
+from pypy.objspace.std.iterobject import (
+    W_FastListIterObject, W_ReverseSeqIterObject)
 from pypy.objspace.std.sliceobject import W_SliceObject, unwrap_start_stop
 from pypy.objspace.std.tupleobject import W_AbstractTupleObject
 from pypy.objspace.std.unicodeobject import W_UnicodeObject
 from pypy.objspace.std.util import get_positive_index, negate
-from rpython.rlib import debug, jit, rerased
-from rpython.rlib.listsort import make_timsort_class
-from rpython.rlib.objectmodel import (
-    instantiate, newlist_hint, resizelist_hint, specialize, import_from_mixin)
-from rpython.tool.sourcetools import func_with_new_name
 
 __all__ = ['W_ListObject', 'make_range_list', 'make_empty_list_with_size']
 
diff --git a/pypy/objspace/std/test/test_complexobject.py b/pypy/objspace/std/test/test_complexobject.py
--- a/pypy/objspace/std/test/test_complexobject.py
+++ b/pypy/objspace/std/test/test_complexobject.py
@@ -1,6 +1,4 @@
 # -*- encoding: utf-8 -*-
-from __future__ import print_function
-
 import py
 
 from pypy.objspace.std.complexobject import W_ComplexObject, _split_complex
diff --git a/rpython/rlib/streamio.py b/rpython/rlib/streamio.py
--- a/rpython/rlib/streamio.py
+++ b/rpython/rlib/streamio.py
@@ -238,7 +238,14 @@
         bufsize = 8192
         result = []
         while True:
-            data = self.read(bufsize)
+            try:
+                data = self.read(bufsize)
+            except OSError:
+                # like CPython < 3.4, partial results followed by an error
+                # are returned as data
+                if not result:
+                    raise
+                break
             if not data:
                 break
             result.append(data)
@@ -657,8 +664,8 @@
             try:
                 data = self.do_read(bufsize)
             except OSError, o:
-                if o.errno != errno.EAGAIN:
-                    raise
+                # like CPython < 3.4, partial results followed by an error
+                # are returned as data
                 if not chunks:
                     raise
                 break
diff --git a/rpython/rlib/test/test_streamio.py b/rpython/rlib/test/test_streamio.py
--- a/rpython/rlib/test/test_streamio.py
+++ b/rpython/rlib/test/test_streamio.py
@@ -1136,6 +1136,24 @@
         assert x.tell() == 0    # detected in this case.  not always.
         # the point of the test is that we don't crash in an assert.
 
+    def test_ignore_ioerror_in_readall_if_nonempty_result(self):
+        # this is the behavior of regular files in CPython 2.7, as
+        # well as of _io.FileIO at least in CPython 3.3.  This is
+        # *not* the behavior of _io.FileIO in CPython 3.4 or 3.5;
+        # see CPython's issue #21090.
+        try:
+            from os import openpty
+        except ImportError:
+            pytest.skip('no openpty on this platform')
+        read_fd, write_fd = openpty()
+        os.write(write_fd, 'Abc\n')
+        os.close(write_fd)
+        x = streamio.DiskFile(read_fd)
+        s = x.readall()
+        assert s == 'Abc\r\n'
+        pytest.raises(OSError, x.readall)
+        x.close()
+
 
 # Speed test
 
diff --git a/rpython/translator/c/src/precommondefs.h b/rpython/translator/c/src/precommondefs.h
--- a/rpython/translator/c/src/precommondefs.h
+++ b/rpython/translator/c/src/precommondefs.h
@@ -44,8 +44,10 @@
 
 #ifdef __GNUC__
 #  define RPY_EXPORTED __attribute__((visibility("default")))
+#  define RPY_HIDDEN   __attribute__((visibility("hidden")))
 #else
 #  define RPY_EXPORTED __declspec(dllexport)
+#  define RPY_HIDDEN   /* nothing */
 #endif
 #ifndef RPY_EXPORTED_FOR_TESTS
 #  define RPY_EXPORTED_FOR_TESTS  /* nothing */
diff --git a/rpython/translator/c/support.py b/rpython/translator/c/support.py
--- a/rpython/translator/c/support.py
+++ b/rpython/translator/c/support.py
@@ -38,6 +38,8 @@
     if is_exported:
         assert not is_thread_local
         prefix = "RPY_EXPORTED "
+    elif standalone:
+        prefix += "RPY_HIDDEN "
 
     cdecl_str = prefix + cdecl(ctype, cname)
     if standalone:


More information about the pypy-commit mailing list