[Checkins] SVN: zope.tal/trunk/src/zope/tal/xmlparser.py Towards Py3K: xml.parsers.expat wants byte strings (part 2)
Marius Gedminas
cvs-admin at zope.org
Thu Feb 7 23:04:53 UTC 2013
Log message for revision 129193:
Towards Py3K: xml.parsers.expat wants byte strings (part 2)
Also avoid ResourceWarning by explicitly closing the file.
Changed:
U zope.tal/trunk/src/zope/tal/xmlparser.py
-=-
Modified: zope.tal/trunk/src/zope/tal/xmlparser.py
===================================================================
--- zope.tal/trunk/src/zope/tal/xmlparser.py 2013-02-07 23:04:49 UTC (rev 129192)
+++ zope.tal/trunk/src/zope/tal/xmlparser.py 2013-02-07 23:04:52 UTC (rev 129193)
@@ -82,7 +82,8 @@
return expat.ParserCreate(encoding, ' ')
def parseFile(self, filename):
- self.parseStream(open(filename))
+ with open(filename, 'rb') as f:
+ self.parseStream(f)
def parseString(self, s):
if isinstance(s, unicode):
More information about the checkins
mailing list