From 2acca90eab93569f9482b1c7595c30207afcbe7c Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Wed, 7 Jun 2023 06:39:37 -0400 Subject: [PATCH] Add regression test for #8554 (#8682) Co-authored-by: Pierre Sassoulas --- doc/whatsnew/fragments/8554.bugfix | 3 +++ tests/functional/i/invalid/invalid_unary_operand_type.py | 7 +++++++ 2 files changed, 10 insertions(+) create mode 100644 doc/whatsnew/fragments/8554.bugfix diff --git a/doc/whatsnew/fragments/8554.bugfix b/doc/whatsnew/fragments/8554.bugfix new file mode 100644 index 0000000000..5bb60ae157 --- /dev/null +++ b/doc/whatsnew/fragments/8554.bugfix @@ -0,0 +1,3 @@ +Fixed crash when a call to ``super()`` was placed after an operator (e.g. ``not``). + +Closes #8554 diff --git a/tests/functional/i/invalid/invalid_unary_operand_type.py b/tests/functional/i/invalid/invalid_unary_operand_type.py index 5881f89ec9..3f8c824851 100644 --- a/tests/functional/i/invalid/invalid_unary_operand_type.py +++ b/tests/functional/i/invalid/invalid_unary_operand_type.py @@ -49,3 +49,10 @@ class A: invert_instance = ~A() # [invalid-unary-operand-type] invert_module = ~collections # [invalid-unary-operand-type] invert_float = ~2.0 # [invalid-unary-operand-type] + + +class NoArgumentSuper: + def __init__(self): + """https://github.com/pylint-dev/pylint/issues/8554""" + if not isinstance(super(), float): + pass