From dcbc0cc1cb0cedf8019184aaca805d2a649cd8de Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Thu, 15 Dec 2022 11:38:42 +0100 Subject: [PATCH] Use generic 'nogil' block markers in pxd declarations where possible, except for a few callback declarations that may be used for regular GIL functions. --- src/lxml/includes/c14n.pxd | 9 +- src/lxml/includes/htmlparser.pxd | 26 ++-- src/lxml/includes/relaxng.pxd | 22 +-- src/lxml/includes/schematron.pxd | 16 +- src/lxml/includes/tree.pxd | 260 +++++++++++++++---------------- src/lxml/includes/uri.pxd | 2 +- src/lxml/includes/xinclude.pxd | 20 +-- src/lxml/includes/xmlerror.pxd | 12 +- src/lxml/includes/xmlparser.pxd | 67 ++++---- src/lxml/includes/xmlschema.pxd | 2 +- src/lxml/includes/xpath.pxd | 73 ++++----- src/lxml/includes/xslt.pxd | 85 +++++----- 12 files changed, 297 insertions(+), 297 deletions(-) diff --git a/src/lxml/includes/c14n.pxd b/src/lxml/includes/c14n.pxd index d075e90e2..8b1f3c4c5 100644 --- a/src/lxml/includes/c14n.pxd +++ b/src/lxml/includes/c14n.pxd @@ -1,13 +1,13 @@ from lxml.includes.tree cimport xmlDoc, xmlOutputBuffer, xmlChar from lxml.includes.xpath cimport xmlNodeSet -cdef extern from "libxml/c14n.h": +cdef extern from "libxml/c14n.h" nogil: cdef int xmlC14NDocDumpMemory(xmlDoc* doc, xmlNodeSet* nodes, int exclusive, xmlChar** inclusive_ns_prefixes, int with_comments, - xmlChar** doc_txt_ptr) nogil + xmlChar** doc_txt_ptr) cdef int xmlC14NDocSave(xmlDoc* doc, xmlNodeSet* nodes, @@ -15,12 +15,11 @@ cdef extern from "libxml/c14n.h": xmlChar** inclusive_ns_prefixes, int with_comments, char* filename, - int compression) nogil + int compression) cdef int xmlC14NDocSaveTo(xmlDoc* doc, xmlNodeSet* nodes, int exclusive, xmlChar** inclusive_ns_prefixes, int with_comments, - xmlOutputBuffer* buffer) nogil - + xmlOutputBuffer* buffer) diff --git a/src/lxml/includes/htmlparser.pxd b/src/lxml/includes/htmlparser.pxd index 145a69a06..31dcc406c 100644 --- a/src/lxml/includes/htmlparser.pxd +++ b/src/lxml/includes/htmlparser.pxd @@ -4,7 +4,7 @@ from lxml.includes.tree cimport xmlDoc from lxml.includes.tree cimport xmlInputReadCallback, xmlInputCloseCallback from lxml.includes.xmlparser cimport xmlParserCtxt, xmlSAXHandler, xmlSAXHandlerV1 -cdef extern from "libxml/HTMLparser.h": +cdef extern from "libxml/HTMLparser.h" nogil: ctypedef enum htmlParserOption: HTML_PARSE_NOERROR # suppress error reports HTML_PARSE_NOWARNING # suppress warning reports @@ -24,33 +24,33 @@ cdef extern from "libxml/HTMLparser.h": xmlSAXHandlerV1 htmlDefaultSAXHandler cdef xmlParserCtxt* htmlCreateMemoryParserCtxt( - char* buffer, int size) nogil + char* buffer, int size) cdef xmlParserCtxt* htmlCreateFileParserCtxt( - char* filename, char* encoding) nogil + char* filename, char* encoding) cdef xmlParserCtxt* htmlCreatePushParserCtxt(xmlSAXHandler* sax, void* user_data, char* chunk, int size, - char* filename, int enc) nogil - cdef void htmlFreeParserCtxt(xmlParserCtxt* ctxt) nogil - cdef void htmlCtxtReset(xmlParserCtxt* ctxt) nogil - cdef int htmlCtxtUseOptions(xmlParserCtxt* ctxt, int options) nogil - cdef int htmlParseDocument(xmlParserCtxt* ctxt) nogil + char* filename, int enc) + cdef void htmlFreeParserCtxt(xmlParserCtxt* ctxt) + cdef void htmlCtxtReset(xmlParserCtxt* ctxt) + cdef int htmlCtxtUseOptions(xmlParserCtxt* ctxt, int options) + cdef int htmlParseDocument(xmlParserCtxt* ctxt) cdef int htmlParseChunk(xmlParserCtxt* ctxt, - char* chunk, int size, int terminate) nogil + char* chunk, int size, int terminate) cdef xmlDoc* htmlCtxtReadFile(xmlParserCtxt* ctxt, char* filename, const_char* encoding, - int options) nogil + int options) cdef xmlDoc* htmlCtxtReadDoc(xmlParserCtxt* ctxt, char* buffer, char* URL, const_char* encoding, - int options) nogil + int options) cdef xmlDoc* htmlCtxtReadIO(xmlParserCtxt* ctxt, xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void* ioctx, char* URL, const_char* encoding, - int options) nogil + int options) cdef xmlDoc* htmlCtxtReadMemory(xmlParserCtxt* ctxt, char* buffer, int size, char* filename, const_char* encoding, - int options) nogil + int options) diff --git a/src/lxml/includes/relaxng.pxd b/src/lxml/includes/relaxng.pxd index 28e9212d2..5ac96711e 100644 --- a/src/lxml/includes/relaxng.pxd +++ b/src/lxml/includes/relaxng.pxd @@ -1,7 +1,7 @@ from lxml.includes.tree cimport xmlDoc from lxml.includes.xmlerror cimport xmlStructuredErrorFunc -cdef extern from "libxml/relaxng.h": +cdef extern from "libxml/relaxng.h" nogil: ctypedef struct xmlRelaxNG ctypedef struct xmlRelaxNGParserCtxt @@ -49,16 +49,16 @@ cdef extern from "libxml/relaxng.h": XML_RELAXNG_ERR_ELEMWRONG = 38 XML_RELAXNG_ERR_TEXTWRONG = 39 - cdef xmlRelaxNGValidCtxt* xmlRelaxNGNewValidCtxt(xmlRelaxNG* schema) nogil - cdef int xmlRelaxNGValidateDoc(xmlRelaxNGValidCtxt* ctxt, xmlDoc* doc) nogil - cdef xmlRelaxNG* xmlRelaxNGParse(xmlRelaxNGParserCtxt* ctxt) nogil - cdef xmlRelaxNGParserCtxt* xmlRelaxNGNewParserCtxt(char* URL) nogil - cdef xmlRelaxNGParserCtxt* xmlRelaxNGNewDocParserCtxt(xmlDoc* doc) nogil - cdef void xmlRelaxNGFree(xmlRelaxNG* schema) nogil - cdef void xmlRelaxNGFreeParserCtxt(xmlRelaxNGParserCtxt* ctxt) nogil - cdef void xmlRelaxNGFreeValidCtxt(xmlRelaxNGValidCtxt* ctxt) nogil + cdef xmlRelaxNGValidCtxt* xmlRelaxNGNewValidCtxt(xmlRelaxNG* schema) + cdef int xmlRelaxNGValidateDoc(xmlRelaxNGValidCtxt* ctxt, xmlDoc* doc) + cdef xmlRelaxNG* xmlRelaxNGParse(xmlRelaxNGParserCtxt* ctxt) + cdef xmlRelaxNGParserCtxt* xmlRelaxNGNewParserCtxt(char* URL) + cdef xmlRelaxNGParserCtxt* xmlRelaxNGNewDocParserCtxt(xmlDoc* doc) + cdef void xmlRelaxNGFree(xmlRelaxNG* schema) + cdef void xmlRelaxNGFreeParserCtxt(xmlRelaxNGParserCtxt* ctxt) + cdef void xmlRelaxNGFreeValidCtxt(xmlRelaxNGValidCtxt* ctxt) cdef void xmlRelaxNGSetValidStructuredErrors( - xmlRelaxNGValidCtxt* ctxt, xmlStructuredErrorFunc serror, void *ctx) nogil + xmlRelaxNGValidCtxt* ctxt, xmlStructuredErrorFunc serror, void *ctx) cdef void xmlRelaxNGSetParserStructuredErrors( - xmlRelaxNGParserCtxt* ctxt, xmlStructuredErrorFunc serror, void *ctx) nogil + xmlRelaxNGParserCtxt* ctxt, xmlStructuredErrorFunc serror, void *ctx) diff --git a/src/lxml/includes/schematron.pxd b/src/lxml/includes/schematron.pxd index f8e325284..181248afd 100644 --- a/src/lxml/includes/schematron.pxd +++ b/src/lxml/includes/schematron.pxd @@ -1,7 +1,7 @@ from lxml.includes cimport xmlerror from lxml.includes.tree cimport xmlDoc -cdef extern from "libxml/schematron.h": +cdef extern from "libxml/schematron.h" nogil: ctypedef struct xmlSchematron ctypedef struct xmlSchematronParserCtxt ctypedef struct xmlSchematronValidCtxt @@ -16,19 +16,19 @@ cdef extern from "libxml/schematron.h": XML_SCHEMATRON_OUT_IO = 1024 # output to I/O mechanism cdef xmlSchematronParserCtxt* xmlSchematronNewDocParserCtxt( - xmlDoc* doc) nogil + xmlDoc* doc) cdef xmlSchematronParserCtxt* xmlSchematronNewParserCtxt( char* filename) nogil cdef xmlSchematronValidCtxt* xmlSchematronNewValidCtxt( - xmlSchematron* schema, int options) nogil + xmlSchematron* schema, int options) - cdef xmlSchematron* xmlSchematronParse(xmlSchematronParserCtxt* ctxt) nogil + cdef xmlSchematron* xmlSchematronParse(xmlSchematronParserCtxt* ctxt) cdef int xmlSchematronValidateDoc(xmlSchematronValidCtxt* ctxt, - xmlDoc* instance) nogil + xmlDoc* instance) - cdef void xmlSchematronFreeParserCtxt(xmlSchematronParserCtxt* ctxt) nogil - cdef void xmlSchematronFreeValidCtxt(xmlSchematronValidCtxt* ctxt) nogil - cdef void xmlSchematronFree(xmlSchematron* schema) nogil + cdef void xmlSchematronFreeParserCtxt(xmlSchematronParserCtxt* ctxt) + cdef void xmlSchematronFreeValidCtxt(xmlSchematronValidCtxt* ctxt) + cdef void xmlSchematronFree(xmlSchematron* schema) cdef void xmlSchematronSetValidStructuredErrors( xmlSchematronValidCtxt* ctxt, xmlerror.xmlStructuredErrorFunc error_func, void *data) diff --git a/src/lxml/includes/tree.pxd b/src/lxml/includes/tree.pxd index 010af8090..03d558a33 100644 --- a/src/lxml/includes/tree.pxd +++ b/src/lxml/includes/tree.pxd @@ -9,19 +9,19 @@ cdef extern from "libxml/xmlversion.h": cdef const_char* xmlParserVersion cdef int LIBXML_VERSION -cdef extern from "libxml/xmlstring.h": +cdef extern from "libxml/xmlstring.h" nogil: ctypedef unsigned char xmlChar ctypedef const xmlChar const_xmlChar "const xmlChar" - cdef int xmlStrlen(const_xmlChar* str) nogil - cdef xmlChar* xmlStrdup(const_xmlChar* cur) nogil - cdef int xmlStrncmp(const_xmlChar* str1, const_xmlChar* str2, int length) nogil - cdef int xmlStrcmp(const_xmlChar* str1, const_xmlChar* str2) nogil - cdef int xmlStrcasecmp(const xmlChar *str1, const xmlChar *str2) nogil - cdef const_xmlChar* xmlStrstr(const_xmlChar* str1, const_xmlChar* str2) nogil - cdef const_xmlChar* xmlStrchr(const_xmlChar* str1, xmlChar ch) nogil + cdef int xmlStrlen(const_xmlChar* str) + cdef xmlChar* xmlStrdup(const_xmlChar* cur) + cdef int xmlStrncmp(const_xmlChar* str1, const_xmlChar* str2, int length) + cdef int xmlStrcmp(const_xmlChar* str1, const_xmlChar* str2) + cdef int xmlStrcasecmp(const xmlChar *str1, const xmlChar *str2) + cdef const_xmlChar* xmlStrstr(const_xmlChar* str1, const_xmlChar* str2) + cdef const_xmlChar* xmlStrchr(const_xmlChar* str1, xmlChar ch) cdef const_xmlChar* _xcstr "(const xmlChar*)PyBytes_AS_STRING" (object s) -cdef extern from "libxml/encoding.h": +cdef extern from "libxml/encoding.h" nogil: ctypedef enum xmlCharEncoding: XML_CHAR_ENCODING_ERROR = -1 # No char encoding detected XML_CHAR_ENCODING_NONE = 0 # No char encoding detected @@ -49,19 +49,19 @@ cdef extern from "libxml/encoding.h": XML_CHAR_ENCODING_ASCII = 22 # pure ASCII ctypedef struct xmlCharEncodingHandler - cdef xmlCharEncodingHandler* xmlFindCharEncodingHandler(char* name) nogil + cdef xmlCharEncodingHandler* xmlFindCharEncodingHandler(char* name) cdef xmlCharEncodingHandler* xmlGetCharEncodingHandler( - xmlCharEncoding enc) nogil - cdef int xmlCharEncCloseFunc(xmlCharEncodingHandler* handler) nogil - cdef xmlCharEncoding xmlDetectCharEncoding(const_xmlChar* text, int len) nogil - cdef const_char* xmlGetCharEncodingName(xmlCharEncoding enc) nogil - cdef xmlCharEncoding xmlParseCharEncoding(char* name) nogil + xmlCharEncoding enc) + cdef int xmlCharEncCloseFunc(xmlCharEncodingHandler* handler) + cdef xmlCharEncoding xmlDetectCharEncoding(const_xmlChar* text, int len) + cdef const_char* xmlGetCharEncodingName(xmlCharEncoding enc) + cdef xmlCharEncoding xmlParseCharEncoding(char* name) ctypedef int (*xmlCharEncodingOutputFunc)( unsigned char *out_buf, int *outlen, const_uchar *in_buf, int *inlen) -cdef extern from "libxml/chvalid.h": - cdef int xmlIsChar_ch(char c) nogil - cdef int xmlIsCharQ(int ch) nogil +cdef extern from "libxml/chvalid.h" nogil: + cdef int xmlIsChar_ch(char c) + cdef int xmlIsCharQ(int ch) cdef extern from "libxml/hash.h": ctypedef struct xmlHashTable @@ -69,20 +69,20 @@ cdef extern from "libxml/hash.h": void xmlHashScan(xmlHashTable* table, xmlHashScanner f, void* data) nogil void* xmlHashLookup(xmlHashTable* table, const_xmlChar* name) nogil ctypedef void (*xmlHashDeallocator)(void *payload, xmlChar *name) - cdef xmlHashTable* xmlHashCreate(int size) - cdef xmlHashTable* xmlHashCreateDict(int size, xmlDict *dict) - cdef int xmlHashSize(xmlHashTable* table) - cdef void xmlHashFree(xmlHashTable* table, xmlHashDeallocator f) + cdef xmlHashTable* xmlHashCreate(int size) nogil + cdef xmlHashTable* xmlHashCreateDict(int size, xmlDict *dict) nogil + cdef int xmlHashSize(xmlHashTable* table) nogil + cdef void xmlHashFree(xmlHashTable* table, xmlHashDeallocator f) nogil -cdef extern from *: # actually "libxml/dict.h" +cdef extern from * nogil: # actually "libxml/dict.h" # libxml/dict.h appears to be broken to include in C ctypedef struct xmlDict - cdef const_xmlChar* xmlDictLookup(xmlDict* dict, const_xmlChar* name, int len) nogil - cdef const_xmlChar* xmlDictExists(xmlDict* dict, const_xmlChar* name, int len) nogil - cdef int xmlDictOwns(xmlDict* dict, const_xmlChar* name) nogil - cdef size_t xmlDictSize(xmlDict* dict) nogil + cdef const_xmlChar* xmlDictLookup(xmlDict* dict, const_xmlChar* name, int len) + cdef const_xmlChar* xmlDictExists(xmlDict* dict, const_xmlChar* name, int len) + cdef int xmlDictOwns(xmlDict* dict, const_xmlChar* name) + cdef size_t xmlDictSize(xmlDict* dict) -cdef extern from "libxml/tree.h": +cdef extern from "libxml/tree.h" nogil: ctypedef struct xmlDoc ctypedef struct xmlAttr ctypedef struct xmlNotationTable @@ -305,100 +305,100 @@ cdef extern from "libxml/tree.h": const_xmlChar* XML_XML_NAMESPACE - cdef void xmlFreeDoc(xmlDoc* cur) nogil - cdef void xmlFreeDtd(xmlDtd* cur) nogil - cdef void xmlFreeNode(xmlNode* cur) nogil - cdef void xmlFreeNsList(xmlNs* ns) nogil - cdef void xmlFreeNs(xmlNs* ns) nogil - cdef void xmlFree(void* buf) nogil + cdef void xmlFreeDoc(xmlDoc* cur) + cdef void xmlFreeDtd(xmlDtd* cur) + cdef void xmlFreeNode(xmlNode* cur) + cdef void xmlFreeNsList(xmlNs* ns) + cdef void xmlFreeNs(xmlNs* ns) + cdef void xmlFree(void* buf) - cdef xmlNode* xmlNewNode(xmlNs* ns, const_xmlChar* name) nogil - cdef xmlNode* xmlNewDocText(xmlDoc* doc, const_xmlChar* content) nogil - cdef xmlNode* xmlNewDocComment(xmlDoc* doc, const_xmlChar* content) nogil - cdef xmlNode* xmlNewDocPI(xmlDoc* doc, const_xmlChar* name, const_xmlChar* content) nogil - cdef xmlNode* xmlNewReference(xmlDoc* doc, const_xmlChar* name) nogil - cdef xmlNode* xmlNewCDataBlock(xmlDoc* doc, const_xmlChar* text, int len) nogil - cdef xmlNs* xmlNewNs(xmlNode* node, const_xmlChar* href, const_xmlChar* prefix) nogil - cdef xmlNode* xmlAddChild(xmlNode* parent, xmlNode* cur) nogil - cdef xmlNode* xmlReplaceNode(xmlNode* old, xmlNode* cur) nogil - cdef xmlNode* xmlAddPrevSibling(xmlNode* cur, xmlNode* elem) nogil - cdef xmlNode* xmlAddNextSibling(xmlNode* cur, xmlNode* elem) nogil + cdef xmlNode* xmlNewNode(xmlNs* ns, const_xmlChar* name) + cdef xmlNode* xmlNewDocText(xmlDoc* doc, const_xmlChar* content) + cdef xmlNode* xmlNewDocComment(xmlDoc* doc, const_xmlChar* content) + cdef xmlNode* xmlNewDocPI(xmlDoc* doc, const_xmlChar* name, const_xmlChar* content) + cdef xmlNode* xmlNewReference(xmlDoc* doc, const_xmlChar* name) + cdef xmlNode* xmlNewCDataBlock(xmlDoc* doc, const_xmlChar* text, int len) + cdef xmlNs* xmlNewNs(xmlNode* node, const_xmlChar* href, const_xmlChar* prefix) + cdef xmlNode* xmlAddChild(xmlNode* parent, xmlNode* cur) + cdef xmlNode* xmlReplaceNode(xmlNode* old, xmlNode* cur) + cdef xmlNode* xmlAddPrevSibling(xmlNode* cur, xmlNode* elem) + cdef xmlNode* xmlAddNextSibling(xmlNode* cur, xmlNode* elem) cdef xmlNode* xmlNewDocNode(xmlDoc* doc, xmlNs* ns, - const_xmlChar* name, const_xmlChar* content) nogil - cdef xmlDoc* xmlNewDoc(const_xmlChar* version) nogil - cdef xmlAttr* xmlNewProp(xmlNode* node, const_xmlChar* name, const_xmlChar* value) nogil + const_xmlChar* name, const_xmlChar* content) + cdef xmlDoc* xmlNewDoc(const_xmlChar* version) + cdef xmlAttr* xmlNewProp(xmlNode* node, const_xmlChar* name, const_xmlChar* value) cdef xmlAttr* xmlNewNsProp(xmlNode* node, xmlNs* ns, - const_xmlChar* name, const_xmlChar* value) nogil - cdef xmlChar* xmlGetNoNsProp(xmlNode* node, const_xmlChar* name) nogil - cdef xmlChar* xmlGetNsProp(xmlNode* node, const_xmlChar* name, const_xmlChar* nameSpace) nogil - cdef void xmlSetNs(xmlNode* node, xmlNs* ns) nogil - cdef xmlAttr* xmlSetProp(xmlNode* node, const_xmlChar* name, const_xmlChar* value) nogil + const_xmlChar* name, const_xmlChar* value) + cdef xmlChar* xmlGetNoNsProp(xmlNode* node, const_xmlChar* name) + cdef xmlChar* xmlGetNsProp(xmlNode* node, const_xmlChar* name, const_xmlChar* nameSpace) + cdef void xmlSetNs(xmlNode* node, xmlNs* ns) + cdef xmlAttr* xmlSetProp(xmlNode* node, const_xmlChar* name, const_xmlChar* value) cdef xmlAttr* xmlSetNsProp(xmlNode* node, xmlNs* ns, - const_xmlChar* name, const_xmlChar* value) nogil - cdef int xmlRemoveID(xmlDoc* doc, xmlAttr* cur) nogil - cdef int xmlRemoveProp(xmlAttr* cur) nogil - cdef void xmlFreePropList(xmlAttr* cur) nogil - cdef xmlChar* xmlGetNodePath(xmlNode* node) nogil - cdef void xmlDocDumpMemory(xmlDoc* cur, char** mem, int* size) nogil + const_xmlChar* name, const_xmlChar* value) + cdef int xmlRemoveID(xmlDoc* doc, xmlAttr* cur) + cdef int xmlRemoveProp(xmlAttr* cur) + cdef void xmlFreePropList(xmlAttr* cur) + cdef xmlChar* xmlGetNodePath(xmlNode* node) + cdef void xmlDocDumpMemory(xmlDoc* cur, char** mem, int* size) cdef void xmlDocDumpMemoryEnc(xmlDoc* cur, char** mem, int* size, - char* encoding) nogil + char* encoding) cdef int xmlSaveFileTo(xmlOutputBuffer* out, xmlDoc* cur, - char* encoding) nogil - - cdef void xmlUnlinkNode(xmlNode* cur) nogil - cdef xmlNode* xmlDocSetRootElement(xmlDoc* doc, xmlNode* root) nogil - cdef xmlNode* xmlDocGetRootElement(xmlDoc* doc) nogil - cdef void xmlSetTreeDoc(xmlNode* tree, xmlDoc* doc) nogil - cdef xmlAttr* xmlHasProp(xmlNode* node, const_xmlChar* name) nogil - cdef xmlAttr* xmlHasNsProp(xmlNode* node, const_xmlChar* name, const_xmlChar* nameSpace) nogil - cdef xmlChar* xmlNodeGetContent(xmlNode* cur) nogil - cdef int xmlNodeBufGetContent(xmlBuffer* buffer, xmlNode* cur) nogil - cdef xmlNs* xmlSearchNs(xmlDoc* doc, xmlNode* node, const_xmlChar* prefix) nogil - cdef xmlNs* xmlSearchNsByHref(xmlDoc* doc, xmlNode* node, const_xmlChar* href) nogil - cdef int xmlIsBlankNode(xmlNode* node) nogil - cdef long xmlGetLineNo(xmlNode* node) nogil - cdef void xmlElemDump(stdio.FILE* f, xmlDoc* doc, xmlNode* cur) nogil + char* encoding) + + cdef void xmlUnlinkNode(xmlNode* cur) + cdef xmlNode* xmlDocSetRootElement(xmlDoc* doc, xmlNode* root) + cdef xmlNode* xmlDocGetRootElement(xmlDoc* doc) + cdef void xmlSetTreeDoc(xmlNode* tree, xmlDoc* doc) + cdef xmlAttr* xmlHasProp(xmlNode* node, const_xmlChar* name) + cdef xmlAttr* xmlHasNsProp(xmlNode* node, const_xmlChar* name, const_xmlChar* nameSpace) + cdef xmlChar* xmlNodeGetContent(xmlNode* cur) + cdef int xmlNodeBufGetContent(xmlBuffer* buffer, xmlNode* cur) + cdef xmlNs* xmlSearchNs(xmlDoc* doc, xmlNode* node, const_xmlChar* prefix) + cdef xmlNs* xmlSearchNsByHref(xmlDoc* doc, xmlNode* node, const_xmlChar* href) + cdef int xmlIsBlankNode(xmlNode* node) + cdef long xmlGetLineNo(xmlNode* node) + cdef void xmlElemDump(stdio.FILE* f, xmlDoc* doc, xmlNode* cur) cdef void xmlNodeDumpOutput(xmlOutputBuffer* buf, xmlDoc* doc, xmlNode* cur, int level, - int format, const_char* encoding) nogil + int format, const_char* encoding) cdef void xmlBufAttrSerializeTxtContent(xmlOutputBuffer *buf, xmlDoc *doc, - xmlAttr *attr, const_xmlChar *string) nogil - cdef void xmlNodeSetName(xmlNode* cur, const_xmlChar* name) nogil - cdef void xmlNodeSetContent(xmlNode* cur, const_xmlChar* content) nogil - cdef xmlDtd* xmlCopyDtd(xmlDtd* dtd) nogil - cdef xmlDoc* xmlCopyDoc(xmlDoc* doc, int recursive) nogil - cdef xmlNode* xmlCopyNode(xmlNode* node, int extended) nogil - cdef xmlNode* xmlDocCopyNode(xmlNode* node, xmlDoc* doc, int extended) nogil - cdef int xmlReconciliateNs(xmlDoc* doc, xmlNode* tree) nogil - cdef xmlNs* xmlNewReconciliedNs(xmlDoc* doc, xmlNode* tree, xmlNs* ns) nogil - cdef xmlBuffer* xmlBufferCreate() nogil - cdef void xmlBufferWriteChar(xmlBuffer* buf, char* string) nogil - cdef void xmlBufferFree(xmlBuffer* buf) nogil - cdef const_xmlChar* xmlBufferContent(xmlBuffer* buf) nogil - cdef int xmlBufferLength(xmlBuffer* buf) nogil - cdef const_xmlChar* xmlBufContent(xmlBuf* buf) nogil # new in libxml2 2.9 - cdef size_t xmlBufUse(xmlBuf* buf) nogil # new in libxml2 2.9 - cdef int xmlKeepBlanksDefault(int val) nogil - cdef xmlChar* xmlNodeGetBase(xmlDoc* doc, xmlNode* node) nogil + xmlAttr *attr, const_xmlChar *string) + cdef void xmlNodeSetName(xmlNode* cur, const_xmlChar* name) + cdef void xmlNodeSetContent(xmlNode* cur, const_xmlChar* content) + cdef xmlDtd* xmlCopyDtd(xmlDtd* dtd) + cdef xmlDoc* xmlCopyDoc(xmlDoc* doc, int recursive) + cdef xmlNode* xmlCopyNode(xmlNode* node, int extended) + cdef xmlNode* xmlDocCopyNode(xmlNode* node, xmlDoc* doc, int extended) + cdef int xmlReconciliateNs(xmlDoc* doc, xmlNode* tree) + cdef xmlNs* xmlNewReconciliedNs(xmlDoc* doc, xmlNode* tree, xmlNs* ns) + cdef xmlBuffer* xmlBufferCreate() + cdef void xmlBufferWriteChar(xmlBuffer* buf, char* string) + cdef void xmlBufferFree(xmlBuffer* buf) + cdef const_xmlChar* xmlBufferContent(xmlBuffer* buf) + cdef int xmlBufferLength(xmlBuffer* buf) + cdef const_xmlChar* xmlBufContent(xmlBuf* buf) # new in libxml2 2.9 + cdef size_t xmlBufUse(xmlBuf* buf) # new in libxml2 2.9 + cdef int xmlKeepBlanksDefault(int val) + cdef xmlChar* xmlNodeGetBase(xmlDoc* doc, xmlNode* node) cdef xmlDtd* xmlCreateIntSubset(xmlDoc* doc, const_xmlChar* name, - const_xmlChar* ExternalID, const_xmlChar* SystemID) nogil - cdef void xmlNodeSetBase(xmlNode* node, const_xmlChar* uri) nogil - cdef int xmlValidateNCName(const_xmlChar* value, int space) nogil + const_xmlChar* ExternalID, const_xmlChar* SystemID) + cdef void xmlNodeSetBase(xmlNode* node, const_xmlChar* uri) + cdef int xmlValidateNCName(const_xmlChar* value, int space) -cdef extern from "libxml/uri.h": - cdef const_xmlChar* xmlBuildURI(const_xmlChar* href, const_xmlChar* base) nogil +cdef extern from "libxml/uri.h" nogil: + cdef const_xmlChar* xmlBuildURI(const_xmlChar* href, const_xmlChar* base) -cdef extern from "libxml/HTMLtree.h": +cdef extern from "libxml/HTMLtree.h" nogil: cdef void htmlNodeDumpFormatOutput(xmlOutputBuffer* buf, xmlDoc* doc, xmlNode* cur, - char* encoding, int format) nogil - cdef xmlDoc* htmlNewDoc(const_xmlChar* uri, const_xmlChar* externalID) nogil + char* encoding, int format) + cdef xmlDoc* htmlNewDoc(const_xmlChar* uri, const_xmlChar* externalID) -cdef extern from "libxml/valid.h": - cdef xmlAttr* xmlGetID(xmlDoc* doc, const_xmlChar* ID) nogil +cdef extern from "libxml/valid.h" nogil: + cdef xmlAttr* xmlGetID(xmlDoc* doc, const_xmlChar* ID) cdef void xmlDumpNotationTable(xmlBuffer* buffer, - xmlNotationTable* table) nogil - cdef int xmlValidateNameValue(const_xmlChar* value) nogil + xmlNotationTable* table) + cdef int xmlValidateNameValue(const_xmlChar* value) cdef extern from "libxml/xmlIO.h": cdef int xmlOutputBufferWrite(xmlOutputBuffer* out, @@ -411,8 +411,8 @@ cdef extern from "libxml/xmlIO.h": cdef int xmlOutputBufferClose(xmlOutputBuffer* out) nogil ctypedef int (*xmlInputReadCallback)(void* context, - char* buffer, int len) - ctypedef int (*xmlInputCloseCallback)(void* context) + char* buffer, int len) nogil + ctypedef int (*xmlInputCloseCallback)(void* context) nogil ctypedef int (*xmlOutputWriteCallback)(void* context, char* buffer, int len) @@ -430,7 +430,7 @@ cdef extern from "libxml/xmlIO.h": cdef xmlOutputBuffer* xmlOutputBufferCreateFilename( char* URI, xmlCharEncodingHandler* encoder, int compression) nogil -cdef extern from "libxml/xmlsave.h": +cdef extern from "libxml/xmlsave.h" nogil: ctypedef struct xmlSaveCtxt ctypedef enum xmlSaveOption: @@ -443,20 +443,20 @@ cdef extern from "libxml/xmlsave.h": XML_SAVE_AS_HTML = 64 # force HTML serialization on XML doc (2.7.2) cdef xmlSaveCtxt* xmlSaveToFilename(char* filename, char* encoding, - int options) nogil + int options) cdef xmlSaveCtxt* xmlSaveToBuffer(xmlBuffer* buffer, char* encoding, - int options) nogil # libxml2 2.6.23 - cdef long xmlSaveDoc(xmlSaveCtxt* ctxt, xmlDoc* doc) nogil - cdef long xmlSaveTree(xmlSaveCtxt* ctxt, xmlNode* node) nogil - cdef int xmlSaveClose(xmlSaveCtxt* ctxt) nogil - cdef int xmlSaveFlush(xmlSaveCtxt* ctxt) nogil - cdef int xmlSaveSetAttrEscape(xmlSaveCtxt* ctxt, void* escape_func) nogil - cdef int xmlSaveSetEscape(xmlSaveCtxt* ctxt, void* escape_func) nogil - -cdef extern from "libxml/globals.h": - cdef int xmlThrDefKeepBlanksDefaultValue(int onoff) nogil - cdef int xmlThrDefLineNumbersDefaultValue(int onoff) nogil - cdef int xmlThrDefIndentTreeOutput(int onoff) nogil + int options) # libxml2 2.6.23 + cdef long xmlSaveDoc(xmlSaveCtxt* ctxt, xmlDoc* doc) + cdef long xmlSaveTree(xmlSaveCtxt* ctxt, xmlNode* node) + cdef int xmlSaveClose(xmlSaveCtxt* ctxt) + cdef int xmlSaveFlush(xmlSaveCtxt* ctxt) + cdef int xmlSaveSetAttrEscape(xmlSaveCtxt* ctxt, void* escape_func) + cdef int xmlSaveSetEscape(xmlSaveCtxt* ctxt, void* escape_func) + +cdef extern from "libxml/globals.h" nogil: + cdef int xmlThrDefKeepBlanksDefaultValue(int onoff) + cdef int xmlThrDefLineNumbersDefaultValue(int onoff) + cdef int xmlThrDefIndentTreeOutput(int onoff) cdef extern from "libxml/xmlmemory.h" nogil: cdef void* xmlMalloc(size_t size) @@ -466,15 +466,15 @@ cdef extern from "libxml/xmlmemory.h" nogil: cdef void xmlMemDisplayLast(stdio.FILE* file, long num_bytes) cdef void xmlMemShow(stdio.FILE* file, int count) -cdef extern from "etree_defs.h": - cdef bint _isElement(xmlNode* node) nogil - cdef bint _isElementOrXInclude(xmlNode* node) nogil - cdef const_xmlChar* _getNs(xmlNode* node) nogil +cdef extern from "etree_defs.h" nogil: + cdef bint _isElement(xmlNode* node) + cdef bint _isElementOrXInclude(xmlNode* node) + cdef const_xmlChar* _getNs(xmlNode* node) cdef void BEGIN_FOR_EACH_ELEMENT_FROM(xmlNode* tree_top, xmlNode* start_node, - bint inclusive) nogil - cdef void END_FOR_EACH_ELEMENT_FROM(xmlNode* start_node) nogil + bint inclusive) + cdef void END_FOR_EACH_ELEMENT_FROM(xmlNode* start_node) cdef void BEGIN_FOR_EACH_FROM(xmlNode* tree_top, xmlNode* start_node, - bint inclusive) nogil - cdef void END_FOR_EACH_FROM(xmlNode* start_node) nogil + bint inclusive) + cdef void END_FOR_EACH_FROM(xmlNode* start_node) diff --git a/src/lxml/includes/uri.pxd b/src/lxml/includes/uri.pxd index 2b6bb79f3..f886a54b9 100644 --- a/src/lxml/includes/uri.pxd +++ b/src/lxml/includes/uri.pxd @@ -1,4 +1,4 @@ -cdef extern from "libxml/uri.h": +cdef extern from "libxml/uri.h" nogil: ctypedef struct xmlURI cdef xmlURI* xmlParseURI(char* str) diff --git a/src/lxml/includes/xinclude.pxd b/src/lxml/includes/xinclude.pxd index 4232d3e43..68267175a 100644 --- a/src/lxml/includes/xinclude.pxd +++ b/src/lxml/includes/xinclude.pxd @@ -1,22 +1,22 @@ from lxml.includes.tree cimport xmlDoc, xmlNode -cdef extern from "libxml/xinclude.h": +cdef extern from "libxml/xinclude.h" nogil: ctypedef struct xmlXIncludeCtxt - cdef int xmlXIncludeProcess(xmlDoc* doc) nogil - cdef int xmlXIncludeProcessFlags(xmlDoc* doc, int parser_opts) nogil - cdef int xmlXIncludeProcessTree(xmlNode* doc) nogil - cdef int xmlXIncludeProcessTreeFlags(xmlNode* doc, int parser_opts) nogil + cdef int xmlXIncludeProcess(xmlDoc* doc) + cdef int xmlXIncludeProcessFlags(xmlDoc* doc, int parser_opts) + cdef int xmlXIncludeProcessTree(xmlNode* doc) + cdef int xmlXIncludeProcessTreeFlags(xmlNode* doc, int parser_opts) # libxml2 >= 2.7.4 cdef int xmlXIncludeProcessTreeFlagsData( - xmlNode* doc, int parser_opts, void* data) nogil + xmlNode* doc, int parser_opts, void* data) - cdef xmlXIncludeCtxt* xmlXIncludeNewContext(xmlDoc* doc) nogil - cdef int xmlXIncludeProcessNode(xmlXIncludeCtxt* ctxt, xmlNode* node) nogil - cdef int xmlXIncludeSetFlags(xmlXIncludeCtxt* ctxt, int flags) nogil + cdef xmlXIncludeCtxt* xmlXIncludeNewContext(xmlDoc* doc) + cdef int xmlXIncludeProcessNode(xmlXIncludeCtxt* ctxt, xmlNode* node) + cdef int xmlXIncludeSetFlags(xmlXIncludeCtxt* ctxt, int flags) # libxml2 >= 2.6.27 cdef int xmlXIncludeProcessFlagsData( - xmlDoc* doc, int flags, void* data) nogil + xmlDoc* doc, int flags, void* data) diff --git a/src/lxml/includes/xmlerror.pxd b/src/lxml/includes/xmlerror.pxd index 13c8f3782..c5ac6a0aa 100644 --- a/src/lxml/includes/xmlerror.pxd +++ b/src/lxml/includes/xmlerror.pxd @@ -823,7 +823,7 @@ cdef extern from "libxml/xmlerror.h": XML_RELAXNG_ERR_TEXTWRONG = 39 # --- END: GENERATED CONSTANTS --- -cdef extern from "libxml/xmlerror.h": +cdef extern from "libxml/xmlerror.h" nogil: ctypedef struct xmlError: int domain int code @@ -838,15 +838,15 @@ cdef extern from "libxml/xmlerror.h": int int2 void* node - ctypedef void (*xmlGenericErrorFunc)(void* ctxt, char* msg, ...) nogil + ctypedef void (*xmlGenericErrorFunc)(void* ctxt, char* msg, ...) ctypedef void (*xmlStructuredErrorFunc)(void* userData, - xmlError* error) nogil + xmlError* error) cdef void xmlSetGenericErrorFunc( - void* ctxt, xmlGenericErrorFunc func) nogil + void* ctxt, xmlGenericErrorFunc func) cdef void xmlSetStructuredErrorFunc( - void* ctxt, xmlStructuredErrorFunc func) nogil + void* ctxt, xmlStructuredErrorFunc func) -cdef extern from "libxml/globals.h": +cdef extern from "libxml/globals.h" nogil: cdef xmlStructuredErrorFunc xmlStructuredError cdef void* xmlStructuredErrorContext diff --git a/src/lxml/includes/xmlparser.pxd b/src/lxml/includes/xmlparser.pxd index 45acfc846..9f3056248 100644 --- a/src/lxml/includes/xmlparser.pxd +++ b/src/lxml/includes/xmlparser.pxd @@ -6,7 +6,7 @@ from lxml.includes.tree cimport xmlInputReadCallback, xmlInputCloseCallback from lxml.includes.xmlerror cimport xmlError, xmlStructuredErrorFunc -cdef extern from "libxml/parser.h": +cdef extern from "libxml/parser.h" nogil: ctypedef void (*startElementNsSAX2Func)(void* ctx, const_xmlChar* localname, const_xmlChar* prefix, @@ -49,7 +49,7 @@ cdef extern from "libxml/parser.h": cdef int XML_SAX2_MAGIC -cdef extern from "libxml/tree.h": +cdef extern from "libxml/tree.h" nogil: ctypedef struct xmlParserInput: int line int length @@ -93,12 +93,12 @@ cdef extern from "libxml/xmlIO.h" nogil: cdef xmlParserInputBuffer* xmlAllocParserInputBuffer(int enc) -cdef extern from "libxml/parser.h": +cdef extern from "libxml/parser.h" nogil: - cdef xmlDict* xmlDictCreate() nogil - cdef xmlDict* xmlDictCreateSub(xmlDict* subdict) nogil - cdef void xmlDictFree(xmlDict* sub) nogil - cdef int xmlDictReference(xmlDict* dict) nogil + cdef xmlDict* xmlDictCreate() + cdef xmlDict* xmlDictCreateSub(xmlDict* subdict) + cdef void xmlDictFree(xmlDict* sub) + cdef int xmlDictReference(xmlDict* dict) cdef int XML_COMPLETE_ATTRS # SAX option for adding DTD default attributes cdef int XML_SKIP_IDS # SAX option for not building an XML ID dict @@ -181,36 +181,36 @@ cdef extern from "libxml/parser.h": # libxml2 2.9.0+ only: XML_PARSE_BIG_LINES = 4194304 # Store big lines numbers in text PSVI field - cdef void xmlInitParser() nogil - cdef void xmlCleanupParser() nogil + cdef void xmlInitParser() + cdef void xmlCleanupParser() - cdef int xmlLineNumbersDefault(int onoff) nogil - cdef xmlParserCtxt* xmlNewParserCtxt() nogil + cdef int xmlLineNumbersDefault(int onoff) + cdef xmlParserCtxt* xmlNewParserCtxt() cdef xmlParserInput* xmlNewIOInputStream(xmlParserCtxt* ctxt, xmlParserInputBuffer* input, - int enc) nogil - cdef int xmlCtxtUseOptions(xmlParserCtxt* ctxt, int options) nogil - cdef void xmlFreeParserCtxt(xmlParserCtxt* ctxt) nogil - cdef void xmlCtxtReset(xmlParserCtxt* ctxt) nogil - cdef void xmlClearParserCtxt(xmlParserCtxt* ctxt) nogil + int enc) + cdef int xmlCtxtUseOptions(xmlParserCtxt* ctxt, int options) + cdef void xmlFreeParserCtxt(xmlParserCtxt* ctxt) + cdef void xmlCtxtReset(xmlParserCtxt* ctxt) + cdef void xmlClearParserCtxt(xmlParserCtxt* ctxt) cdef int xmlParseChunk(xmlParserCtxt* ctxt, - char* chunk, int size, int terminate) nogil + char* chunk, int size, int terminate) cdef xmlDoc* xmlCtxtReadDoc(xmlParserCtxt* ctxt, char* cur, char* URL, char* encoding, - int options) nogil + int options) cdef xmlDoc* xmlCtxtReadFile(xmlParserCtxt* ctxt, char* filename, char* encoding, - int options) nogil + int options) cdef xmlDoc* xmlCtxtReadIO(xmlParserCtxt* ctxt, xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void* ioctx, char* URL, char* encoding, - int options) nogil + int options) cdef xmlDoc* xmlCtxtReadMemory(xmlParserCtxt* ctxt, char* buffer, int size, char* filename, const_char* encoding, - int options) nogil + int options) # iterparse: @@ -218,33 +218,34 @@ cdef extern from "libxml/parser.h": void* user_data, char* chunk, int size, - char* filename) nogil + char* filename) cdef int xmlCtxtResetPush(xmlParserCtxt* ctxt, char* chunk, int size, char* filename, - char* encoding) nogil + char* encoding) # entity loaders: ctypedef xmlParserInput* (*xmlExternalEntityLoader)( - const_char * URL, const_char * ID, xmlParserCtxt* context) nogil - cdef xmlExternalEntityLoader xmlGetExternalEntityLoader() nogil - cdef void xmlSetExternalEntityLoader(xmlExternalEntityLoader f) nogil + const_char * URL, const_char * ID, xmlParserCtxt* context) + cdef xmlExternalEntityLoader xmlGetExternalEntityLoader() + cdef void xmlSetExternalEntityLoader(xmlExternalEntityLoader f) # DTDs: - cdef xmlDtd* xmlParseDTD(const_xmlChar* ExternalID, const_xmlChar* SystemID) nogil + cdef xmlDtd* xmlParseDTD(const_xmlChar* ExternalID, const_xmlChar* SystemID) cdef xmlDtd* xmlIOParseDTD(xmlSAXHandler* sax, xmlParserInputBuffer* input, - int enc) nogil + int enc) -cdef extern from "libxml/parserInternals.h": + +cdef extern from "libxml/parserInternals.h" nogil: cdef xmlParserInput* xmlNewInputStream(xmlParserCtxt* ctxt) cdef xmlParserInput* xmlNewStringInputStream(xmlParserCtxt* ctxt, - char* buffer) nogil + char* buffer) cdef xmlParserInput* xmlNewInputFromFile(xmlParserCtxt* ctxt, - char* filename) nogil - cdef void xmlFreeInputStream(xmlParserInput* input) nogil - cdef int xmlSwitchEncoding(xmlParserCtxt* ctxt, int enc) nogil + char* filename) + cdef void xmlFreeInputStream(xmlParserInput* input) + cdef int xmlSwitchEncoding(xmlParserCtxt* ctxt, int enc) diff --git a/src/lxml/includes/xmlschema.pxd b/src/lxml/includes/xmlschema.pxd index 8e93cc570..067411113 100644 --- a/src/lxml/includes/xmlschema.pxd +++ b/src/lxml/includes/xmlschema.pxd @@ -2,7 +2,7 @@ from lxml.includes.tree cimport xmlDoc from lxml.includes.xmlparser cimport xmlSAXHandler from lxml.includes.xmlerror cimport xmlStructuredErrorFunc -cdef extern from "libxml/xmlschemas.h": +cdef extern from "libxml/xmlschemas.h" nogil: ctypedef struct xmlSchema ctypedef struct xmlSchemaParserCtxt diff --git a/src/lxml/includes/xpath.pxd b/src/lxml/includes/xpath.pxd index d01735b68..22069eb7c 100644 --- a/src/lxml/includes/xpath.pxd +++ b/src/lxml/includes/xpath.pxd @@ -4,7 +4,8 @@ from lxml.includes cimport xmlerror from libc.string cimport const_char from lxml.includes.tree cimport xmlChar, const_xmlChar -cdef extern from "libxml/xpath.h": + +cdef extern from "libxml/xpath.h" nogil: ctypedef enum xmlXPathObjectType: XPATH_UNDEFINED = 0 XPATH_NODESET = 1 @@ -73,63 +74,63 @@ cdef extern from "libxml/xpath.h": ctypedef struct xmlXPathCompExpr - ctypedef void (*xmlXPathFunction)(xmlXPathParserContext* ctxt, int nargs) nogil + ctypedef void (*xmlXPathFunction)(xmlXPathParserContext* ctxt, int nargs) ctypedef xmlXPathFunction (*xmlXPathFuncLookupFunc)(void* ctxt, const_xmlChar* name, - const_xmlChar* ns_uri) nogil + const_xmlChar* ns_uri) - cdef xmlXPathContext* xmlXPathNewContext(tree.xmlDoc* doc) nogil + cdef xmlXPathContext* xmlXPathNewContext(tree.xmlDoc* doc) cdef xmlXPathObject* xmlXPathEvalExpression(const_xmlChar* str, - xmlXPathContext* ctxt) nogil + xmlXPathContext* ctxt) cdef xmlXPathObject* xmlXPathCompiledEval(xmlXPathCompExpr* comp, - xmlXPathContext* ctxt) nogil - cdef xmlXPathCompExpr* xmlXPathCompile(const_xmlChar* str) nogil + xmlXPathContext* ctxt) + cdef xmlXPathCompExpr* xmlXPathCompile(const_xmlChar* str) cdef xmlXPathCompExpr* xmlXPathCtxtCompile(xmlXPathContext* ctxt, - const_xmlChar* str) nogil - cdef void xmlXPathFreeContext(xmlXPathContext* ctxt) nogil - cdef void xmlXPathFreeCompExpr(xmlXPathCompExpr* comp) nogil - cdef void xmlXPathFreeObject(xmlXPathObject* obj) nogil + const_xmlChar* str) + cdef void xmlXPathFreeContext(xmlXPathContext* ctxt) + cdef void xmlXPathFreeCompExpr(xmlXPathCompExpr* comp) + cdef void xmlXPathFreeObject(xmlXPathObject* obj) cdef int xmlXPathRegisterNs(xmlXPathContext* ctxt, - const_xmlChar* prefix, const_xmlChar* ns_uri) nogil + const_xmlChar* prefix, const_xmlChar* ns_uri) - cdef xmlNodeSet* xmlXPathNodeSetCreate(tree.xmlNode* val) nogil - cdef void xmlXPathFreeNodeSet(xmlNodeSet* val) nogil + cdef xmlNodeSet* xmlXPathNodeSetCreate(tree.xmlNode* val) + cdef void xmlXPathFreeNodeSet(xmlNodeSet* val) -cdef extern from "libxml/xpathInternals.h": +cdef extern from "libxml/xpathInternals.h" nogil: cdef int xmlXPathRegisterFunc(xmlXPathContext* ctxt, const_xmlChar* name, - xmlXPathFunction f) nogil + xmlXPathFunction f) cdef int xmlXPathRegisterFuncNS(xmlXPathContext* ctxt, const_xmlChar* name, const_xmlChar* ns_uri, - xmlXPathFunction f) nogil + xmlXPathFunction f) cdef void xmlXPathRegisterFuncLookup(xmlXPathContext *ctxt, xmlXPathFuncLookupFunc f, - void *funcCtxt) nogil + void *funcCtxt) cdef int xmlXPathRegisterVariable(xmlXPathContext *ctxt, const_xmlChar* name, - xmlXPathObject* value) nogil + xmlXPathObject* value) cdef int xmlXPathRegisterVariableNS(xmlXPathContext *ctxt, const_xmlChar* name, const_xmlChar* ns_uri, - xmlXPathObject* value) nogil - cdef void xmlXPathRegisteredVariablesCleanup(xmlXPathContext *ctxt) nogil - cdef void xmlXPathRegisteredNsCleanup(xmlXPathContext *ctxt) nogil - cdef xmlXPathObject* valuePop (xmlXPathParserContext *ctxt) nogil - cdef int valuePush(xmlXPathParserContext* ctxt, xmlXPathObject *value) nogil + xmlXPathObject* value) + cdef void xmlXPathRegisteredVariablesCleanup(xmlXPathContext *ctxt) + cdef void xmlXPathRegisteredNsCleanup(xmlXPathContext *ctxt) + cdef xmlXPathObject* valuePop (xmlXPathParserContext *ctxt) + cdef int valuePush(xmlXPathParserContext* ctxt, xmlXPathObject *value) - cdef xmlXPathObject* xmlXPathNewCString(const_char *val) nogil - cdef xmlXPathObject* xmlXPathWrapCString(const_char * val) nogil - cdef xmlXPathObject* xmlXPathNewString(const_xmlChar *val) nogil - cdef xmlXPathObject* xmlXPathWrapString(const_xmlChar * val) nogil - cdef xmlXPathObject* xmlXPathNewFloat(double val) nogil - cdef xmlXPathObject* xmlXPathNewBoolean(int val) nogil - cdef xmlXPathObject* xmlXPathNewNodeSet(tree.xmlNode* val) nogil - cdef xmlXPathObject* xmlXPathNewValueTree(tree.xmlNode* val) nogil + cdef xmlXPathObject* xmlXPathNewCString(const_char *val) + cdef xmlXPathObject* xmlXPathWrapCString(const_char * val) + cdef xmlXPathObject* xmlXPathNewString(const_xmlChar *val) + cdef xmlXPathObject* xmlXPathWrapString(const_xmlChar * val) + cdef xmlXPathObject* xmlXPathNewFloat(double val) + cdef xmlXPathObject* xmlXPathNewBoolean(int val) + cdef xmlXPathObject* xmlXPathNewNodeSet(tree.xmlNode* val) + cdef xmlXPathObject* xmlXPathNewValueTree(tree.xmlNode* val) cdef void xmlXPathNodeSetAdd(xmlNodeSet* cur, - tree.xmlNode* val) nogil + tree.xmlNode* val) cdef void xmlXPathNodeSetAddUnique(xmlNodeSet* cur, - tree.xmlNode* val) nogil - cdef xmlXPathObject* xmlXPathWrapNodeSet(xmlNodeSet* val) nogil - cdef void xmlXPathErr(xmlXPathParserContext* ctxt, int error) nogil + tree.xmlNode* val) + cdef xmlXPathObject* xmlXPathWrapNodeSet(xmlNodeSet* val) + cdef void xmlXPathErr(xmlXPathParserContext* ctxt, int error) diff --git a/src/lxml/includes/xslt.pxd b/src/lxml/includes/xslt.pxd index 101fb7e78..05d2d4b9b 100644 --- a/src/lxml/includes/xslt.pxd +++ b/src/lxml/includes/xslt.pxd @@ -11,7 +11,7 @@ cdef extern from "libxslt/xslt.h": cdef extern from "libxslt/xsltconfig.h": cdef int LIBXSLT_VERSION -cdef extern from "libxslt/xsltInternals.h": +cdef extern from "libxslt/xsltInternals.h" nogil: ctypedef enum xsltTransformState: XSLT_STATE_OK # 0 XSLT_STATE_ERROR # 1 @@ -42,35 +42,35 @@ cdef extern from "libxslt/xsltInternals.h": ctypedef struct xsltTemplate - cdef xsltStylesheet* xsltParseStylesheetDoc(xmlDoc* doc) nogil - cdef void xsltFreeStylesheet(xsltStylesheet* sheet) nogil + cdef xsltStylesheet* xsltParseStylesheetDoc(xmlDoc* doc) + cdef void xsltFreeStylesheet(xsltStylesheet* sheet) -cdef extern from "libxslt/imports.h": +cdef extern from "libxslt/imports.h" nogil: # actually defined in "etree_defs.h" cdef void LXML_GET_XSLT_ENCODING(const_xmlChar* result_var, xsltStylesheet* style) -cdef extern from "libxslt/extensions.h": +cdef extern from "libxslt/extensions.h" nogil: ctypedef void (*xsltTransformFunction)(xsltTransformContext* ctxt, xmlNode* context_node, xmlNode* inst, - void* precomp_unused) nogil + void* precomp_unused) cdef int xsltRegisterExtFunction(xsltTransformContext* ctxt, const_xmlChar* name, const_xmlChar* URI, - xmlXPathFunction function) nogil + xmlXPathFunction function) cdef int xsltRegisterExtModuleFunction(const_xmlChar* name, const_xmlChar* URI, - xmlXPathFunction function) nogil + xmlXPathFunction function) cdef int xsltUnregisterExtModuleFunction(const_xmlChar* name, const_xmlChar* URI) cdef xmlXPathFunction xsltExtModuleFunctionLookup( - const_xmlChar* name, const_xmlChar* URI) nogil + const_xmlChar* name, const_xmlChar* URI) cdef int xsltRegisterExtPrefix(xsltStylesheet* style, - const_xmlChar* prefix, const_xmlChar* URI) nogil + const_xmlChar* prefix, const_xmlChar* URI) cdef int xsltRegisterExtElement(xsltTransformContext* ctxt, const_xmlChar* name, const_xmlChar* URI, - xsltTransformFunction function) nogil + xsltTransformFunction function) -cdef extern from "libxslt/documents.h": +cdef extern from "libxslt/documents.h" nogil: ctypedef enum xsltLoadType: XSLT_LOAD_START XSLT_LOAD_STYLESHEET @@ -79,48 +79,48 @@ cdef extern from "libxslt/documents.h": ctypedef xmlDoc* (*xsltDocLoaderFunc)(const_xmlChar* URI, xmlDict* dict, int options, void* ctxt, - xsltLoadType type) nogil + xsltLoadType type) cdef xsltDocLoaderFunc xsltDocDefaultLoader - cdef void xsltSetLoaderFunc(xsltDocLoaderFunc f) nogil + cdef void xsltSetLoaderFunc(xsltDocLoaderFunc f) -cdef extern from "libxslt/transform.h": +cdef extern from "libxslt/transform.h" nogil: cdef xmlDoc* xsltApplyStylesheet(xsltStylesheet* style, xmlDoc* doc, - const_char** params) nogil + const_char** params) cdef xmlDoc* xsltApplyStylesheetUser(xsltStylesheet* style, xmlDoc* doc, const_char** params, const_char* output, void* profile, - xsltTransformContext* context) nogil + xsltTransformContext* context) cdef void xsltProcessOneNode(xsltTransformContext* ctxt, xmlNode* contextNode, - xsltStackElem* params) nogil + xsltStackElem* params) cdef xsltTransformContext* xsltNewTransformContext(xsltStylesheet* style, - xmlDoc* doc) nogil - cdef void xsltFreeTransformContext(xsltTransformContext* context) nogil + xmlDoc* doc) + cdef void xsltFreeTransformContext(xsltTransformContext* context) cdef void xsltApplyOneTemplate(xsltTransformContext* ctxt, xmlNode* contextNode, xmlNode* list, xsltTemplate* templ, - xsltStackElem* params) nogil + xsltStackElem* params) -cdef extern from "libxslt/xsltutils.h": +cdef extern from "libxslt/xsltutils.h" nogil: cdef int xsltSaveResultToString(xmlChar** doc_txt_ptr, int* doc_txt_len, xmlDoc* result, - xsltStylesheet* style) nogil + xsltStylesheet* style) cdef int xsltSaveResultToFilename(const_char *URL, xmlDoc* result, xsltStylesheet* style, - int compression) nogil + int compression) cdef int xsltSaveResultTo(xmlOutputBuffer* buf, xmlDoc* result, - xsltStylesheet* style) nogil + xsltStylesheet* style) cdef xmlGenericErrorFunc xsltGenericError cdef void *xsltGenericErrorContext cdef void xsltSetGenericErrorFunc( - void* ctxt, void (*handler)(void* ctxt, char* msg, ...)) nogil + void* ctxt, void (*handler)(void* ctxt, char* msg, ...) nogil) cdef void xsltSetTransformErrorFunc( xsltTransformContext*, void* ctxt, - void (*handler)(void* ctxt, char* msg, ...) nogil) nogil + void (*handler)(void* ctxt, char* msg, ...) nogil) cdef void xsltTransformError(xsltTransformContext* ctxt, xsltStylesheet* style, xmlNode* node, char* msg, ...) @@ -128,7 +128,7 @@ cdef extern from "libxslt/xsltutils.h": xsltTransformContext* ctxt, int options) -cdef extern from "libxslt/security.h": +cdef extern from "libxslt/security.h" nogil: ctypedef struct xsltSecurityPrefs ctypedef enum xsltSecurityOption: XSLT_SECPREF_READ_FILE = 1 @@ -139,44 +139,44 @@ cdef extern from "libxslt/security.h": ctypedef int (*xsltSecurityCheck)(xsltSecurityPrefs* sec, xsltTransformContext* ctxt, - char* value) nogil + char* value) - cdef xsltSecurityPrefs* xsltNewSecurityPrefs() nogil - cdef void xsltFreeSecurityPrefs(xsltSecurityPrefs* sec) nogil + cdef xsltSecurityPrefs* xsltNewSecurityPrefs() + cdef void xsltFreeSecurityPrefs(xsltSecurityPrefs* sec) cdef int xsltSecurityForbid(xsltSecurityPrefs* sec, xsltTransformContext* ctxt, - char* value) nogil + char* value) cdef int xsltSecurityAllow(xsltSecurityPrefs* sec, xsltTransformContext* ctxt, - char* value) nogil + char* value) cdef int xsltSetSecurityPrefs(xsltSecurityPrefs* sec, xsltSecurityOption option, - xsltSecurityCheck func) nogil + xsltSecurityCheck func) cdef xsltSecurityCheck xsltGetSecurityPrefs( xsltSecurityPrefs* sec, - xsltSecurityOption option) nogil + xsltSecurityOption option) cdef int xsltSetCtxtSecurityPrefs(xsltSecurityPrefs* sec, - xsltTransformContext* ctxt) nogil - cdef xmlDoc* xsltGetProfileInformation(xsltTransformContext* ctxt) nogil + xsltTransformContext* ctxt) + cdef xmlDoc* xsltGetProfileInformation(xsltTransformContext* ctxt) -cdef extern from "libxslt/variables.h": +cdef extern from "libxslt/variables.h" nogil: cdef int xsltQuoteUserParams(xsltTransformContext* ctxt, const_char** params) cdef int xsltQuoteOneUserParam(xsltTransformContext* ctxt, const_xmlChar* name, const_xmlChar* value) -cdef extern from "libxslt/extra.h": +cdef extern from "libxslt/extra.h" nogil: const_xmlChar* XSLT_LIBXSLT_NAMESPACE const_xmlChar* XSLT_XALAN_NAMESPACE const_xmlChar* XSLT_SAXON_NAMESPACE const_xmlChar* XSLT_XT_NAMESPACE cdef xmlXPathFunction xsltFunctionNodeSet - cdef void xsltRegisterAllExtras() nogil + cdef void xsltRegisterAllExtras() -cdef extern from "libexslt/exslt.h": - cdef void exsltRegisterAll() nogil +cdef extern from "libexslt/exslt.h" nogil: + cdef void exsltRegisterAll() # libexslt 1.1.25+ const_xmlChar* EXSLT_DATE_NAMESPACE @@ -188,4 +188,3 @@ cdef extern from "libexslt/exslt.h": cdef int exsltSetsXpathCtxtRegister(xmlXPathContext* ctxt, const_xmlChar* prefix) cdef int exsltMathXpathCtxtRegister(xmlXPathContext* ctxt, const_xmlChar* prefix) cdef int exsltStrXpathCtxtRegister(xmlXPathContext* ctxt, const_xmlChar* prefix) -