Re: Python 3.5 issue - SystemError: <built-in function xmlReadFile> returned a result with an error set

Daniel Veillard <[email protected]>
Newsgroups gmane.comp.gnome.lib.xml.general
Message-ID <[email protected]>
  Hum,

yes seeing the same with 3.5.3:

thinkpad2:~/XML/python/tests -> python3 tstLastError.py
TypeError: 'NoneType' object is not callable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "tstLastError.py", line 80, in <module>
    test.test1()
  File "tstLastError.py", line 62, in test1
    line=0)
  File "tstLastError.py", line 30, in failUnlessXmlError
    f(*args)
  File "/home/veillard/XML/python/libxml2.py", line 1374, in readFile
    ret = libxml2mod.xmlReadFile(filename, encoding, options)
SystemError: <built-in function xmlReadFile> returned a result with an error set
thinkpad2:~/XML/python/tests -> 

 This feels like we tried to call a None method but somehow in the
C python bindings, it's generated and does

    if (!PyArg_ParseTuple(args, (char *)"zzi:xmlReadFile", &filename, &encoding, &options))
        return(NULL);

    c_retval = xmlReadFile(filename, encoding, options);
    py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
    return(py_retval);

 unclear what is going wrong there, c_retval ought to be NULL, and
libxml_xmlDocPtrWrap should just Py_INCREF(Py_None); and return Py_None

we are specifically testing how an error is processed trying to parse a
non existent file, and it seems that the way python3 evaluation proceeds
differs in 3.5 maybe it checks for C bindings returning Py_None but that
should show in many placews I think...

  puzzled,

Daniel

On Wed, Aug 30, 2017 at 02:00:48PM +0200, Petr Sumbera wrote:
> Hi,
> 
> anyone seen following error when running Python regression tests? This is
> just with Python 3.5. Pythons 2.7 and 3.4 are ok (I haven't tested Python
> 3.6).
> 
> Any idea?
> 
> Thanks,
> 
> Petr
> 
> 
> ## running Python regression tests
> TypeError: 'NoneType' object is not callable
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):
>   File "/builds/psumbera/userland-libxml2-2.9.5/components/libxml2/libxml2-2.9.5/python/tests/tstLastError.py",
> line 80, in <module>
>     test.test1()
>   File "/builds/psumbera/userland-libxml2-2.9.5/components/libxml2/libxml2-2.9.5/python/tests/tstLastError.py",
> line 62, in test1
>     line=0)
>   File "/builds/psumbera/userland-libxml2-2.9.5/components/libxml2/libxml2-2.9.5/python/tests/tstLastError.py",
> line 30, in failUnlessXmlError
>     f(*args)
>   File "/builds/psumbera/userland-libxml2-2.9.5/components/libxml2/libxml2-2.9.5/python/libxml2.py",
> line 1374, in readFile
>     ret = libxml2mod.xmlReadFile(filename, encoding, options)
> SystemError: <built-in function xmlReadFile> returned a result with an error
> set
> -- tstLastError.py
> _______________________________________________
> xml mailing list, project page  http://xmlsoft.org/
> [email protected]
> https://mail.gnome.org/mailman/listinfo/xml

-- 
Daniel Veillard      | Red Hat Developers Tools http://developer.redhat.com/
[email protected]  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | virtualization library  http://libvirt.org/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.