[pypy-issue] Issue #2560: Assert reinterpretation nonsense in app-tests (pypy/pypy)

Ronan Lamy issues-reply at bitbucket.org
Thu May 18 22:30:17 EDT 2017

New issue 2560: Assert reinterpretation nonsense in app-tests

Ronan Lamy:

On pypy3, when an assertion fails in an app-level test, the source code for the `assert` statement is passed on to pytest which compiles some bytecode that is run again by the interpreter in order to provide better error reporting. (BTW, this assert reinterpretation process has been abandoned by pytest for being too error-prone.)

The trouble is the compilation logic for this runs on the host Python (i.e. CPython2, typically), but the bytecode runs on top of an interpreted pypy3, so that `assert` statements that aren't bytecode-compatible between 2.7 and 3.5 cause BytecodeCorruptions, or worse.

Thanks to bytecode compatibility between CPython and PyPy, pypy2 is not visibly affected, though this logic is arguably also faulty there.

More information about the pypy-issue mailing list