[pypy-commit] pypy arm-backend-2: fix for epoll to avoid that defined constans get casted to a long when running

bivab noreply at buildbot.pypy.org
Thu Jun 21 11:49:47 CEST 2012


Author: David Schneider <david.schneider at picle.org>
Branch: arm-backend-2
Changeset: r55743:05958b49aba6
Date: 2012-06-20 15:03 +0000
http://bitbucket.org/pypy/pypy/changeset/05958b49aba6/

Log:	fix for epoll to avoid that defined constans get casted to a long
	when running app level tests.

	On ARM EPOLLET is defined as 1u << 31 instead of 1 << 31 as it seems
	to be the case on x86 systems (at least those I checked), thus
	getting transformed to a long when running the app level tests on
	top of cpython.

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
@@ -19,9 +19,8 @@
 
     if sys.platform.startswith('linux'):
         interpleveldefs['epoll'] = 'interp_epoll.W_Epoll'
-        from pypy.module.select.interp_epoll import cconfig, public_symbols
-        for symbol in public_symbols:
-            value = cconfig[symbol]
+        from pypy.module.select.interp_epoll import public_symbols
+        for symbol, value in public_symbols.iteritems():
             if value is not None:
                 interpleveldefs[symbol] = "space.wrap(%r)" % value
 
diff --git a/pypy/module/select/interp_epoll.py b/pypy/module/select/interp_epoll.py
--- a/pypy/module/select/interp_epoll.py
+++ b/pypy/module/select/interp_epoll.py
@@ -10,6 +10,7 @@
 from pypy.rpython.tool import rffi_platform
 from pypy.rlib._rsocket_rffi import socketclose, FD_SETSIZE
 from pypy.rlib.rposix import get_errno
+from pypy.rlib.rarithmetic import intmask
 from pypy.translator.tool.cbuild import ExternalCompilationInfo
 
 
@@ -29,11 +30,11 @@
     ("data", CConfig.epoll_data)
 ])
 
-public_symbols = [
+public_symbols = dict.fromkeys([
     "EPOLLIN", "EPOLLOUT", "EPOLLPRI", "EPOLLERR", "EPOLLHUP",
     "EPOLLET", "EPOLLONESHOT", "EPOLLRDNORM", "EPOLLRDBAND",
     "EPOLLWRNORM", "EPOLLWRBAND", "EPOLLMSG"
-    ]
+    ])
 for symbol in public_symbols:
     setattr(CConfig, symbol, rffi_platform.DefinedConstantInteger(symbol))
 
@@ -42,6 +43,10 @@
 
 cconfig = rffi_platform.configure(CConfig)
 
+for symbol in public_symbols:
+    public_symbols[symbol] = intmask(cconfig[symbol])
+
+
 epoll_event = cconfig["epoll_event"]
 EPOLL_CTL_ADD = cconfig["EPOLL_CTL_ADD"]
 EPOLL_CTL_MOD = cconfig["EPOLL_CTL_MOD"]


More information about the pypy-commit mailing list