Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a7f4f5a

Browse files
committed
#2501 xml.sax.parser doesn't terminate when given a filename; enable some more tests!
Reviewed by myself
1 parent ecaab83 commit a7f4f5a

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

Lib/test/test_sax.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,7 @@ def test_expat_nsattrs_wattr(self):
446446

447447
# ===== InputSource support
448448

449-
def XXXtest_expat_inpsource_filename(self):
450-
# FIXME: test blocks indefinitely
449+
def test_expat_inpsource_filename(self):
451450
parser = create_parser()
452451
result = StringIO()
453452
xmlgen = XMLGenerator(result)
@@ -457,8 +456,7 @@ def XXXtest_expat_inpsource_filename(self):
457456

458457
self.assertEquals(result.getvalue(), xml_test_out)
459458

460-
def XXXtest_expat_inpsource_sysid(self):
461-
# FIXME: test blocks indefinitely
459+
def test_expat_inpsource_sysid(self):
462460
parser = create_parser()
463461
result = StringIO()
464462
xmlgen = XMLGenerator(result)
@@ -531,8 +529,7 @@ def test_expat_locator_noinfo(self):
531529
self.assertEquals(parser.getPublicId(), None)
532530
self.assertEquals(parser.getLineNumber(), 1)
533531

534-
def XXXtest_expat_locator_withinfo(self):
535-
# FIXME: test blocks indefinitely
532+
def test_expat_locator_withinfo(self):
536533
result = StringIO()
537534
xmlgen = XMLGenerator(result)
538535
parser = create_parser()

Lib/xml/sax/xmlreader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def parse(self, source):
119119
self.prepareParser(source)
120120
file = source.getByteStream()
121121
buffer = file.read(self._bufsize)
122-
while buffer != "":
122+
while buffer:
123123
self.feed(buffer)
124124
buffer = file.read(self._bufsize)
125125
self.close()

0 commit comments

Comments
 (0)