[issue32892] Remove specific constant AST types in favor of ast.Constant

2020-02-17 Thread miss-islington
miss-islington added the comment: New changeset 988aeba94bf1dab81dd52fc7b02dca7a57ea8ba0 by Miss Islington (bot) in branch '3.8': bpo-32892: Update the documentation for handling constants in AST. (GH-18514) https://github.com/python/cpython/commit/988aeba94bf1dab81dd52fc7b02dca7a57ea8ba0

[issue32892] Remove specific constant AST types in favor of ast.Constant

2020-02-17 Thread miss-islington
Change by miss-islington : -- pull_requests: +17910 pull_request: https://github.com/python/cpython/pull/18534 ___ Python tracker ___

[issue32892] Remove specific constant AST types in favor of ast.Constant

2020-02-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 85a2eef473a2c9ed3ab9c6ee339891fe99adbbc9 by Serhiy Storchaka in branch 'master': bpo-32892: Update the documentation for handling constants in AST. (GH-18514) https://github.com/python/cpython/commit/85a2eef473a2c9ed3ab9c6ee339891fe99adbbc9

[issue32892] Remove specific constant AST types in favor of ast.Constant

2020-02-15 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +17891 pull_request: https://github.com/python/cpython/pull/18514 ___ Python tracker ___

[issue32892] Remove specific constant AST types in favor of ast.Constant

2019-05-14 Thread Anthony Sottile
Anthony Sottile added the comment: hitting this in https://bugs.python.org/issue36917? Is the simplification here really worth the breaking change to consumers? I now have to write something that's essentially this to work around this which feels more like the complexity has just been

[issue32892] Remove specific constant AST types in favor of ast.Constant

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

[issue32892] Remove specific constant AST types in favor of ast.Constant

