Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r95083:b9bbd6c09333
Date: 2018-09-05 21:20 +0200
http://bitbucket.org/pypy/pypy/changeset/b9bbd6c09333/

Log:    I remember now why we moved away from using CPython's definition of
        constants. Now translation (and own tests) pass again under PyPy.

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,7 +3,7 @@
 
 import sys
 import os
-import select
+from rpython.rlib import _rsocket_rffi as _c
 
 
 class Module(MixedModule):
@@ -15,9 +15,6 @@
         'error' : 'space.fromcache(interp_select.Cache).w_error',
     }
 
-    if hasattr(select, 'PIPE_BUF'):
-        interpleveldefs['PIPE_BUF'] = 'space.wrap(%r)' % select.PIPE_BUF
-
     if os.name =='posix':
         interpleveldefs['poll'] = 'interp_select.poll'
 
@@ -35,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/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')
@@ -1081,6 +1083,7 @@
 EWOULDBLOCK = cConfig.EWOULDBLOCK or cConfig.WSAEWOULDBLOCK
 EAFNOSUPPORT = cConfig.EAFNOSUPPORT or cConfig.WSAEAFNOSUPPORT
 EISCONN = cConfig.EISCONN or cConfig.WSAEISCONN
+PIPE_BUF = cConfig.PIPE_BUF    # may be None
 
 linux = cConfig.linux
 WIN32 = cConfig.WIN32
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to