Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 40c8f23

Browse files
committed
Merged revisions 64903 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r64903 | brett.cannon | 2008-07-12 18:15:07 -0700 (Sat, 12 Jul 2008) | 6 lines dummy_thread.acquire() would return None if no waitflag argument was given. It should have returned True. Fixes issue #3339. Thanks, Henk Punt for the report and Andrii v. Mishkovskiyi for attempting a patch. ........
1 parent 91b3d8d commit 40c8f23

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

Lib/_dummy_thread.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,15 @@ def acquire(self, waitflag=None):
104104
aren't triggered and throw a little fit.
105105
106106
"""
107-
if waitflag is None:
107+
if waitflag is None or waitflag:
108108
self.locked_status = True
109-
return None
110-
elif not waitflag:
109+
return True
110+
else:
111111
if not self.locked_status:
112112
self.locked_status = True
113113
return True
114114
else:
115115
return False
116-
else:
117-
self.locked_status = True
118-
return True
119116

120117
__enter__ = acquire
121118

Lib/test/test_dummy_thread.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def test_uncond_acquire_return_val(self):
6060
#Make sure that an unconditional locking returns True.
6161
self.failUnless(self.lock.acquire(1) is True,
6262
"Unconditional locking did not return True.")
63+
self.failUnless(self.lock.acquire() is True)
6364

6465
def test_uncond_acquire_blocking(self):
6566
#Make sure that unconditional acquiring of a locked lock blocks.

0 commit comments

Comments
 (0)