Skip to content

Commit e070ea3

Browse files
committed
fix(polly/**.py): fix comparison to None
from PEP8 (https://peps.python.org/pep-0008/#programming-recommendations): > Comparisons to singletons like None should always be done with is or > is not, never the equality operators.
1 parent f372bb4 commit e070ea3

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

polly/lib/External/isl/interface/python.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ static void print_persistent_callback_failure_check(int indent,
347347
printf(fmt, 0);
348348
printf(", '%s') and ", callback_name.c_str());
349349
printf(fmt, 0);
350-
printf(".%s['exc_info'] != None:\n", callback_name.c_str());
350+
printf(".%s['exc_info'] is not None:\n", callback_name.c_str());
351351
print_indent(indent, " exc_info = ");
352352
printf(fmt, 0);
353353
printf(".%s['exc_info'][0]\n", callback_name.c_str());

polly/lib/External/isl/libisl-gdb.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def invoke(self, arg, from_tty):
7070
arg = gdb.parse_and_eval(arg)
7171
printer = str_lookup_function(arg)
7272

73-
if printer == None:
73+
if printer is None:
7474
print("No isl printer for this type")
7575
return
7676

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

93-
if lookup_tag == None:
93+
if lookup_tag is None:
9494
return None
9595

9696
m = regex.match(str(lookup_tag))

polly/lib/External/isl/python/isl.py.top

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ from ctypes import *
33
from ctypes.util import find_library
44

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

3030
@staticmethod
3131
def getDefaultInstance():
32-
if Context.defaultInstance == None:
32+
if Context.defaultInstance is None:
3333
Context.defaultInstance = Context()
3434
return Context.defaultInstance
3535

polly/test/lit.site.cfg.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ config.extra_paths = "@POLLY_TEST_EXTRA_PATHS@".split(";")
1414
## Check the current platform with regex
1515
import re
1616
EAT_ERR_ON_X86 = ' '
17-
if (re.match(r'^x86_64*', '@LLVM_TARGET_TRIPLE@') == None) :
17+
if (re.match(r'^x86_64*', '@LLVM_TARGET_TRIPLE@') is None) :
1818
EAT_ERR_ON_X86 = '|| echo \"error is eaten\"'
1919

2020
for arch in config.targets_to_build.split():

polly/utils/pyscop/isl.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def from_ptr(ptr):
2424

2525
@staticmethod
2626
def getDefaultInstance():
27-
if Context.defaultInstance == None:
27+
if Context.defaultInstance is None:
2828
Context.defaultInstance = Context()
2929

3030
return Context.defaultInstance
@@ -33,12 +33,12 @@ def getDefaultInstance():
3333
class IslObject:
3434
def __init__(self, string="", ctx=None, ptr=None):
3535
self.initialize_isl_methods()
36-
if ptr != None:
36+
if ptr is not None:
3737
self.ptr = ptr
3838
self.ctx = self.get_isl_method("get_ctx")(self)
3939
return
4040

41-
if ctx == None:
41+
if ctx is None:
4242
ctx = Context.getDefaultInstance()
4343

4444
self.ctx = ctx
@@ -236,7 +236,7 @@ class Printer:
236236
FORMAT_EXT_POLYLIB = 6
237237

238238
def __init__(self, ctx=None):
239-
if ctx == None:
239+
if ctx is None:
240240
ctx = Context.getDefaultInstance()
241241

242242
self.ctx = ctx

0 commit comments

Comments
 (0)