File tree 3 files changed +17
-3
lines changed
3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ What's New in astroid 2.1.0?
6
6
============================
7
7
Release Date: TBA
8
8
9
+ * ``threading.Lock.acquire`` has the ``timeout`` parameter now.
10
+
11
+ Close PyCQA/pylint#2457
12
+
9
13
* Pass parameters by keyword name when inferring sequences.
10
14
11
15
Close PyCQA/pylint#2526
Original file line number Diff line number Diff line change 4
4
5
5
# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
6
6
# For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER
7
-
8
7
import astroid
9
8
10
9
11
10
def _thread_transform ():
12
11
return astroid .parse ('''
13
12
class lock(object):
14
- def acquire(self, blocking=True):
13
+ def acquire(self, blocking=True, timeout=-1 ):
15
14
pass
16
15
def release(self):
17
16
pass
Original file line number Diff line number Diff line change @@ -488,7 +488,18 @@ def test_multiprocessing_manager(self):
488
488
489
489
class ThreadingBrainTest (unittest .TestCase ):
490
490
def test_lock (self ):
491
- self ._test_lock_object ('Lock' )
491
+ lock_instance = builder .extract_node ("""
492
+ import threading
493
+ threading.Lock()
494
+ """ )
495
+ inferred = next (lock_instance .infer ())
496
+ self .assert_is_valid_lock (inferred )
497
+
498
+ acquire_method = inferred .getattr ('acquire' )[0 ]
499
+ parameters = [
500
+ param .name for param in acquire_method .args .args [1 :]
501
+ ]
502
+ assert parameters == ['blocking' , 'timeout' ]
492
503
493
504
def test_rlock (self ):
494
505
self ._test_lock_object ('RLock' )
You can’t perform that action at this time.
0 commit comments