[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-08-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you for your report and discussion Anthony. Added the default implementation of visit_Constant which calls corresponding visitor for old constant nodes. It emits a deprecation warning (PendingDeprecationWarning in 3.8 and DeprecationWarning in 3.9)

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-08-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset c2388622923c81b5f06b0c9a5ce821fc03c624b9 by Serhiy Storchaka in branch '3.7': bpo-36917: Backport basic test for ast.NodeVisitor. (GH-15511) https://github.com/python/cpython/commit/c2388622923c81b5f06b0c9a5ce821fc03c624b9 --

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-08-26 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +15197 pull_request: https://github.com/python/cpython/pull/15511 ___ Python tracker ___

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-08-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 522a394a72f107ca55701371529b5e4ed20c9fff by Serhiy Storchaka (Miss Islington (bot)) in branch '3.8': [3.8] bpo-36917: Add default implementation of ast.NodeVisitor.visit_Constant(). (GH-15490) (GH-15509)

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-08-26 Thread miss-islington
Change by miss-islington : -- pull_requests: +15195 pull_request: https://github.com/python/cpython/pull/15509 ___ Python tracker ___

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-08-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset c3ea41e9bf100a5396b851488c3efe208e5e2179 by Serhiy Storchaka in branch 'master': bpo-36917: Add default implementation of ast.NodeVisitor.visit_Constant(). (GH-15490)

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-08-25 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +15177 stage: -> patch review pull_request: https://github.com/python/cpython/pull/15490 ___ Python tracker

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-06-25 Thread Daniel Hilst Selli
Change by Daniel Hilst Selli : -- nosy: +dhilst ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-06-25 Thread Tyler Wince
Tyler Wince added the comment: Another example of the breaking change here is in the security linter `PyCQA/bandit`. It may be a simple addition of a check in the meta parser for the ast but I would tend to agree with Anthony around whether or not it is worth it. Anyone else have any

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-05-18 Thread Batuhan
Batuhan added the comment: What about adding visit_Constant to NodeVisitor for at least one relase period and call visit_Str, visit_Num etc? -- nosy: +BTaskaya ___ Python tracker

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-05-15 Thread Anthony Sottile
Anthony Sottile added the comment: > You can not use the same implementation of the visitor for Num, Str, > NameConstant and Ellipsis, because all these classes use different attribute > for saving the value ah yes, this is true -- maybe the better change would be to just add `@property

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-05-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: You can not use the same implementation of the visitor for Num, Str, NameConstant and Ellipsis, because all these classes use different attribute for saving the value (Ellipsis does not have it at all). For the same reasons you can not just pass the

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-05-15 Thread Anthony Sottile
Anthony Sottile added the comment: The simplest case is just the addition of an `isinstance` check: https://github.com/asottile/dead/blob/85f5edbb84b5e118beab4be3346a630e41418a02/dead.py#L165-L170 class V(ast.NodeVisitor): def visit_Str(self, node): ... def

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-05-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This is not a new case. This is exactly the same problem which has already been fixed in multiple other projects. Could you show your real code Anthony? In all known opensource examples (astroid, pyflakes, genshi, chameleon, mako) the compatibility fix is

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-05-15 Thread Matthias Bussonnier
Matthias Bussonnier added the comment: > so my vote is to revert, keep the complexity in the compiler and out of user > code Playing Devil advocate here, but the complexity depends on what transformations user want to do; with the current state of 3.8, a user that wants to visit all

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-05-15 Thread Anthony Sottile
Anthony Sottile added the comment: spent some more time thinking about this and I think we should strongly consider reverting. simplification in the core interpreter should not be weighed lightly against complexity and breaking changes for users. the change is also unfortunate because it

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-05-14 Thread Matthias Bussonnier
Matthias Bussonnier added the comment: > There would still be a breakage for that if someone was defining py36+ > `visit_Constant` (which would clobber the `ast.NodeVisitor.visit_Constant` if > we were to add it) Ok, it would still break in some cases, but that would still be a net

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-05-14 Thread Anthony Sottile
Anthony Sottile added the comment: There would still be a breakage for that if someone was defining py36+ `visit_Constant` (which would clobber the `ast.NodeVisitor.visit_Constant` if we were to add it) -- ___ Python tracker

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-05-14 Thread Matthias Bussonnier
Matthias Bussonnier added the comment: Would it be useful to add a default implementation of `visit_Constant(self, node)` on NodeVisitor that go through all the isinstance() check and call the appropriate backward compatible method ? We would still have the simplification without having

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-05-14 Thread Anthony Sottile
Anthony Sottile added the comment: wrong bpo, this is the right one: https://bugs.python.org/issue32892 -- ___ Python tracker ___

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-05-14 Thread Matthias Bussonnier
Change by Matthias Bussonnier : -- nosy: +mbussonn ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-05-14 Thread Anthony Sottile
New submission from Anthony Sottile : More fallout from the Constant change in https://bugs.python.org/issue32892 minimal reproduction: import ast class V(ast.NodeVisitor): def visit_Str(self, node): print(node.s) def main(): V().visit(ast.parse('x = "hi"')) if __name__