1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-05 19:01:18 +03:00

Warn when using deprecated functions from Python bindings

This requires Python code to be run with -Wd.
This commit is contained in:
Nick Wellnhofer
2022-03-01 13:57:16 +01:00
parent b66ce0bba8
commit ebc5009793
3 changed files with 47 additions and 3 deletions

View File

@ -3822,6 +3822,23 @@ libxml_nodeHash(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
}
/************************************************************************
* *
* Deprecation warnings *
* *
************************************************************************/
int
libxml_deprecationWarning(const char *func) {
#if PY_VERSION_HEX >= 0x03020000
return PyErr_WarnFormat(PyExc_PendingDeprecationWarning, 1,
"libxml2mod.%s is deprecated and will be removed "
"in future versions", func);
#else
return PyErr_WarnEx(PyExc_PendingDeprecationWarning, func, 1);
#endif
}
/************************************************************************
* *
* The registration stuff *