[Lxml-checkins] r46517 - lxml/trunk/src/lxml

scoder at codespeak.net scoder at codespeak.net
Wed Sep 12 22:08:14 CEST 2007


Author: scoder
Date: Wed Sep 12 22:08:14 2007
New Revision: 46517

Modified:
   lxml/trunk/src/lxml/etree.pyx
Log:
small optimisation for _Document creation

Modified: lxml/trunk/src/lxml/etree.pyx
==============================================================================
--- lxml/trunk/src/lxml/etree.pyx	(original)
+++ lxml/trunk/src/lxml/etree.pyx	Wed Sep 12 22:08:14 2007
@@ -382,9 +382,13 @@
         if node_ns_utf is not None:
             self._setNodeNs(c_node, _cstr(node_ns_utf))
 
+cdef extern from "etree_defs.h":
+    # macro call to 't->tp_new()' for fast instantiation
+    cdef _Document NEW_DOCUMENT "PY_NEW" (object t)
+
 cdef _Document _documentFactory(xmlDoc* c_doc, _BaseParser parser):
     cdef _Document result
-    result = _Document()
+    result = NEW_DOCUMENT(_Document)
     result._c_doc = c_doc
     result._ns_counter = 0
     if parser is None:


More information about the lxml-checkins mailing list