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 unsupported-binary-operation on Django Q objects #7953

Closed
masiak2 opened this issue Dec 16, 2022 · 2 comments
Closed

False-positive unsupported-binary-operation on Django Q objects #7953

masiak2 opened this issue Dec 16, 2022 · 2 comments
Labels
Duplicate 🐫 Duplicate of an already existing issue Lib specific 💅 This affect the code from a particular library

Comments

@masiak2
Copy link

masiak2 commented Dec 16, 2022

Bug description

from django.db import models
from django.db.models import Q


class Author(models.Model):
    name = models.CharField(max_length=200)
    email = models.EmailField()


# this is fine
qs = Author.objects.filter(Q(name="x") | Q(name="y"))

# this throws an unsupported-binary-operation error
qs2 = Author.objects.filter(Q(name="x") | Q(name="y") | Q(name="z"))

Configuration

No response

Command used

pylint test_pylint.py

Pylint output

test_pylint.py:15:28: E1131: unsupported operand type(s) for | (unsupported-binary-operation)

Expected behavior

no error on this line

Pylint version

pylint 2.15.8
astroid 2.12.13
Python 3.8.9 (default, Apr 13 2022, 08:48:06) 
[Clang 13.1.6 (clang-1316.0.21.2.5)]

OS / Environment

No response

Additional dependencies

asgiref==3.5.2
astroid==2.12.13
dill==0.3.6
Django==3.2.16
isort==5.11.2
lazy-object-proxy==1.8.0
mccabe==0.7.0
platformdirs==2.6.0
pylint==2.15.8
pylint-django==2.5.3
pylint-plugin-utils==0.7
pytz==2022.6
sqlparse==0.4.3
tomli==2.0.1
tomlkit==0.11.6
typing_extensions==4.4.0
wrapt==1.14.1

also I have checked it on django==4.1.4 - still the same issue

@masiak2 masiak2 added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Dec 16, 2022
@Pierre-Sassoulas Pierre-Sassoulas added the Lib specific 💅 This affect the code from a particular library label Dec 16, 2022
@glennmatthews
Copy link
Contributor

Possible duplicate of #7381?

@Pierre-Sassoulas
Copy link
Member

Nice catch @glennmatthews, let's close as duplicate I added a comment in the other issue

@Pierre-Sassoulas Pierre-Sassoulas closed this as not planned Won't fix, can't repro, duplicate, stale Dec 21, 2022
@Pierre-Sassoulas Pierre-Sassoulas added Duplicate 🐫 Duplicate of an already existing issue and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate 🐫 Duplicate of an already existing issue Lib specific 💅 This affect the code from a particular library
Projects
None yet
Development

No branches or pull requests

3 participants