This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Fix ast.unparse() for subscription by extended slices and tuples
Type: behavior Stage: resolved
Components: Demos and Tools, Library (Lib) Versions: Python 3.9, Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: miss-islington, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2020-03-07 14:41 by serhiy.storchaka, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 18824 merged serhiy.storchaka, 2020-03-07 14:46
PR 18826 merged serhiy.storchaka, 2020-03-07 16:06
PR 18827 merged miss-islington, 2020-03-07 16:55
Messages (4)
msg363596 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-03-07 14:41
ast.unparse() produces incorrect output for ExtSlice containing a single element:

>>> print(ast.unparse(ast.parse('a[i:j,]')))

a[i:j]

It also produces redundant parenthesis for Index containing Tuple:

>>> print(ast.unparse(ast.parse('a[i, j]')))

a[(i, j)]
msg363601 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-03-07 15:25
New changeset c4928fc1a853f3f84e2b4ec1253d0349137745e5 by Serhiy Storchaka in branch 'master':
bpo-39889: Fix ast.unparse() for subscript. (GH-18824)
https://github.com/python/cpython/commit/c4928fc1a853f3f84e2b4ec1253d0349137745e5
msg363602 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-03-07 16:55
New changeset 92b72788ecf2ee5dfac780c7dfb5ee5350fc641d by Serhiy Storchaka in branch '3.8':
[3.8] bpo-39889: Fix unparse.py for subscript. (GH-18824). (GH-18826)
https://github.com/python/cpython/commit/92b72788ecf2ee5dfac780c7dfb5ee5350fc641d
msg363605 - (view) Author: miss-islington (miss-islington) Date: 2020-03-07 17:13
New changeset 65b031090161331470827ec809732008b15030d5 by Miss Islington (bot) in branch '3.7':
[3.8] bpo-39889: Fix unparse.py for subscript. (GH-18824). (GH-18826)
https://github.com/python/cpython/commit/65b031090161331470827ec809732008b15030d5
History
Date User Action Args
2022-04-11 14:59:27adminsetgithub: 84070
2020-03-08 10:44:34serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-03-07 17:13:35miss-islingtonsetmessages: + msg363605
2020-03-07 16:55:56miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request18185
2020-03-07 16:55:35serhiy.storchakasetmessages: + msg363602
2020-03-07 16:06:05serhiy.storchakasetpull_requests: + pull_request18184
2020-03-07 15:25:39serhiy.storchakasetmessages: + msg363601
2020-03-07 14:46:53serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request18183
2020-03-07 14:41:32serhiy.storchakacreate