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

false-positive errors with pyroute2 0.7.6 #8497

Open
gthiemonge opened this issue Mar 27, 2023 · 0 comments
Open

false-positive errors with pyroute2 0.7.6 #8497

gthiemonge opened this issue Mar 27, 2023 · 0 comments
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code Lib specific 💅 This affect the code from a particular library Needs investigation 🔬 A bug or crash where it's not immediately obvious what is happenning

Comments

@gthiemonge
Copy link

gthiemonge commented Mar 27, 2023

Bug description

When using pylint with pyroute2 0.7.6, it detects false-positive issues:

The following code is valid pyroute2 code:

import sys

import pyroute2

with pyroute2.IPRoute() as ipr:
    idx = ipr.link_lookup(ifname=sys.argv[1])[0]
    link = ipr.get_links(idx)[0]
    print(link)

But with the pyroute2 0.7.6 release, pylint detects some false-positive problems:

$ pip install pyroute2 pylint
Collecting pyroute2
  Using cached pyroute2-0.7.6-py3-none-any.whl (454 kB)
Collecting pylint
  Using cached pylint-2.17.1-py3-none-any.whl (535 kB)
[...]
$ pylint test_pyroute.py
************* Module test_pyroute
test_pyroute.py:7:11: E1136: Value 'ipr.get_links(idx)' is unsubscriptable (unsubscriptable-object)
test_pyroute.py:7:11: E1121: Too many positional arguments for method call (too-many-function-args)

https://github.com/svinota/pyroute2/blob/master/pyroute2/iproute/linux.py#L434

the get_links function takes positional arguments and returns a list.

(Note that pylint works fine with pyroute2 0.7.5)

Command used

pylint test_pyroute.py

Pylint output

************* Module test_pyroute
test_pyroute.py:7:11: E1136: Value 'ipr.get_links(idx)' is unsubscriptable (unsubscriptable-object)
test_pyroute.py:7:11: E1121: Too many positional arguments for method call (too-many-function-args)

Expected behavior

No error

Pylint version

pylint 2.17.1
astroid 2.15.1
Python 3.11.1 (main, Jan  6 2023, 00:00:00) [GCC 12.2.1 20221121 (Red Hat 12.2.1-4)]

OS / Environment

Fedora 37

Additional dependencies

pyroute2==0.7.6

@gthiemonge gthiemonge added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Mar 27, 2023
openstack-mirroring pushed a commit to openstack/openstack that referenced this issue Mar 27, 2023
* Update octavia from branch 'master'
  to afb4d151f73043b592243359a393fe6c4cf8f410
  - Fixing octavia-grenade job and disabling pylint warnings
    
    grenade now updates from an ML2/OVN deployment. Octavia needs to source
    the devstack/lib/octavia file from neutron, which provides the functions
    that manage the octavia management interfaces.
    
    The commit also removes false-positive pylint warnings, an issue was
    reported to the pylint project:
    pylint-dev/pylint#8497
    
    Change-Id: Ie26a154c320d8527e54b871a3b99bbbc3c2ee811
openstack-mirroring pushed a commit to openstack/octavia that referenced this issue Mar 27, 2023
grenade now updates from an ML2/OVN deployment. Octavia needs to source
the devstack/lib/octavia file from neutron, which provides the functions
that manage the octavia management interfaces.

The commit also removes false-positive pylint warnings, an issue was
reported to the pylint project:
pylint-dev/pylint#8497

Change-Id: Ie26a154c320d8527e54b871a3b99bbbc3c2ee811
@Pierre-Sassoulas Pierre-Sassoulas added Needs investigation 🔬 A bug or crash where it's not immediately obvious what is happenning False Positive 🦟 A message is emitted but nothing is wrong with the code Lib specific 💅 This affect the code from a particular library and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code Lib specific 💅 This affect the code from a particular library Needs investigation 🔬 A bug or crash where it's not immediately obvious what is happenning
Projects
None yet
Development

No branches or pull requests

2 participants