2019-04-22 Thread Miro Hrončok
Miro Hrončok added the comment: Mako (now fixed) https://github.com/sqlalchemy/mako/issues/287 -- nosy: +hroncok ___ Python tracker ___

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-11-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Chameleon has been fixed. Genshi needs more work (seems it has issues with 3.7 too). There are other third-party projects broken after this change, but it is not hard to fix them. Closed this issue. Open new issues for new problems. --

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-10-28 Thread Guido van Rossum
Change by Guido van Rossum : -- nosy: -gvanrossum ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-10-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 6015cc50bc38b9e920ce4986ee10658eaa14f561 by Serhiy Storchaka in branch 'master': bpo-32892: Support subclasses of base types in isinstance checks for AST constants. (GH-9934)

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-10-17 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +9285 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-10-17 Thread STINNER Victor
STINNER Victor added the comment: > This change broke two templating engines: > * Genshi: https://github.com/python/performance/issues/46 upstream issue: https://genshi.edgewall.org/ticket/612 > * Chameleon: https://github.com/python/performance/issues/47 upstream issue:

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-10-17 Thread STINNER Victor
STINNER Victor added the comment: This change broke two templating engines: * Genshi: https://github.com/python/performance/issues/46 * Chameleon: https://github.com/python/performance/issues/47 -- ___ Python tracker

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-10-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Submitted a fix for Pyflakes: https://github.com/PyCQA/pyflakes/pull/369. It had more problems due to changes in line and column numbers in SyntaxError. -- ___ Python tracker

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-10-01 Thread Jakub Wilk
Jakub Wilk added the comment: Also broke pyflakes: https://github.com/PyCQA/pyflakes/issues/367 -- nosy: +jwilk ___ Python tracker ___

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-09-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yesterday I submitted a PR that should fix astroid in Python 3.8: https://github.com/PyCQA/astroid/issues/616 -- ___ Python tracker ___

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-09-30 Thread Nathaniel Smith
Nathaniel Smith added the comment: As a point of information, this did in fact break pylint/astroid: https://github.com/PyCQA/astroid/issues/617 -- nosy: +njs ___ Python tracker

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-09-27 Thread STINNER Victor
STINNER Victor added the comment: Thank you Serhiy :-D I really love ast.Constant, it simplify many things when writing code modifying the AST. -- ___ Python tracker ___

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-09-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 3f22811fef73aec848d961593d95fa877f77ecbf by Serhiy Storchaka in branch 'master': bpo-32892: Use ast.Constant instead of specific constant AST types. (GH-9445) https://github.com/python/cpython/commit/3f22811fef73aec848d961593d95fa877f77ecbf

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-09-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Since Python 3.6 ;-) Thank you for correction Victor. It is what I meant. Why I had written 3.8? :-? -- ___ Python tracker ___

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-09-24 Thread Neil Schemenauer
Neil Schemenauer added the comment: I've checked Quixote PTL module support. I will have to make some changes to support the removal of Str and other node types. E.g. I have to change visit_Str to visit_Constant. The fixes are pretty easy though and I think it is reasonable that this

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-09-24 Thread STINNER Victor
STINNER Victor added the comment: Serhiy Storchaka: "ast.Constant is not new. You can use it since 3.8." Since Python 3.6 ;-) -- ___ Python tracker ___

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-09-22 Thread thautwarm
thautwarm added the comment: Thank you, Serhiy. I learned python ast through ast.parse and pretty print, which prevented me from knowing this useful one. In fact, I wonder if we could support more species of constant values accepted by ast.Constant? --

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-09-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: thautwarm, ast.Constant is not new. You can use it since 3.8. What is new in this issue -- ast.parse() will produce ast.Constant instead of ast.Num, ast.Str, etc. -- ___ Python tracker

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-09-21 Thread thautwarm
thautwarm added the comment: I'm in favor of this idea for prospective extensions that could be implemented through this brand-new ast.Constant. Actually I used to expect a more general ast.Constant when I was manipulating ASTs half a year ago, at that time my job is to make staging

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-09-21 Thread STINNER Victor
STINNER Victor added the comment: > * If the user of NodeVisitor implemented visit_Num(), but not implemented > visit_Constant(), his handler will not be triggered. This can be easily fixed > by implementing visit_Constant(). Constant was introduced in 3.6. IHMO that's an acceptable

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-09-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Can you describe what usages of the old API will continue to work, and what > part will break? Very good question! What will continue to work: * Instantiating. Both `Num(42)` and `Num(n=42)` will continue to work, but they will return an instance of

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-09-21 Thread STINNER Victor
STINNER Victor added the comment: Hum, I'm not sure that I understood correctly: does "isinstance(node, ast.Num)" still work with the patch? If yes, I see no reason to not merge the change ;-) -- ___ Python tracker

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-09-21 Thread Neil Schemenauer
Neil Schemenauer added the comment: As someone who does AST manipulation (Quixote PTL template support), I'm interested in this patch. I think what is proposed sounds like a good change. I.e. having the extra node types is not useful and makes the compiler harder to understand. Providing

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-09-20 Thread Guido van Rossum
Guido van Rossum added the comment: I don't feel confident reviewing the code, but I'm okay with the change. Can you describe what usages of the old API will continue to work, and what part will break? (It would seem that code that creates a tree using e.g. Num(42) will still work, but code

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-09-20 Thread STINNER Victor
STINNER Victor added the comment: +1. I wanted to propose this change while I was working on FAT Python, but I waited until I "completed" this project. Sadly, I abandonned the FAT Python. And I wasn't brave enough to propose to break the AST. --

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-09-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: PR 9445 is an implementation of this idea. For simplicity and for reducing affect on tests no deprecation warning is raised, and there is no validation of the type of argument for old classes. Num('123') will just return Constant('123') without errors and

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-09-20 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +8860 stage: -> patch review ___ Python tracker ___ ___

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-02-21 Thread Nick Coghlan
Nick Coghlan added the comment: Ah, right - in that case, I think the subclasses would be worthwhile, as they shouldn't be too much hassle to maintain for a release, and will provide a more graceful migration for folks doing their own AST processing and generation.

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-02-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Right, they shouldn't be just aliases, but Constant subclasses with __new__ which return Constant and __instancecheck__ which checks the type of the value. And the Constant class should have writable properties n and s. All

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-02-21 Thread Nick Coghlan
Nick Coghlan added the comment: As pure aliases, those wouldn't necessarily be that useful, as aside from NameConstant, the field names are different (Num.n, Str.s, Bytes.s). I do wonder whether it might be worth keeping "NameConstant", though, and use that for Ellipsis

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-02-21 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : Currently different literals are represented by different types in AST: Num -- for int, float and complex Str -- for str Bytes -- for bytes Ellipsis -- for Ellipsis NameConstant -- for True, False and None And Constant (added