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

make sure SAX endDocument is always called as this could result in a

* parser.c: make sure SAX endDocument is always called as
  this could result in a Python memory leak otherwise (it's
  used to decrement ref-counting)
* python/generator.py python/libxml.c python/libxml.py
  python/libxml2-python-api.xml python/libxml2class.txt
  python/tests/error.py python/tests/xpath.py: implemented
  the suggestions made by Gary Benson and extended the tests
  to match it.
Daniel
This commit is contained in:
Daniel Veillard
2002-03-05 15:41:29 +00:00
parent ba5e18a3fb
commit 8d24cc1898
9 changed files with 321 additions and 23 deletions

View File

@ -16,8 +16,17 @@ def callback(ctx, str):
err = err + "%s %s" % (ctx, str)
got_exc = 0
libxml2.registerErrorHandler(callback, "-->")
doc = libxml2.parseFile("missing.xml")
try:
doc = libxml2.parseFile("missing.xml")
except libxml2.parserError:
got_exc = 1
if got_exc == 0:
print "Failed to get a parser exception"
sys.exit(1)
if err != expect:
print "error"
print "received %s" %(err)
@ -26,7 +35,10 @@ if err != expect:
i = 10000
while i > 0:
doc = libxml2.parseFile("missing.xml")
try:
doc = libxml2.parseFile("missing.xml")
except libxml2.parserError:
got_exc = 1
err = ""
i = i - 1

View File

@ -22,6 +22,14 @@ if len(res) != 2:
if res[0].name != "doc" or res[1].name != "foo":
print "xpath query: wrong node set value"
sys.exit(1)
ctxt.setContextNode(res[0])
res = ctxt.xpathEval("foo")
if len(res) != 1:
print "xpath query: wrong node set size"
sys.exit(1)
if res[0].name != "foo":
print "xpath query: wrong node set value"
sys.exit(1)
doc.freeDoc()
ctxt.xpathFreeContext()
i = 1000