mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-11 21:41: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:
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user