python/typed_ast

test_ignores and test_convert_strs fail on ppc64

sebix opened this issue · 5 comments

sebix commented

Hi,

in openSUSE packaging we experience two test fails on the ppc64 architecture (only):

=================================== FAILURES ===================================
_________________________________ test_ignores _________________________________

    def test_ignores():
        expected = [
            (2, ''),
            (5, ''),
            (8, '[excuse]'),
            (9, '=excuse'),
            (10, ' [excuse]'),
            (11, ' whatever'),
        ]
    
        for version in range(MIN_VER, NEXT_VER):
            tree = _ast3._parse(ignores, "<ignores>", "exec", version)
            assert [(ti.lineno, ti.tag) for ti in tree.type_ignores] == expected
            with pytest.raises(SyntaxError):
                _ast3._parse("pass  # type: ignoreé\n", "<ignores>", "exec", version)
    
    
        tree = _ast27.parse(ignores, "<ignores>", "exec")
>       assert [(ti.lineno, ti.tag) for ti in tree.type_ignores] == expected
E       AssertionError: assert [] == [(2, ''),\n (5, ''),\n (8, '[excuse]'),\n (9, '=excuse'),\n (10, ' [excuse]'),\n (11, ' whatever')]
E         Right contains 6 more items, first extra item: (2, '')
E         Full diff:
E           [
E         -  ,
E         +  (2,
E         +   ''),
E         +  (5,
E         +   ''),
E         +  (8,
E         +   '[excuse]'),
E         +  (9,
E         +   '=excuse'),
E         +  (10,
E         +   ' [excuse]'),
E         +  (11,
E         +   ' whatever'),
E           ]

ast3/tests/test_basics.py:223: AssertionError
______________________________ test_convert_strs _______________________________

    def test_convert_strs():
        ast = _ast27.parse(basic_py2, "<basic_py2>", "exec")
        tree = typed_ast.conversions.py2to3(ast)
>       assert tree.body[0].value.kind == ""
E       IndexError: list index out of range

ast3/tests/test_basics.py:305: IndexError
========================= 2 failed, 13 passed in 0.45s =========================

Full build log attached

Maybe you have an idea what's going on? We disabled the two tests for unblock other package builds as temporary solution.

Sorry, nothing comes to mind. Can you repro the results by manually logging in to that platform and manually building? I think the best way to do that is

python3.8 -m pip install .
pytest
sebix commented

Can you repro the results by manually logging in to that platform and manually building?

I'm struggling to do so. Will come back to you once I succeeded.

This causes a problem for Black on s390x too:

S390x is available on Travis CI, here's a branch to enable it:

And the same two tests fail for Python 3.5-3.8, but curiously pass for 3.9:

A big-endian issue?

Yeah, sounds like an issue at the C compiler level. It could also be due to struct alignment or calling convention? Not really my area of expertise any more. :-(

I wonder if there are some private APIs we're calling that changed (again) in 3.9 -- maybe we should try to isolate typed_ast more from this kind of thing by copying the source for private APIs (at least when feasible).

But it would still be most helpful to understand the root cause of these specific failures.

@sebix I believe #152 should fix this issue as well. Is this something you could confirm?