diff --git a/python/libxml.c b/python/libxml.c
index 8c66fed6..8bb3db27 100644
--- a/python/libxml.c
+++ b/python/libxml.c
@@ -2329,6 +2329,32 @@ libxml_xmlRegisterXPathFunction(ATTRIBUTE_UNUSED PyObject * self,
return (py_retval);
}
+PyObject *
+libxml_xmlXPathRegisterVariable(ATTRIBUTE_UNUSED PyObject * self,
+ PyObject * args)
+{
+ PyObject *py_retval;
+ int c_retval = 0;
+ xmlChar *name;
+ xmlChar *ns_uri;
+ xmlXPathContextPtr ctx;
+ xmlXPathObjectPtr val;
+ PyObject *pyobj_ctx;
+ PyObject *pyobj_value;
+
+ if (!PyArg_ParseTuple
+ (args, (char *) "OszO:xpathRegisterVariable", &pyobj_ctx, &name,
+ &ns_uri, &pyobj_value))
+ return (NULL);
+
+ ctx = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctx);
+ val = libxml_xmlXPathObjectPtrConvert(pyobj_value);
+
+ c_retval = xmlXPathRegisterVariableNS(ctx, name, ns_uri, val);
+ py_retval = libxml_intWrap(c_retval);
+ return (py_retval);
+}
+
/************************************************************************
* *
* Global properties access *
diff --git a/python/libxml2-python-api.xml b/python/libxml2-python-api.xml
index 42f661d5..032b44ba 100644
--- a/python/libxml2-python-api.xml
+++ b/python/libxml2-python-api.xml
@@ -10,6 +10,15 @@
+
+ defined(LIBXML_XPATH_ENABLED)
+ Register a variable with the XPath context
+
+
+
+
+
+
Create a new Node
diff --git a/python/types.c b/python/types.c
index 54b50de2..2c9ab228 100644
--- a/python/types.c
+++ b/python/types.c
@@ -622,7 +622,6 @@ libxml_xmlXPathObjectPtrConvert(PyObject * obj)
printf("Unable to convert Python Object to XPath");
#endif
}
- Py_DECREF(obj);
return (ret);
}