Vitja, here are some more quirks, but they are minor issues. I'll commit my changes to lxml to keep it working, and then merge in the branch. It's certainly in a "good enough for a merge" state. I'm actually surprised how few problems I had to fix, given how old the code in lxml is by now. Let's see how much of Sage we break. Stefan Some more issues: cdef Py_ssize_t c = 0, i [...] while c_node is not NULL and c < count: for i from 0 <= i < step: c_next = next_element(c_next) _removeNode(doc, c_node) c = c + 1 c_node = c_next return 0 src/lxml/apihelpers.pxi:1079:23: Unused entry 'i' (Although the best fix is to change the code to for-in-range() here...) Here's another interesting constellation: live_refs = _convert_xslt_parameters(transform_ctxt, kw, ¶ms) c_result = self._run_transform( c_doc, params, context, transform_ctxt) if params is not NULL: # deallocate space for parameters python.PyMem_Free(params) live_refs = None # release objects src/lxml/xslt.pxi:519:22: Unused entry 'live_refs' So, holding on to Python references to keep their C char* alive gives me a warning. Fine. I guess I'll have to live with that... Another missing bit: cdef void registerExsltFunctions(self): cdef xpath.xmlXPathContext* ctxt = self._xpathCtxt cdef int i cdef char* c_href if xslt.LIBXSLT_VERSION < 10125: # we'd only execute dummy functions anyway return tree.xmlHashScan( self._xpathCtxt.nsHash, _registerExsltFunctionsForNamespaces, self._xpathCtxt) src/lxml/xpath.pxi:80:34: Unused entry 'ctxt' Ok, right, "ctxt" is unused here. But all *3* declarations are actually left-over code from the last refactoring. None of them is used, and I only get one warning?