You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 theyield
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.
The text was updated successfully, but these errors were encountered: