[issue22367] Add open_file_descriptor parameter to fcntl.lockf() (use the new F_OFD_SETLK flag)

Dong-hee Na report at bugs.python.org
Sun Nov 17 21:13:58 EST 2019


Dong-hee Na <donghee.na92 at gmail.com> added the comment:

This cause of failure PR 17010 was due to change of start methods as follows:
https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods
Changed in version 3.8: On macOS, the spawn start method is now the default. The fork start method should be considered unsafe as it can lead to crashes of the subprocess. See bpo-33725.


So I updated the test through PR 17154 and I check that my local mac machine works well. (I did not check it on my local mac machine when I submitted PR 17010 since open description lock was Linux feature, this was my mistake)

And thanks to the tip from Michael Felt, I update the test to skip on the AIX machine. So I expect that when PR 17154 is landed, everything will go well.

➜  cpython git:(bpo-22367-test-fix) ✗ ./python.exe Lib/test/test_fcntl.py -v
struct.pack:  b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00'
test_fcntl_64_bit (__main__.TestFcntl) ... skipped 'F_NOTIFY or DN_MULTISHOT unavailable'
test_fcntl_bad_file (__main__.TestFcntl) ... ok
test_fcntl_bad_file_overflow (__main__.TestFcntl) ... ok
test_fcntl_f_getpath (__main__.TestFcntl) ... ok
test_fcntl_file_descriptor (__main__.TestFcntl) ... Status from fcntl with O_NONBLOCK:  0
String from fcntl with F_SETLKW:  b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00'
ok
test_fcntl_fileno (__main__.TestFcntl) ... Status from fcntl with O_NONBLOCK:  0
String from fcntl with F_SETLKW:  b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00'
ok
test_flock (__main__.TestFcntl) ... ok
test_flock_overflow (__main__.TestFcntl) ... ok
test_lockf_exclusive (__main__.TestFcntl) ... struct.pack:  b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00'
ok
test_lockf_share (__main__.TestFcntl) ... struct.pack:  b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00'
ok

----------------------------------------------------------------------

Ran 10 tests in 0.246s

OK (skipped=1)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue22367>
_______________________________________


More information about the Python-bugs-list mailing list