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

The BLACS tab statemachine can crash if you return before yielding in a generator #49

Open
philipstarkey opened this issue Sep 27, 2018 · 0 comments
Labels
bug Something isn't working minor

Comments

@philipstarkey
Copy link
Member

Original report (archived issue) by Philip Starkey (Bitbucket: pstarkey, GitHub: philipstarkey).


For methods decorated with our define_state decorator we queue work up in the worker process using the yield keyword. This means that the method is a generator.

I seem to have hit a bug though where the method is detected as a generator, but doesn't actually ever yield, which then raises a StopIteration exception on this line of code.

The particular code that seems to be causing this is if you have a return statement in an if block, prior to actually calling yield for the first time. I had assumed that if it took that path, that it wouldn't be seen as a generator, and thus would never hit the link I linked to above. Apparently not, at least on Python 2.7.

Making this issue to remind us to investigate it a bit more (unless someone can immediately see what is wrong with the code).

Currently I think it probably will only affect the OpalKelly device code which has not been merged in yet. But it probably makes sense to fix whatever is wrong on the BLACS side rather than enforcing that you can't return prior to a yield in decorated device tab methods.

@philipstarkey philipstarkey added minor bug Something isn't working labels Apr 5, 2020
Loki27182 pushed a commit to Loki27182/blacs that referenced this issue Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working minor
Projects
None yet
Development

No branches or pull requests

1 participant