GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||
GeezerVison is showing github.com — bpo-27494: Fix a 2to3 parser bug (trailing comma) by jstasiak · Pull Request #60 · python/cpython Conversation
|
Codecov Report
@@ Coverage Diff @@ ## master #60 +/- ## ========================================== + Coverage 82.37% 82.37% +<.01% ========================================== Files 1427 1427 Lines 350948 350951 +3 ========================================== + Hits 289091 289099 +8 + Misses 61857 61852 -5 Continue to review full report at Codecov.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'm not a core dev, but I took some time to review this anyway. (I recently familiarized myself with lib2to3 in order to make a different PR -- reviews welcome.)
Background:
This PR changes the lib2to3 grammar's handling of for syntax, to distinguish between the following two cases:
list comprehensions and generator expressions, e.g.
[x for x in foo](x for x in foo)set and dictionary comprehensions, e.g.
{x for x in foo}{x : y for x,y in zip(foo,bar)}Previously, the grammar used the same node type for those two cases. Unfortunately, that node specification is overly complicated due to backwards compatibility considerations. As a consequence, the grammar failed to handle some valid programs.
Review:
LGTM. The problematic case is indeed fixed, and now covered by the test suite. The three "fixers" that are affected by this Grammar change have been updated. (I see no others that need editing.)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I agree with the need for a verbose comment here, since it's not immediately obvious why old_comp_iter, etc. are necessary. IMHO, you should remove overly cautious words like "seems" and "I believe". Also, I think it might be worth adding a reference to this PR and/or bpo-27494 in the comment itself.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback, it makes sense; let me improve this a little.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Yes, just to be precise:
The second group would be set/dictionary comprehensions and call arguments (like |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
d7f230d to
e302044
Compare
|
cc @benjaminp @serhiy-storchaka @vadmium @gpshead @1st1 (I looked up who changed I'm happy to make any changes necessary to get this merged, I just need to know what's required. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@ambv is this something you could review? I'm asking you because I see you're an author of another 2to3 patch (#1724) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
This commit adds a test case to trigger an assertion failure during shutdown and fixes the bug. The assertion was added by my first attempt to fix issue python#60. Thanks to Masamitsu Murase for reporting the bug and for providing the fix. (grafted from 655f2a2292a237636849b4a82fb0a2dde1ee9847 and 109d5d067b14)
e302044 to
e5a673d
Compare
e5a673d to
4a2d00c
Compare
|
Closed by accident, apologies. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
1818dc6 to
4ae43d5
Compare
…ession
While this is a valid Python 2 and Python 3 syntax lib2to3 would choke
on it:
set(x for x in [],)
This patch changes the grammar definition used by lib2to3 so that the
actual Python syntax is supported now and backwards compatibility is
preserved.
|
OK, I'm lost regarding Travis build failures. It seems that the configuration that Travis uses to build the docs (https://travis-ci.org/python/cpython/jobs/279869243/config) is different than in builds of some more recent PR-s (https://travis-ci.org/python/cpython/jobs/279831444/config for example). I suspect for whatever reason it's not picking up updates to .travis.yml (made since I created my branch even though I pushed them to the branch now) and that makes it fail. One thing I suspect may work around this is closing this PR and opening a new one... |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
4ae43d5 to
71b60a5
Compare
|
I gave up on trying to make this pull request work with Travis and created another one: #3771. The new one has been actually built successfully now! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
* Update .coveragerc * Keep whitespace consistent. Co-authored-by: Jason R. Coombs <[email protected]>
* Fix: Correct target_bb_id in jump array * Doc: Updated doc for add_metadata_to_jump_2d_array
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.