classification
Title: Remove Suite node from AST
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: BTaskaya, benjamin.peterson, brett.cannon, jeff.allen, pablogsal, shihai1991, vstinner, yselivanov
Priority: low Keywords: patch

Created on 2020-02-15 11:46 by BTaskaya, last changed 2020-03-04 16:17 by pablogsal. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 18513 merged BTaskaya, 2020-02-15 12:33
Messages (5)
msg362014 - (view) Author: Batuhan Taskaya (BTaskaya) * (Python triager) Date: 2020-02-15 11:46
AST is containing a node from past that is explained as "not really an actual node but useful in Jython's typesystem.". There is no usage of it anywhere in the CPython repo, just some code in ast_optimizer, symbol table and compiler to forbid it from running. If there is not any specific reason to keep it, we can just remove and clean some code.
msg362018 - (view) Author: hai shi (shihai1991) * Date: 2020-02-15 13:26
I am not sure there have any relation with jython's python.asdl?

https://github.com/jythontools/jython/blob/master/ast/Python.asdl#L10
msg362477 - (view) Author: Jeff Allen (jeff.allen) * Date: 2020-02-22 20:35
Jython uses the reference grammar and ASDL as a way to ensure it is Python we approximate, not some subtly different language. The presence of Suite here gives rise to a class (https://github.com/jythontools/jython/blob/v2.7.2b3/src/org/python/antlr/ast/Suite.java) and we actually use instances of it in the compiler (https://github.com/jythontools/jython/blob/v2.7.2b3/src/org/python/compiler/CodeCompiler.java#L2389).

It is a bit of a wart, to have a Jython-specific type here: somewhat defeating the object of using the same source. I expect there was a good reason: perhaps there was no better way to express the commonality between Interactive and Module. It was all before my involvement.

I would try to avoid needing it in Jython 3, and if we can't, it doesn't look hard to manage the variation our copy. It's not like we copy these files mechanically from from CPython during a build.

+1 on removing it.
msg363304 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-03 21:30
Jeff Allen: thanks for the useful feedback on how it's used in Jython!
msg363358 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-03-04 16:16
New changeset d82e469048e0e034d8c0020cd33b733be1adf68b by Batuhan Ta┼čkaya in branch 'master':
bpo-39639: Remove the AST "Suite" node and associated code (GH-18513)
https://github.com/python/cpython/commit/d82e469048e0e034d8c0020cd33b733be1adf68b
History
Date User Action Args
2020-03-04 16:17:30pablogsalsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-03-04 16:16:54pablogsalsetmessages: + msg363358
2020-03-03 21:30:27vstinnersetnosy: + vstinner
messages: + msg363304
2020-02-22 20:35:32jeff.allensetnosy: + jeff.allen
messages: + msg362477
2020-02-15 13:26:09shihai1991setnosy: + shihai1991
messages: + msg362018
2020-02-15 12:33:14BTaskayasetkeywords: + patch
stage: patch review
pull_requests: + pull_request17890
2020-02-15 11:47:40BTaskayasetpriority: normal -> low
title: Remote Suite node from AST -> Remove Suite node from AST
2020-02-15 11:46:49BTaskayacreate