Skip to content

[Polly] Use "is" instead of "==" to check for None #94021

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

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion polly/lib/External/isl/interface/python.cc
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ static void print_persistent_callback_failure_check(int indent,
printf(fmt, 0);
printf(", '%s') and ", callback_name.c_str());
printf(fmt, 0);
printf(".%s['exc_info'] != None:\n", callback_name.c_str());
printf(".%s['exc_info'] is not None:\n", callback_name.c_str());
print_indent(indent, " exc_info = ");
printf(fmt, 0);
printf(".%s['exc_info'][0]\n", callback_name.c_str());
Expand Down
4 changes: 2 additions & 2 deletions polly/lib/External/isl/libisl-gdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def invoke(self, arg, from_tty):
arg = gdb.parse_and_eval(arg)
printer = str_lookup_function(arg)

if printer == None:
if printer is None:
print("No isl printer for this type")
return

Expand All @@ -90,7 +90,7 @@ def str_lookup_function(val):
lookup_tag = val.type.target()
regex = re.compile("^isl_(.*)$")

if lookup_tag == None:
if lookup_tag is None:
return None

m = regex.match(str(lookup_tag))
Expand Down
4 changes: 2 additions & 2 deletions polly/lib/External/isl/python/isl.py.top
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ from ctypes import *
from ctypes.util import find_library

isl_dyld_library_path = os.environ.get('ISL_DYLD_LIBRARY_PATH')
if isl_dyld_library_path != None:
if isl_dyld_library_path is not None:
os.environ['DYLD_LIBRARY_PATH'] = isl_dyld_library_path
try:
isl = cdll.LoadLibrary(isl_dlname)
Expand All @@ -29,7 +29,7 @@ class Context:

@staticmethod
def getDefaultInstance():
if Context.defaultInstance == None:
if Context.defaultInstance is None:
Context.defaultInstance = Context()
return Context.defaultInstance

Expand Down
2 changes: 1 addition & 1 deletion polly/test/lit.site.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ config.extra_paths = "@POLLY_TEST_EXTRA_PATHS@".split(";")
## Check the current platform with regex
import re
EAT_ERR_ON_X86 = ' '
if (re.match(r'^x86_64*', '@LLVM_TARGET_TRIPLE@') == None) :
if (re.match(r'^x86_64*', '@LLVM_TARGET_TRIPLE@') is None) :
EAT_ERR_ON_X86 = '|| echo \"error is eaten\"'

for arch in config.targets_to_build.split():
Expand Down
8 changes: 4 additions & 4 deletions polly/utils/pyscop/isl.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def from_ptr(ptr):

@staticmethod
def getDefaultInstance():
if Context.defaultInstance == None:
if Context.defaultInstance is None:
Context.defaultInstance = Context()

return Context.defaultInstance
Expand All @@ -33,12 +33,12 @@ def getDefaultInstance():
class IslObject:
def __init__(self, string="", ctx=None, ptr=None):
self.initialize_isl_methods()
if ptr != None:
if ptr is not None:
self.ptr = ptr
self.ctx = self.get_isl_method("get_ctx")(self)
return

if ctx == None:
if ctx is None:
ctx = Context.getDefaultInstance()

self.ctx = ctx
Expand Down Expand Up @@ -236,7 +236,7 @@ class Printer:
FORMAT_EXT_POLYLIB = 6

def __init__(self, ctx=None):
if ctx == None:
if ctx is None:
ctx = Context.getDefaultInstance()

self.ctx = ctx
Expand Down
Loading