diff options
author | Matti Picus <matti.picus@gmail.com> | 2014-05-08 19:36:08 +0300 |
---|---|---|
committer | Matti Picus <matti.picus@gmail.com> | 2014-05-08 19:36:08 +0300 |
commit | 3a6b704498a7dd87fb4416f927fbe68b17fd3483 (patch) | |
tree | 2a9f3edf3577ccb38e33ba4bb9ec99f6c9367634 | |
parent | update whatsnew (diff) | |
parent | fix ioctl with negative code param on osx (diff) | |
download | pypy-release-2.3.tar.gz pypy-release-2.3.tar.bz2 pypy-release-2.3.zip |
merge headsrelease-2.3
-rw-r--r-- | pypy/module/fcntl/interp_fcntl.py | 4 | ||||
-rw-r--r-- | pypy/module/fcntl/test/test_fcntl.py | 29 |
2 files changed, 30 insertions, 3 deletions
diff --git a/pypy/module/fcntl/interp_fcntl.py b/pypy/module/fcntl/interp_fcntl.py index e66daed4de..f3dca00aa4 100644 --- a/pypy/module/fcntl/interp_fcntl.py +++ b/pypy/module/fcntl/interp_fcntl.py @@ -62,8 +62,8 @@ _flock = lltype.Ptr(cConfig.flock) fcntl_int = external('fcntl', [rffi.INT, rffi.INT, rffi.INT], rffi.INT) fcntl_str = external('fcntl', [rffi.INT, rffi.INT, rffi.CCHARP], rffi.INT) fcntl_flock = external('fcntl', [rffi.INT, rffi.INT, _flock], rffi.INT) -ioctl_int = external('ioctl', [rffi.INT, rffi.INT, rffi.INT], rffi.INT) -ioctl_str = external('ioctl', [rffi.INT, rffi.INT, rffi.CCHARP], rffi.INT) +ioctl_int = external('ioctl', [rffi.INT, rffi.UINT, rffi.INT], rffi.INT) +ioctl_str = external('ioctl', [rffi.INT, rffi.UINT, rffi.CCHARP], rffi.INT) has_flock = cConfig.has_flock if has_flock: diff --git a/pypy/module/fcntl/test/test_fcntl.py b/pypy/module/fcntl/test/test_fcntl.py index 17d56577a5..27c6fe9ea6 100644 --- a/pypy/module/fcntl/test/test_fcntl.py +++ b/pypy/module/fcntl/test/test_fcntl.py @@ -11,7 +11,9 @@ def teardown_module(mod): os.unlink(i) class AppTestFcntl: - spaceconfig = dict(usemodules=('fcntl', 'array', 'struct', 'termios', 'select', 'rctime')) + spaceconfig = dict(usemodules=('fcntl', 'array', 'struct', 'termios', + 'select', 'rctime')) + def setup_class(cls): tmpprefix = str(udir.ensure('test_fcntl', dir=1).join('tmp_')) cls.w_tmp = cls.space.wrap(tmpprefix) @@ -267,6 +269,31 @@ class AppTestFcntl: os.close(mfd) os.close(sfd) + def test_ioctl_signed_unsigned_code_param(self): + import fcntl + import os + import pty + import struct + import termios + + mfd, sfd = pty.openpty() + try: + if termios.TIOCSWINSZ < 0: + set_winsz_opcode_maybe_neg = termios.TIOCSWINSZ + set_winsz_opcode_pos = termios.TIOCSWINSZ & 0xffffffffL + else: + set_winsz_opcode_pos = termios.TIOCSWINSZ + set_winsz_opcode_maybe_neg, = struct.unpack("i", + struct.pack("I", termios.TIOCSWINSZ)) + + our_winsz = struct.pack("HHHH",80,25,0,0) + # test both with a positive and potentially negative ioctl code + new_winsz = fcntl.ioctl(mfd, set_winsz_opcode_pos, our_winsz) + new_winsz = fcntl.ioctl(mfd, set_winsz_opcode_maybe_neg, our_winsz) + finally: + os.close(mfd) + os.close(sfd) + def test_large_flag(self): import sys if any(plat in sys.platform |