Skip to content

Commit ac64703

Browse files
committed
fix a rare bub with 'is True'
1 parent bfca55e commit ac64703

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

htmlement.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def feed(self, data):
215215
:raises UnicodeDecodeError: If decoding of *data* fails.
216216
"""
217217
# Skip feeding data into parser if we already have what we want
218-
if self._finished is True:
218+
if self._finished == 1:
219219
return None
220220

221221
# Make sure that we have unicode before continuing
@@ -287,7 +287,7 @@ def __init__(self, tag="", attrs=None):
287287
if attrs:
288288
self.attrs = attrs
289289
for key, value in attrs.copy().items():
290-
if value is False:
290+
if value == 0:
291291
self._unw_attrs.append(key)
292292
del attrs[key]
293293
else:
@@ -399,7 +399,7 @@ def handle_comment(self, data):
399399

400400
def close(self):
401401
self._flush()
402-
if self.enabled is False:
402+
if self.enabled == 0:
403403
msg = "Unable to find requested section with tag of '{}' and attributes of {}"
404404
raise RuntimeError(msg.format(self.tag, self.attrs))
405405
elif self._root is not None:
@@ -442,7 +442,7 @@ def _search(self, tag, attrs):
442442
# Check for wanted attrs
443443
elif key in wanted_attrs:
444444
c_value = wanted_attrs[key]
445-
if c_value == value or c_value is True:
445+
if c_value == value or c_value == 1:
446446
# Remove this attribute from the wanted dict of attributes
447447
# to indicate that this attribute has been found
448448
del wanted_attrs[key]

0 commit comments

Comments
 (0)