Skip to content

Commit 1817d2a

Browse files
committed
Make test for wrong bool type pass
1 parent 7b004c3 commit 1817d2a

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

python/ql/src/Functions/IncorrectRaiseInSpecialMethod.ql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ predicate preferred_raise(string name, ClassObject ex) {
116116
ordering_method(name) and ex = theTypeErrorType()
117117
or
118118
arithmetic_method(name) and ex = Object::builtin("ArithmeticError")
119+
or
120+
name = "__bool__" and ex = theTypeErrorType()
119121
}
120122

121123
predicate no_need_to_raise(string name, string message) {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
| protocols.py:98:5:98:33 | Function __getitem__ | Function always raises $@; raise LookupError instead | file://:Compiled Code:0:0:0:0 | builtin-class ZeroDivisionError | builtin-class ZeroDivisionError |
22
| protocols.py:101:5:101:26 | Function __getattr__ | Function always raises $@; raise AttributeError instead | file://:Compiled Code:0:0:0:0 | builtin-class ZeroDivisionError | builtin-class ZeroDivisionError |
3+
| protocols.py:124:5:124:23 | Function __bool__ | Function always raises $@; raise TypeError instead | file://:Compiled Code:0:0:0:0 | builtin-class ZeroDivisionError | builtin-class ZeroDivisionError |

0 commit comments

Comments
 (0)