Ping.

On Tue, Apr 27, 2010 at 11:40 PM, Dmitry Chichkov <dchichkov@gmail.com> wrote:
Here is a memory leak fix + small optimization  in the xmlreader.py (trunk).

-- Cheers, Dmitry


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