Author: Armin Rigo <ar...@tunes.org>
Branch: py3.5
Changeset: r95090:ae9f77ce8df2
Date: 2018-09-11 15:30 +0200
http://bitbucket.org/pypy/pypy/changeset/ae9f77ce8df2/

Log:    hg merge default

diff --git a/pypy/doc/cpython_differences.rst b/pypy/doc/cpython_differences.rst
--- a/pypy/doc/cpython_differences.rst
+++ b/pypy/doc/cpython_differences.rst
@@ -330,7 +330,8 @@
 -------------
 
 * Hash randomization (``-R``) `is ignored in PyPy`_.  In CPython
-  before 3.4 it has `little point`_.
+  before 3.4 it has `little point`_.  Both CPython >= 3.4 and PyPy3
+  implement the randomized SipHash algorithm and ignore ``-R``.
 
 * You can't store non-string keys in type objects.  For example::
 
diff --git a/pypy/module/select/__init__.py b/pypy/module/select/__init__.py
--- a/pypy/module/select/__init__.py
+++ b/pypy/module/select/__init__.py
@@ -3,6 +3,7 @@
 
 import sys
 import os
+from rpython.rlib import _rsocket_rffi as _c
 
 
 class Module(MixedModule):
@@ -31,6 +32,10 @@
         for symbol in symbol_map:
             interpleveldefs[symbol] = "space.wrap(interp_kqueue.%s)" % symbol
 
+    if _c.PIPE_BUF is not None:
+        interpleveldefs['PIPE_BUF'] = 'space.wrap(%r)' % _c.PIPE_BUF
+
+
     def buildloaders(cls):
         from rpython.rlib import rpoll
         for name in rpoll.eventnames:
diff --git a/pypy/module/select/test/test_select.py 
b/pypy/module/select/test/test_select.py
--- a/pypy/module/select/test/test_select.py
+++ b/pypy/module/select/test/test_select.py
@@ -319,6 +319,11 @@
         # ^^^ CPython gives 100, PyPy gives 1.  I think both are OK as
         # long as there is no crash.
 
+    def test_PIPE_BUF(self):
+        # no PIPE_BUF on Windows; this test class is skipped on Windows.
+        import select
+        assert isinstance(select.PIPE_BUF, int)
+
 
 class AppTestSelectWithSockets(_AppTestSelect):
     """Same tests with connected sockets.
diff --git a/pypy/objspace/std/test/test_unicodeobject.py 
b/pypy/objspace/std/test/test_unicodeobject.py
--- a/pypy/objspace/std/test/test_unicodeobject.py
+++ b/pypy/objspace/std/test/test_unicodeobject.py
@@ -1088,3 +1088,26 @@
         assert u'A\u03a3\u0345'.lower() == u'a\u03c2\u0345'
         assert u'\u03a3\u0345 '.lower() == u'\u03c3\u0345 '
 
+    def test_unicode_constructor_misc(self):
+        x = u'foo'
+        x += u'bar'
+        assert str(x) is x
+        #
+        class U(str):
+            def __str__(self):
+                return u'BOK'
+        u = U(x)
+        assert str(u) == u'BOK'
+        #
+        class U2(str):
+            pass
+        z = U2(u'foobaz')
+        assert type(str(z)) is str
+        assert str(z) == u'foobaz'
+        #
+        e = raises(TypeError, str, u'text', 'supposedly_the_encoding')
+        assert str(e.value) == 'decoding str is not supported'
+        e = raises(TypeError, str, u, 'supposedly_the_encoding')
+        assert str(e.value) == 'decoding str is not supported'
+        e = raises(TypeError, str, z, 'supposedly_the_encoding')
+        assert str(e.value) == 'decoding str is not supported'
diff --git a/rpython/doc/examples.rst b/rpython/doc/examples.rst
--- a/rpython/doc/examples.rst
+++ b/rpython/doc/examples.rst
@@ -19,7 +19,7 @@
   * Typhon, 'A virtual machine for Monte', in active development,
     https://github.com/monte-language/typhon
   * Tulip, an untyped functional language, in language design mode, maintained,
-     https://github.com/tulip-lang/tulip/
+    https://github.com/tulip-lang/tulip/
   * Pycket, a Racket implementation, proof of concept, small language core
     working, a lot of primitives are missing. Slow development 
     https://github.com/samth/pycket
diff --git a/rpython/rlib/_rsocket_rffi.py b/rpython/rlib/_rsocket_rffi.py
--- a/rpython/rlib/_rsocket_rffi.py
+++ b/rpython/rlib/_rsocket_rffi.py
@@ -33,6 +33,7 @@
                 'arpa/inet.h',
                 'stdint.h',
                 'errno.h',
+                'limits.h',
                 )
     if _HAS_AF_PACKET:
         includes += ('netpacket/packet.h',
@@ -113,6 +114,7 @@
     F_GETFL = platform.DefinedConstantInteger('F_GETFL')
     F_SETFL = platform.DefinedConstantInteger('F_SETFL')
     FIONBIO = platform.DefinedConstantInteger('FIONBIO')
+    PIPE_BUF = platform.DefinedConstantInteger('PIPE_BUF')
 
     INVALID_SOCKET = platform.DefinedConstantInteger('INVALID_SOCKET')
     INET_ADDRSTRLEN = platform.DefinedConstantInteger('INET_ADDRSTRLEN')
@@ -1085,6 +1087,7 @@
 WSAEWOULDBLOCK = cConfig.WSAEWOULDBLOCK or cConfig.EWOULDBLOCK
 WSAEAFNOSUPPORT = cConfig.WSAEAFNOSUPPORT or cConfig.EAFNOSUPPORT
 EISCONN = cConfig.EISCONN or cConfig.WSAEISCONN
+PIPE_BUF = cConfig.PIPE_BUF    # may be None
 
 linux = cConfig.linux
 WIN32 = cConfig.WIN32
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to