Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

threading lock.acquire unexpected-keyword-arg timeout #2457

Labels
Bug 🪲 Good first issue Friendly and approachable by new contributors Needs astroid Brain 🧠 Needs a brain tip in astroid (then an astroid upgrade)

Comments

@annatisch
Copy link

Pylint does not recognize the timeout keyword, although it has been included since Python v3.2:
https://docs.python.org/3/library/threading.html#lock-objects

Steps to reproduce

pylint_test.py

import threading

test_lock = threading.Lock()
test_lock.acquire(timeout=10)
test_lock.release()

Current behavior

(env_d) C:\Users\annatisch\Documents\test>pylint pylint_test.py
************* Module pylint_test
pylint_test.py:5:0: C0304: Final newline missing (missing-final-newline)
pylint_test.py:4:0: E1123: Unexpected keyword argument 'timeout' in method call (unexpected-keyword-arg)

Expected behavior

(env_d) C:\Users\annatisch\Documents\test>pylint pylint_test.py
************* Module pylint_test
pylint_test.py:5:0: C0304: Final newline missing (missing-final-newline)

pylint --version output

(env_d) C:\Users\annatisch\Documents\test>pylint --version
pylint 2.1.1
astroid 2.0.4
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)]

I have also tested this with pylint 1.8

@PCManticore
Copy link
Contributor

Thanks for reporting an issue! We should modify the brain_threading brain to account for the additional parameter.

@PCManticore PCManticore added Bug 🪲 Good first issue Friendly and approachable by new contributors Needs astroid Brain 🧠 Needs a brain tip in astroid (then an astroid upgrade) labels Aug 31, 2018
@annatisch
Copy link
Author

@PCManticore - Thank you!! :)

clrpackages pushed a commit to clearlinux-pkgs/astroid that referenced this issue Nov 26, 2018
…result result of a class with an uninferable ``__call__`` method.

Christoph Reiter (1):
      brain_gi: use Exception as a base class for classes inheriting from Exception

Claudiu Popa (53):
      Add support for `argparse.Namespace`
      Simplify the code now that every class is newstyle class
      `async` functions are now inferred as `AsyncGenerator` when inferring their call result.
      Update the PR template to be more user friendly
      Filter out ``Uninferable`` when inferring the call result result of a class with an uninferable ``__call__`` method.
      Mark this release as a dev release. Close #608
      Disable lint error
      Add digest_size parameter to hashlib.blake2b and blake2s
      Correct line numbering for f-strings for complex embedded expressions
      Remove test depending on mechanize, we'll most likely not install every library we have brain tips for
      Use skipif instead of the missing skipunless and remove test for pygtk
      pytest why are you being so weird? add missing reason keyword argument
      Pass parameters by keyword name when inferring sequences.
      ``threading.Lock.acquire`` has the ``timeout`` parameter now.
      unused-variable is now unused-import
      wildcard-import is no longer emitted on __init__ files
      Switch to latest pylint's from Github
      Remove the absolute to relative path transform for coverage, which is no longer needed as tests are not installed with the package anymore
      Use the correct coverage file and make sure to delete the correct coverage file
      Use --append and drop the use of .envname
      Rename asspath to assign_path to be more indicative of what it actually means
      Add the pre-commit hook
      Initial formatting of astroid
      Add black step in tox.ini and Travis, as well as the badge
      Switch to stages for travis jobs
      Change the line endings of the pylint config file
      Let formatting be handled by black
      Use copy_context where it makes sense
      Simplify the creation of extra_context for _infer_call
      Remove the restore_path() method
      Replace copy.copy() with a simple set() call
      Replace checks against None and Uninferable to boolean checks
      Replace a nested for loop with itertools.product
      Remove unneeded comment
      Use a generator expression for _multiply_seq_by_int
      Use itertools.chain to join multiple generators together
      Remove some unneeded comments and use yield from
      Use None as a sentinel
      Add some caching to the transforms and skip non nodes in visit_generic
      Use generators for string joining instead of creating temporary lists
      Cache the result of get_assign_nodes
      Remove Python 2 branches
      YES is gone, we're using Uninferable for quite some time now
      Use yield from
      Update some leftover docstrings
      Lose an indentation level in ancestors() by continuing if recursing wasn't passed
      Disable useless-supression for now
      Replace a nested for loop with a product() call
      Pass a parent in raw_building when building a new Function or Class
      Reuse the cls variable inferred earlier
      Revert "Pass a parent in raw_building when building a new Function or Class"
      Don't call inference in the functools transform
      Prepare 2.1.0

Daniel Martin (1):
      Multiple "value" or "slice" values on subscript inference.

David Poirier (1):
      fix hashlib.blake2* signatures

HQupgradeHQ (1):
      text

Jeff Widman (1):
      Fix typo

Serhiy Storchaka (1):
      Reflect AST changes in Python 3.8.

wgehalo (1):
      Add blake2s to hashing algorithims.

What's New in astroid 2.1.0?
============================
Release Date: 2018-11-25

   * ``threading.Lock.acquire`` has the ``timeout`` parameter now.

     Close pylint-dev/pylint#2457

   * Pass parameters by keyword name when inferring sequences.

     Close pylint-dev/pylint#2526

   * Correct line numbering for f-strings for complex embedded expressions

     When a f-string contained a complex expression, such as an attribute access,

(NEWS truncated at 15 lines)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment