longld / peda

PEDA - Python Exploit Development Assistance for GDB
Other
5.87k stars 806 forks source link

Use `==` instead of `is` when comparing with literal #160

Closed xinan closed 3 years ago

xinan commented 3 years ago

gdb spits SyntaxWarning: "is" with a literal. Did you mean "=="? on startup.

Generally == should be used unless we are trying to check if both sides are the same object.

x is 3 works because Python stores small integers at a fixed address. It won't work as intended if the literal is large. For example:

> x = 300
> x is 300
False