Here is a memory leak fix + small optimization in the xmlreader.py (trunk).<br><br>-- Cheers, Dmitry<br>
<br><br>--- pywikipedia/xmlreader.py 2010-04-27 17:04:34.376531862 -0700<br>+++ xmlreader.py 2010-04-27 23:17:53.956531055 -0700<br>@@ -321,6 +321,7 @@<br> <br> revision = elem.find("{%s}revision" % self.uri)<br>
yield self._create_revision(revision)<br>+ elem.clear()<br> self.root.clear()<br> <br> def _parse_all(self, event, elem):<br>@@ -330,6 +331,7 @@<br> <br> if event == "end" and elem.tag == "{%s}revision" % self.uri:<br>
yield self._create_revision(elem)<br>+ elem.clear()<br> self.root.clear()<br> <br> def _headers(self, elem):<br>@@ -337,6 +339,8 @@<br> self.pageid = elem.findtext("{%s}id" % self.uri)<br>
self.restrictions = elem.findtext("{%s}restrictions" % self.uri)<br> self.isredirect = elem.findtext("{%s}redirect" % self.uri) is not None<br>+ self.editRestriction, self.moveRestriction \<br>
+ = parseRestrictions(self.restrictions)<br> <br> def _create_revision(self, revision):<br> """Creates a Single revision"""<br>@@ -348,16 +352,14 @@<br> username = ipeditor or contributor.findtext("{%s}username" % self.uri)<br>
# could get comment, minor as well<br> text = revision.findtext("{%s}text" % self.uri)<br>- editRestriction, moveRestriction \<br>- = parseRestrictions(self.restrictions)<br>
return XmlEntry(title=self.title,<br> id=self.pageid,<br> text=text or u'',<br> username=username or u'', #username might be deleted<br>
ipedit=bool(ipeditor),<br> timestamp=timestamp,<br>- editRestriction=editRestriction,<br>- moveRestriction=moveRestriction,<br>
+ editRestriction=self.editRestriction,<br>+ moveRestriction=self.moveRestriction,<br> revisionid=revisionid,<br> comment=comment,<br>
redirect=self.isredirect<br><br><br>