Skip to content

Commit

Permalink
fix compile error reporting for XSLT stylesheet compilation
Browse files Browse the repository at this point in the history
--HG--
extra : transplant_source : %97%25%BB%D6%91%CA%2AD%E2%8D%C0%3B7%8B%CC%88%15%C4%C8%A2
  • Loading branch information
scoder committed Feb 23, 2012
1 parent 69fdaf3 commit ec5a50e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
15 changes: 15 additions & 0 deletions CHANGES.txt
Expand Up @@ -2,6 +2,21 @@
lxml changelog lxml changelog
============== ==============


2.3.4 (?)
==================

Features added
--------------

Bugs fixed
----------

* XSLT stylesheet compilation could ignore compilation errors.

Other changes
--------------


2.3.3 (2012-01-04) 2.3.3 (2012-01-04)
================== ==================


Expand Down
1 change: 1 addition & 0 deletions src/lxml/xslt.pxd
Expand Up @@ -19,6 +19,7 @@ cdef extern from "libxslt/xsltInternals.h":
ctypedef struct xsltStylesheet: ctypedef struct xsltStylesheet:
char* encoding char* encoding
xmlDoc* doc xmlDoc* doc
int errors


ctypedef struct xsltTransformContext: ctypedef struct xsltTransformContext:
xsltStylesheet* style xsltStylesheet* style
Expand Down
4 changes: 3 additions & 1 deletion src/lxml/xslt.pxi
Expand Up @@ -394,8 +394,10 @@ cdef class XSLT:
c_style = xslt.xsltParseStylesheetDoc(c_doc) c_style = xslt.xsltParseStylesheetDoc(c_doc)
self._error_log.disconnect() self._error_log.disconnect()


if c_style is NULL: if c_style is NULL or c_style.errors:
tree.xmlFreeDoc(c_doc) tree.xmlFreeDoc(c_doc)
if c_style is not NULL:
xslt.xsltFreeStylesheet(c_style)
self._xslt_resolver_context._raise_if_stored() self._xslt_resolver_context._raise_if_stored()
# last error seems to be the most accurate here # last error seems to be the most accurate here
if self._error_log.last_error is not None and \ if self._error_log.last_error is not None and \
Expand Down

0 comments on commit ec5a50e

Please sign in to comment.