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

unnecessary-ellipsis false-positive when using ... in lambda #6036

Closed
The-Compiler opened this issue Mar 29, 2022 · 0 comments · Fixed by #6039
Closed

unnecessary-ellipsis false-positive when using ... in lambda #6036

The-Compiler opened this issue Mar 29, 2022 · 0 comments · Fixed by #6039
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code

Comments

@The-Compiler
Copy link
Contributor

The-Compiler commented Mar 29, 2022

Bug description

Similarly to what's been reported in #5973, this:

# pylint: disable=missing-module-docstring
print("x", lambda: ...)

results in a false-positive unnecessary-ellipsis.

While that might be a strange thing to do, I use it to make PyYAML able to save/restore ...:

# Translate ... to ellipsis in YAML.
YamlLoader.add_constructor('!ellipsis', lambda loader, node: ...)
YamlLoader.add_implicit_resolver('!ellipsis', re.compile(r'\.\.\.'), None)

I bisected this to 78eed6a, part of #5470 ("New checker - Detect use of unnecessary ellipsis").

Configuration

No response

Command used

pylint repro2.py

Pylint output

************* Module repro2
repro2.py:2:19: W2301: Unnecessary ellipsis constant (unnecessary-ellipsis)

Expected behavior

No warning.

Pylint version

pylint 2.13.2
astroid 2.11.2
Python 3.8.12 (default, Mar  3 2022, 18:19:28) 
[GCC 11.2.0]

(environment in which I originally encountered the bug - output above is from a git install of both astroid and pylint)

OS / Environment

Archlinux

Additional dependencies

No response

@The-Compiler The-Compiler added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Mar 29, 2022
The-Compiler added a commit to qutebrowser/qutebrowser that referenced this issue Mar 29, 2022
@Pierre-Sassoulas Pierre-Sassoulas added False Positive 🦟 A message is emitted but nothing is wrong with the code and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Mar 29, 2022
mbyrnepr2 pushed a commit to mbyrnepr2/pylint that referenced this issue Mar 29, 2022
… ellipsis is used in a lambda expression.

  Closes pylint-dev#6036
Pierre-Sassoulas added a commit that referenced this issue Mar 30, 2022
When an ellipsis is used in a lambda expression.

  Closes #6036

Co-authored-by: Mark Byrne <mark.byrne@rabobank.com>
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Pierre-Sassoulas added a commit that referenced this issue Mar 31, 2022
When an ellipsis is used in a lambda expression.

  Closes #6036

Co-authored-by: Mark Byrne <mark.byrne@rabobank.com>
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
twigleingrid pushed a commit to twigleingrid/qutebrowser that referenced this issue May 13, 2022
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants