diff options
author | Ben Nemec <bnemec@redhat.com> | 2014-09-29 18:46:14 +0000 |
---|---|---|
committer | Ben Nemec <bnemec@redhat.com> | 2014-10-03 23:30:43 +0000 |
commit | 2dae1fd780198719f35d79e3b01db26cfc2ebf28 (patch) | |
tree | 82ec03cbac833496a7eb808741829e5d406ab88e | |
parent | 394fbf4f046bcaa4e0591238b9fc06f1769e6ac5 (diff) | |
download | oslo-concurrency-2dae1fd780198719f35d79e3b01db26cfc2ebf28.tar.gz |
Handle Python 3's O_CLOEXEC default
In Python 2, a file opened by a process was inherited by all of its
children. Python 3 sets the O_CLOEXEC flag on the file descriptor
by default so this doesn't happen. Because of the Python 2
behavior, our test code explicitly closes the file descriptor in
one test, but we shouldn't be doing that since it wouldn't happen
in a real usage scenario.
Fortunately, it appears both cases work in a sane fashion anyway.
With the explicit release removed from the child process, the py2
tests still run fine, and with that done the py3 tests no longer
have a problem either. This is fortunate because if the py2
behavior allowed multiple processes to hold the lock at once it
would obviously be a Bad Thing. :-)
Change-Id: I133334dee068984b1309180c5338ac19d9934274
-rw-r--r-- | tests/unit/test_lockutils.py | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/tests/unit/test_lockutils.py b/tests/unit/test_lockutils.py index 9419e30..29488db 100644 --- a/tests/unit/test_lockutils.py +++ b/tests/unit/test_lockutils.py @@ -53,7 +53,6 @@ class LockTestCase(test_base.BaseTestCase): lock = lockutils._FcntlLock(lock_file) def try_lock(): - lock.release() # child co-owns it before fork try: my_lock = lockutils._FcntlLock(lock_file) my_lock.lockfile = open(lock_file, 'w') |