PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` #!/usr/bin/python -u # # This test exercise the redirection of error messages with a # functions defined in Python. # import sys import libxml2 # Memory debug specific libxml2.debugMemory(1) expect='--> I/O --> warning : --> failed to load external entity "missing.xml"\n' err="" def callback(ctx, str): global err err = err + "%s %s" % (ctx, str) got_exc = 0 libxml2.registerErrorHandler(callback, "-->") 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)) print("expected %s" %(expect)) sys.exit(1) i = 10000 while i > 0: try: doc = libxml2.parseFile("missing.xml") except libxml2.parserError: got_exc = 1 err = "" i = i - 1 # Memory debug specific libxml2.cleanupParser() if libxml2.debugMemory(1) == 0: print("OK") else: print("Memory leak %d bytes" % (libxml2.debugMemory(1))) libxml2.dumpMemory()