pylint-bot / test

0 stars 0 forks source link

Deprecate and remove astpeepholeoptimizer #210

Closed pylint-bot closed 8 years ago

pylint-bot commented 8 years ago

Originally reported by: Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore?)


The module was added a while ago, for fixing a recursion problem found in a PyPi package. The code was using string concatenation in order to build a huge base64-encoded image, which unfortunately hit the recursion limit in astroid.rebuilder. The problem is that the code wasn't working by default in CPython, without modifying the recursion limit to something higher. Since the peephole optimizer we have is badly named and it actually doesn't do optimizing (it's just some constant folding) and since the problem it supposed to be fixing shouldn't be handled like this, we could deprecate it and eventually remove it. This also implies the same modification in pylint, where the flag --optimize-ast is exposed.


pylint-bot commented 8 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore?):


Remove the astpeephole

It was initially added in order to remove a recursion error in rebuilder, which happened when a lot of strings were added together, leading to an actual recursion error when executing the code. The peepholer was more of a constant folding algorithm rather than a real peepholer. Since it's purpose is limited and the original problem is not worth fixing in astroid, but in the user code, this is removed. Closes issue #210