diff options
| author | scoder <none@none> | 2006-03-23 09:11:53 +0100 |
|---|---|---|
| committer | scoder <none@none> | 2006-03-23 09:11:53 +0100 |
| commit | 86fc2cbe21ef17a52ebf3ffaad6295dc2dddcca0 (patch) | |
| tree | ff6c1154d7c3e16ae0114c0167106f77a3940630 | |
| parent | a9563a60fcb0e8e82626b037fc428ea790d90b02 (diff) | |
| download | python-lxml-86fc2cbe21ef17a52ebf3ffaad6295dc2dddcca0.tar.gz | |
[svn r814] clean up, make _getNsTag and _getFilenameForFile internal C functions (speeds up calling)
--HG--
branch : trunk
| -rw-r--r-- | src/lxml/etree.pyx | 8 | ||||
| -rw-r--r-- | src/lxml/python.pxd | 1 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/lxml/etree.pyx b/src/lxml/etree.pyx index a39c56b9..8f55b1e9 100644 --- a/src/lxml/etree.pyx +++ b/src/lxml/etree.pyx @@ -1089,13 +1089,13 @@ cdef class ElementTagFilter: cdef xmlNode* _createElement(xmlDoc* c_doc, object name_utf, object attrib, object extra) except NULL: cdef xmlNode* c_node - if python.PyObject_IsTrue(extra): + if extra: if attrib is None: attrib = extra else: attrib.update(extra) c_node = tree.xmlNewDocNode(c_doc, NULL, name_utf, NULL) - if python.PyObject_IsTrue(attrib): + if attrib: for name, value in attrib.items(): attr_name_utf = _utf8(name) value_utf = _utf8(value) @@ -1528,7 +1528,7 @@ cdef object _utf8(object s): else: raise TypeError, "Argument must be string or unicode." -def _getNsTag(tag): +cdef _getNsTag(tag): """Given a tag, find namespace URI and tag name. Return None for NS uri if no namespace URI available. """ @@ -1562,7 +1562,7 @@ cdef object _namespacedName(xmlNode* c_node): else: return s -def _getFilenameForFile(source): +cdef _getFilenameForFile(source): """Given a Python File or Gzip object, give filename back. Returns None if not a file object. diff --git a/src/lxml/python.pxd b/src/lxml/python.pxd index ad4b3377..2cef4781 100644 --- a/src/lxml/python.pxd +++ b/src/lxml/python.pxd @@ -34,7 +34,6 @@ cdef extern from "Python.h": cdef int PySequence_Check(object instance) cdef int PyType_Check(object instance) cdef int PyCallable_Check(object instance) - cdef int PyObject_IsTrue(object instance) cdef int PyObject_IsInstance(object instance, object classes) cdef int PyObject_HasAttr(object obj, object attr) |
