Compare to `None` using identity `is` operator
This is a trivial change that replaces `==` operator with `is` operator, following PEP 8 guideline:
> Comparisons to singletons like None should always be done with is or is not, never the equality operators.
https://legacy.python.org/dev/peps/pep-0008/#programming-recommendations
diff --git a/scripts/threading_generator.py b/scripts/threading_generator.py
index 74d4b8c..96d1eed 100644
--- a/scripts/threading_generator.py
+++ b/scripts/threading_generator.py
@@ -307,7 +307,7 @@
# this one, it may be necessary to suppress the ExtraProtect,
# or move it below the 'for section...' loop.
#write('// endFeature looking at self.featureExtraProtect', file=self.outFile)
- if (self.featureExtraProtect != None):
+ if (self.featureExtraProtect is not None):
write('#ifdef', self.featureExtraProtect, file=self.outFile)
#write('#define', self.featureName, '1', file=self.outFile)
for section in self.TYPE_SECTIONS:
@@ -320,7 +320,7 @@
if (self.sections['command']):
write('\n'.join(self.sections['command']), end=u'', file=self.outFile)
self.newline()
- if (self.featureExtraProtect != None):
+ if (self.featureExtraProtect is not None):
write('#endif /*', self.featureExtraProtect, '*/', file=self.outFile)
if (self.genOpts.protectFeature):
write('#endif /*', self.featureName, '*/', file=self.outFile)
@@ -405,10 +405,10 @@
return
finishthreadsafety = self.makeThreadUseBlock(cmdinfo.elem, 'finish')
# record that the function will be intercepted
- if (self.featureExtraProtect != None):
+ if (self.featureExtraProtect is not None):
self.intercepts += [ '#ifdef %s' % self.featureExtraProtect ]
self.intercepts += [ ' {"%s", (void*)%s},' % (name,name[2:]) ]
- if (self.featureExtraProtect != None):
+ if (self.featureExtraProtect is not None):
self.intercepts += [ '#endif' ]
OutputGenerator.genCmd(self, cmdinfo, name, alias)
@@ -429,9 +429,9 @@
self.appendSection('command', ' VkLayerDispatchTable *pTable = my_data->device_dispatch_table;')
# Declare result variable, if any.
resulttype = cmdinfo.elem.find('proto/type')
- if (resulttype != None and resulttype.text == 'void'):
+ if (resulttype is not None and resulttype.text == 'void'):
resulttype = None
- if (resulttype != None):
+ if (resulttype is not None):
self.appendSection('command', ' ' + resulttype.text + ' result;')
assignresult = 'result = '
else:
@@ -451,7 +451,7 @@
self.appendSection('command', ' finishMultiThread();')
self.appendSection('command', ' }')
# Return result variable, if any.
- if (resulttype != None):
+ if (resulttype is not None):
self.appendSection('command', ' return result;')
self.appendSection('command', '}')
#