Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Errors are suppressed in generator comprehensions #32

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

Closed
ncw opened this issue Oct 10, 2018 · 7 comments
Closed

Errors are suppressed in generator comprehensions #32

ncw opened this issue Oct 10, 2018 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@ncw
Copy link
Collaborator

ncw commented Oct 10, 2018

>>> list(i for x in range(10))
[]

Which should have output

>>> list(i for x in range(10))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 1, in <genexpr>
NameError: name 'i' is not defined
@ncw ncw added the bug Something isn't working label Oct 10, 2018
@corona10
Copy link
Collaborator

@ncw I will take a look this issue

@corona10
Copy link
Collaborator

corona10 commented Nov 24, 2018

list(i for x in range(10))
-> Expression(body=Call(func=Name(id='list', ctx=Load()), args=[GeneratorExp(elt=Name(id='i', ctx=Load()), generators=[comprehension(target=Name(id='x', ctx=Store()), iter=Call(func=Name(id='range', ctx=Load()), args=[Num(n=10)], keywords=[], starargs=None, kwargs=None), ifs=[])])], keywords=[], starargs=None, kwargs=None))
[i for x in range(10)]
-> Expression(body=ListComp(elt=Name(id='i', ctx=Load()), generators=[comprehension(target=Name(id='x', ctx=Store()), iter=Call(func=Name(id='range', ctx=Load()), args=[Num(n=10)], keywords=[], starargs=None, kwargs=None), ifs=[])]))

@ncw
Copy link
Collaborator Author

ncw commented Nov 27, 2018

@corona10 are you getting anywhere with this? Do you need help?

@corona10
Copy link
Collaborator

@ncw

res, err := VmRunFrame(it.Frame)

Well, I tracked the code and I found that something issue in this side.
But I don't know which is the main reason for this issue yet.

So if you already solve this issue, Then please upload a PR for this issue :)
I can learn something from your PR.

@ncw
Copy link
Collaborator Author

ncw commented Nov 28, 2018

Well, I tracked the code and I found that something issue in this side.
But I don't know which is the main reason for this issue yet.

I haven't figured it out either!

But yes, it is probably something to do with making a new Vm Frame and the errors being suppressed there rather than propagated.

@corona10
Copy link
Collaborator

@ncw
I found the main reason for this bug.
I will upload the PR soon

@ncw
Copy link
Collaborator Author

ncw commented Nov 28, 2018

I found the main reason for this bug.
I will upload the PR soon

Great. Don't forget a failing test case :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants