Skip to content

False positive in 2.7.0: kazoo unpacking-non-sequence #4137

Open
@PereBal

Description

@PereBal

Steps to reproduce

  1. Create the following files:

pt1.py

"Something"
from kazoo.client import KazooClient

KAZOO_CLIENT = None

def init_kazoo_client() -> KazooClient:
    "initialize"
    global KAZOO_CLIENT  # pylint: disable=global-statement
    KAZOO_CLIENT = KazooClient()
    KAZOO_CLIENT.start()
    return KAZOO_CLIENT

def get_kazoo_client() -> KazooClient:
    "get client"
    global KAZOO_CLIENT  # pylint: disable=global-statement
    assert KAZOO_CLIENT is not None, "Uh oh"
    return KAZOO_CLIENT

pt.py

"Something"
import pt1

pt1.init_kazoo_client()

ZKCONN: pt1.KazooClient = pt1.get_kazoo_client()
DATA, STAT = ZKCONN.get("/bogus-path")
  1. Run pylint pt1.py pt.py

Current behavior

Pylint errors out with

************* Module pt
pt.py:7:0: E0633: Attempting to unpack a non-sequence defined at line 28 of kazoo.handlers.utils (unpacking-non-sequence)

Expected behavior

Pylint does not error out as it was doing before v2.7.0 . kazoo.client.KazooClient.get should return a tuple or raise an exception as per their docs

pylint --version output

$ pylint --version
pylint 2.7.0
astroid 2.5
Python 3.7.9 (default, Nov 18 2020, 14:10:47) 
[GCC 8.3.0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    False Positive 🦟A message is emitted but nothing is wrong with the codeLib specific 💅This affect the code from a particular libraryNeeds investigation 🔬A bug or crash where it's not immediately obvious what is happenningRegression

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions