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

scoder at codespeak.net scoder at codespeak.net
Fri Mar 16 20:24:42 CET 2007


Author: scoder
Date: Fri Mar 16 20:24:40 2007
New Revision: 40611

Modified:
   lxml/trunk/src/lxml/etree.pyx
Log:
allow threading in xinclude(), some docstring updates

Modified: lxml/trunk/src/lxml/etree.pyx
==============================================================================
--- lxml/trunk/src/lxml/etree.pyx	(original)
+++ lxml/trunk/src/lxml/etree.pyx	Fri Mar 16 20:24:40 2007
@@ -1289,7 +1289,7 @@
     def relaxng(self, relaxng):
         """Validate this document using other document.
 
-        relaxng is a tree that should contain Relax NG XML
+        The relaxng argument is a tree that should contain a Relax NG schema.
 
         Returns True or False, depending on whether validation
         succeeded.
@@ -1305,7 +1305,7 @@
     def xmlschema(self, xmlschema):
         """Validate this document using other document.
 
-        xmlschema is a tree that should contain XML Schema XML.
+        The xmlschema argument is a tree that should contain an XML Schema.
 
         Returns True or False, depending on whether validation
         succeeded.
@@ -1321,7 +1321,13 @@
     def xinclude(self):
         """Process the XInclude nodes in this document and include the
         referenced XML fragments.
+
+        There is support for loading files through the file system, HTTP and
+        FTP.
+
+        Note that XInclude does not support custom resolvers in Python space.
         """
+        cdef python.PyThreadState* state
         cdef int result
         # We cannot pass the XML_PARSE_NOXINCNODE option as this would free
         # the XInclude nodes - there may still be Python references to them!
@@ -1331,13 +1337,15 @@
         # typed as elements.  The included fragment is added between the two,
         # i.e. as a sibling, which does not conflict with traversal.
         self._assertHasRoot()
-        if self._context_node._doc._parser != None:
+        state = python.PyEval_SaveThread()
+        if self._context_node._doc._parser is not None:
             result = xinclude.xmlXIncludeProcessTreeFlags(
                 self._context_node._c_node,
                 self._context_node._doc._parser._parse_options)
         else:
             result = xinclude.xmlXIncludeProcessTree(
                 self._context_node._c_node)
+        python.PyEval_RestoreThread(state)
         if result == -1:
             raise XIncludeError, "XInclude processing failed"
 


More information about the lxml-checkins mailing list