[Twisted-Python] trial.unitest-specific segfault with lxml

Phil Mayers p.mayers at imperial.ac.uk
Thu Aug 17 16:47:16 MDT 2017


This is an odd one; I have a simple test using the incremental xmlfile() 
feature of lxml, that crashes *only* if the test case inherits from 
trial.unittest.TestCase; it works if inheriting from unittest.TestCase.

SSCCE - well, hopefully correct - here:

https://gist.github.com/philmayers/387597c7407ab98f159426cea5f44a69

With lxml 3.8.0 (tried both manylinux1 wheel from PyPI and 
locally-compiled) and a debug python, I get:

$ bin/python2-debug -m twisted.trial test_repro.py
test_repro
   Test
     test_one ...    [OK]
     test_two ...    [OK]

-------------------------------------------------------------------------------
Ran 2 tests in 0.032s

PASSED (successes=2)
python2-debug: /builddir/build/BUILD/Python-2.7.13/Python/getargs.c:229: 
vgetargs1: Assertion `compat || (args != (PyObject*)NULL)' failed.
Aborted (core dumped)

Obviously lxml is a pretty big chunk of Cython, but the trial-specific 
nature of the crash has me curious which of the two is at fault.

I have tried to debug it, and it basically seems to end up somewhere 
inside the Cython-generated code with an argument to a python function 
that is NULL when it shouldn't be.

Any ideas?



More information about the Twisted-Python mailing list