summaryrefslogtreecommitdiff
path: root/Lib/test/test_fcntl.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2009-05-24 15:40:09 +0000
committerAntoine Pitrou <solipsis@pitrou.net>2009-05-24 15:40:09 +0000
commit1324ae46519bbe14a72fc09c573d9afc1fdcfc45 (patch)
tree6410759893e6ded32ddcb2d9e41d846f2e5b8fdd /Lib/test/test_fcntl.py
parente44e02795db49eca4a4e42f08056d10c357f6ba4 (diff)
downloadcpython-1324ae46519bbe14a72fc09c573d9afc1fdcfc45.tar.gz
Issue #1309352: fcntl now converts its third arguments to a C `long` rather
than an int, which makes some operations possible under 64-bit Linux (e.g. DN_MULTISHOT with F_NOTIFY).
Diffstat (limited to 'Lib/test/test_fcntl.py')
-rwxr-xr-xLib/test/test_fcntl.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/Lib/test/test_fcntl.py b/Lib/test/test_fcntl.py
index 2c5ac11b42..c8ea7b7ea5 100755
--- a/Lib/test/test_fcntl.py
+++ b/Lib/test/test_fcntl.py
@@ -61,7 +61,7 @@ class TestFcntl(unittest.TestCase):
self.f = None
def tearDown(self):
- if not self.f.closed:
+ if self.f and not self.f.closed:
self.f.close()
unlink(TESTFN)
@@ -85,6 +85,21 @@ class TestFcntl(unittest.TestCase):
rv = fcntl.fcntl(self.f, fcntl.F_SETLKW, lockdata)
self.f.close()
+ def test_fcntl_64_bit(self):
+ # Issue #1309352: fcntl shouldn't fail when the third arg fits in a
+ # C 'long' but not in a C 'int'.
+ try:
+ cmd = fcntl.F_NOTIFY
+ # This flag is larger than 2**31 in 64-bit builds
+ flags = fcntl.DN_MULTISHOT
+ except AttributeError:
+ self.skipTest("F_NOTIFY or DN_MULTISHOT unavailable")
+ fd = os.open(os.path.dirname(os.path.abspath(TESTFN)), os.O_RDONLY)
+ try:
+ fcntl.fcntl(fd, cmd, flags)
+ finally:
+ os.close(fd)
+
def test_main():
run_unittest(TestFcntl)