On Tue, 10 Dec 2019 at 00:00, Steven D'Aprano <st...@pearwood.info> wrote: > > On Sat, Dec 07, 2019 at 07:37:58PM +0000, Oscar Benjamin wrote: > > > I recently hit on a situation that created a one million line code file: > > https://github.com/pytest-dev/pytest/issues/4406#issuecomment-439629715 > > > > The original file (which is included in SymPy) has 3000 lines > > averaging 500 characters per line so that the total file is 1.5MB. > > Since it is a test file pytest rewrites the corresponding pyc file and > > adds extra lines to annotate the intermediate results in the large > > expressions. The pytest-rewritten code has just over a million lines. > > If I'm reading you correctly, you're saying that, on average, pytest > annotates each line of source code with over 300 additional lines of > code.
To be clear that's what happens with this particular file but is not otherwise typical of pytest. The idea is to rewrite something like assert f(x+y) == z as tmp1 = x+y tmp2 = f(tmp1) tmp3 = z it tmp1 != tmp2: # Print information showing the intermediate expressions tmp1, tmp2, tmp3 This rewriting is normally useful and harmless but it explodes when used with complicated mathematical expressions like this: https://github.com/sympy/sympy/blob/d670689ae212c4f0ad4549eda17a111404694a27/sympy/solvers/tests/test_ode.py#L295 -- Oscar _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/S74ZEASIWBXXEEMOO4KBFBZ4NFGYSKZD/ Code of Conduct: http://python.org/psf/codeofconduct/