Skip to content

Commit 33a446d

Browse files
committed
Add "is not None" to comment checks.
To be consistent, add the explicit check for "is not None" when checking for the presence of a comment.
1 parent 01edd4c commit 33a446d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pygccxml/parser/scanner.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ def __read_namespace(self, attrs):
434434
# almost all files has '.' in name
435435
ns_name = ''
436436
decl = self.__decl_factory.create_namespace(name=ns_name)
437-
if attrs.get(XML_AN_COMMENT):
437+
if attrs.get(XML_AN_COMMENT) is not None:
438438
decl.comment = attrs.get(XML_AN_COMMENT)
439439
return decl
440440

@@ -444,7 +444,7 @@ def __read_enumeration(self, attrs):
444444
# it means that this is unnamed enum. in c++ enum{ x };
445445
enum_name = ''
446446
decl = self.__decl_factory.create_enumeration(name=enum_name)
447-
if attrs.get(XML_AN_COMMENT):
447+
if attrs.get(XML_AN_COMMENT) is not None:
448448
decl.comment = attrs.get(XML_AN_COMMENT)
449449
self.__read_byte_size(decl, attrs)
450450
self.__read_byte_align(decl, attrs)
@@ -569,7 +569,7 @@ def __read_calldef(self, calldef, attrs, is_declaration):
569569
else:
570570
calldef.does_throw = True
571571
calldef.exceptions = throw_stmt.split()
572-
if attrs.get(XML_AN_COMMENT):
572+
if attrs.get(XML_AN_COMMENT) is not None:
573573
calldef.comment = attrs.get(XML_AN_COMMENT)
574574

575575
def __read_member_function(self, calldef, attrs, is_declaration):
@@ -621,7 +621,7 @@ def __read_variable(self, attrs):
621621
XML_AN_INIT),
622622
bits=bits)
623623
self.__read_byte_offset(decl, attrs)
624-
if attrs.get(XML_AN_COMMENT):
624+
if attrs.get(XML_AN_COMMENT) is not None:
625625
decl.comment = attrs.get(XML_AN_COMMENT)
626626
return decl
627627

@@ -640,7 +640,7 @@ def __read_class_impl(self, class_type, attrs):
640640
decl.is_abstract = bool(attrs.get(XML_AN_ABSTRACT, False))
641641
self.__read_byte_size(decl, attrs)
642642
self.__read_byte_align(decl, attrs)
643-
if attrs.get(XML_AN_COMMENT):
643+
if attrs.get(XML_AN_COMMENT) is not None:
644644
decl.comment = attrs.get(XML_AN_COMMENT)
645645
return decl
646646

0 commit comments

Comments
 (0)