1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-07 12:21:17 +03:00

added a check on the argument for some classes (e.g. xmlDoc and xmlNode)

* python/generator.py: added a check on the argument for some
  classes (e.g. xmlDoc and xmlNode) to prevent a segfault (as
  reported on the list).  Further enhancement should be done
  to auto-create the appropriate object.
* python/libxml.c: minor fix for a warning message; added a
  routine, currently not used, to report the description of a
  PyCObject.
* python/libxml2class.txt: regenerated
This commit is contained in:
William M. Brack
2004-07-16 10:39:30 +00:00
parent c815505f7d
commit c68d78d25a
4 changed files with 266 additions and 236 deletions

View File

@ -1016,6 +1016,13 @@ def buildWrappers():
classes.write("class %s(%s):\n" % (classname,
classes_ancestor[classname]))
classes.write(" def __init__(self, _obj=None):\n")
if classes_ancestor[classname] == "xmlCore" or \
classes_ancestor[classname] == "xmlNode":
classes.write(" if type(_obj).__name__ != ")
classes.write("'PyCObject':\n")
classes.write(" raise TypeError, ")
classes.write("'%s needs a PyCObject argument'\n" % \
classname)
if reference_keepers.has_key(classname):
rlist = reference_keepers[classname]
for ref in rlist: