Example #1
0
def fmain(seen):
    try:
        greenlet.getcurrent().parent.switch()
    except:
        seen.append(sys.exc_info()[0])
        raise
    raise SomeError
Example #2
0
 def objective_func(self, x):
     optimizer = self.optimizer
     context = optimizer._working_context
     index = self.index
     for var_index in range(len(optimizer.input_vars)):
         context[optimizer.input_vars[var_index].name][index] = x[var_index]
     greenlet.getcurrent().parent.switch()
     return (context[optimizer.objective_var][index],
             [context[optimizer.constraint_var][index]])
Example #3
0
 def f():
     lst.append(1)
     greenlet.getcurrent().parent.switch()
     lst.append(3)
Example #4
0
 def f1():
     f = sys._getframe(0)
     assert f.f_back is None
     greenlet.getcurrent().parent.switch(f)
     return "meaning of life"