[issue11549] Build-out an AST optimizer, moving some functionality out of the peephole optimizer

2017-01-31 Thread Hugo Geoffroy
Hugo Geoffroy added the comment: I would like to point out that the changes in `ast.literal_eval` may have some security risk for code that do not expect this function to return an object with user-controlled length (for example, with `2**32*'X'`). AFAIK, this is not possible with t

[issue25532] infinite loop when running inspect.unwrap over unittest.mock.call

2016-08-20 Thread Hugo Geoffroy
Hugo Geoffroy added the comment: This patch blacklists `__wrapped__` (using the same form as the first comment, with a more explicit exception message) in `unittest.mock._Call.__getattr__`. I also documented the change and added a tests that checks `assertFalse(hasattr(call, '__wrap

[issue25532] infinite loop when running inspect.unwrap over unittest.mock.call

2016-08-20 Thread Hugo Geoffroy
Hugo Geoffroy added the comment: You are right, the fix would be better suited in `unwrap`. But, still, shouldn't any `__getattr__` implementation take care of not returning, for the `__wrapped__` attribute, a dynamic wrapper that provides the same attribute ? `__wrapped__` is com

[issue25532] infinite loop when running inspect.unwrap over unittest.mock.call

2016-08-21 Thread Hugo Geoffroy
Hugo Geoffroy added the comment: Another argument for having the fix in `unwrap` rather than `signature` is that this bug does not actually seem to be called by `signature`, as the doctest module calls `unwrap` for "inspect.isroutine(inspect.unwrap(val))". Also, this call does not