[Lxml-checkins] r50462 - in lxml/trunk: . src/lxml

scoder at codespeak.net scoder at codespeak.net
Wed Jan 9 19:31:29 CET 2008


Author: scoder
Date: Wed Jan  9 19:31:29 2008
New Revision: 50462

Modified:
   lxml/trunk/   (props changed)
   lxml/trunk/CHANGES.txt
   lxml/trunk/src/lxml/parser.pxi
   lxml/trunk/src/lxml/xslt.pxi
Log:
 r3208 at delle:  sbehnel | 2008-01-05 21:59:36 +0100
 copy XSLT into current thread instead of raising a 'not usable' exception


Modified: lxml/trunk/CHANGES.txt
==============================================================================
--- lxml/trunk/CHANGES.txt	(original)
+++ lxml/trunk/CHANGES.txt	Wed Jan  9 19:31:29 2008
@@ -8,6 +8,9 @@
 Features added
 --------------
 
+* ``XSLT`` objects are now usable in any thread - at the cost of a
+  deep copy if they were not created in that thread.
+
 * Invalid entity names and character references will now be rejected
   by the ``Entity()`` factory.
 

Modified: lxml/trunk/src/lxml/parser.pxi
==============================================================================
--- lxml/trunk/src/lxml/parser.pxi	(original)
+++ lxml/trunk/src/lxml/parser.pxi	Wed Jan  9 19:31:29 2008
@@ -132,8 +132,8 @@
     """Check that c_dict is either the local thread dictionary or the global
     parent dictionary.
     """
-    if __GLOBAL_PARSER_CONTEXT._c_dict is c_dict:
-        return 1 # main thread
+    #if __GLOBAL_PARSER_CONTEXT._c_dict is c_dict:
+    #    return 1 # main thread
     if __GLOBAL_PARSER_CONTEXT._getThreadDict(NULL) is c_dict:
         return 1 # local thread dict
     return 0

Modified: lxml/trunk/src/lxml/xslt.pxi
==============================================================================
--- lxml/trunk/src/lxml/xslt.pxi	(original)
+++ lxml/trunk/src/lxml/xslt.pxi	Wed Jan  9 19:31:29 2008
@@ -356,7 +356,8 @@
         cdef xmlDoc* c_doc
 
         if not _checkThreadDict(self._c_style.doc.dict):
-            raise RuntimeError, "stylesheet is not usable in this thread"
+            _kw['profile_run'] = profile_run
+            return _copyXSLT(self)(_input, **_kw)
 
         input_doc = _documentOrRaise(_input)
         root_node = _rootNodeOrRaise(_input)


More information about the lxml-checkins mailing list