Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash when analyzer encounters listcomp/genexprs #392

Merged
merged 1 commit into from
Jun 26, 2017

Conversation

jamesls
Copy link
Member

@jamesls jamesls commented Jun 26, 2017

Internally, python creates a function for listcomps/genexprs
so we treat it similarly. There's a new child scope and therefore
a new symbol table we need to fetch. The only tricky part is that
python names this function 'genexpr' and 'listcomp' even in the
case of multiple genexprs and listcomps. We're not analyzing the
generators attr of the nodes, but we will need to take that
into account when we do. For now it doesn't matter.

Closes #263

@jamesls jamesls requested review from stealthycoin and kyleknap June 26, 2017 22:54
@jamesls
Copy link
Member Author

jamesls commented Jun 26, 2017

Right, fixing this. I forgot that in py27 listcomps don't actually create a new child scope.

Internally, python creates a function for listcomps/genexprs
so we treat it similarly.  There's a new child scope and therefore
a new symbol table we need to fetch.  The only tricky part is that
python names this function 'genexpr' and 'listcomp' even in the
case of multiple genexprs and listcomps.  We're not analyzing the
`generators` attr of the nodes, but we will need to take that
into account when we do.  For now it doesn't matter.
@codecov-io
Copy link

codecov-io commented Jun 26, 2017

Codecov Report

Merging #392 into master will increase coverage by 0.1%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #392     +/-   ##
=========================================
+ Coverage   92.17%   92.27%   +0.1%     
=========================================
  Files          18       18             
  Lines        2440     2460     +20     
  Branches      320      323      +3     
=========================================
+ Hits         2249     2270     +21     
+ Misses        142      141      -1     
  Partials       49       49
Impacted Files Coverage Δ
chalice/analyzer.py 91.12% <100%> (+1.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d416139...396fb85. Read the comment docs.

@jamesls jamesls merged commit 396fb85 into aws:master Jun 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants