[pypy-svn] pypy default: Fix test_fcntl, by casting all constants to signed longs.

amauryfa commits-noreply at bitbucket.org
Mon Feb 7 22:01:33 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: 
Changeset: r41685:d6115a952624
Date: 2011-02-07 22:00 +0100
http://bitbucket.org/pypy/pypy/changeset/d6115a952624/

Log:	Fix test_fcntl, by casting all constants to signed longs.

diff --git a/pypy/module/fcntl/test/test_fcntl.py b/pypy/module/fcntl/test/test_fcntl.py
--- a/pypy/module/fcntl/test/test_fcntl.py
+++ b/pypy/module/fcntl/test/test_fcntl.py
@@ -196,3 +196,8 @@
         import fcntl
         f = open(self.tmp, "w")
         fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB)
+
+    def test_large_flag(self):
+        import fcntl
+        assert fcntl.DN_MULTISHOT < 0
+        fcntl.fcntl(0, fcntl.F_NOTIFY, fcntl.DN_MULTISHOT)

diff --git a/pypy/module/fcntl/__init__.py b/pypy/module/fcntl/__init__.py
--- a/pypy/module/fcntl/__init__.py
+++ b/pypy/module/fcntl/__init__.py
@@ -1,4 +1,5 @@
 from pypy.interpreter.mixedmodule import MixedModule
+from pypy.rlib.rarithmetic import intmask
 
 class Module(MixedModule):
     interpleveldefs = {
@@ -16,6 +17,7 @@
     def buildloaders(cls):
         from pypy.module.fcntl import interp_fcntl
         for constant, value in interp_fcntl.constants.iteritems():
+            value = intmask(value)
             Module.interpleveldefs[constant] = "space.wrap(%r)" % value
         super(Module, cls).buildloaders()
     buildloaders = classmethod(buildloaders)


More information about the Pypy-commit mailing list