[pypy-dev] coroutine problem

Christian Tismer tismer at stackless.com
Tue Feb 14 11:55:03 CET 2006


Hi Armin,

here a summary of my problem.
This version compiles:

     def _bind(self, thunk):
         state = self.costate
         self.parent = state.current
         state.last.frame = yield_current_frame_to_caller()
         try:
             thunk.call()
         except CoroutineExit:
             # ignore a shutdown exception
             pass
         except Exception, e:
             # redirect all unhandled exceptions to the parent
             state.things_to_do = True
             state.temp_exc = e
         while self.parent is not None and self.parent.frame is None:
             # greenlet behavior is fine
             self.parent = self.parent.parent
         return self._update_state(state, self.parent)

WHen I change it like this:

     def _bind(self, thunk):
         state = self.costate
         self.parent = state.current
         try:
             state.last.frame = yield_current_frame_to_caller()
             thunk.call()

Then I get the exception mismatch.

I still don't get why you think these are identical.
It is true, the yield call does never create an exception
by itself.
But it is the place where I arrive from any other
switch, and the switch is built in a way that it
can create an exception. This pops up exactly
at the place where we yield. So I'd like to show up
inside an exception handler. Of course it is possible
to move this handler further up.

anything wrong with this reasoning?

cheers - chris

-- 
Christian Tismer             :^)   <mailto:tismer at stackless.com>
tismerysoft GmbH             :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9A     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 802 86 56  mobile +49 173 24 18 776  fax +49 30 80 90 57 05
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/




More information about the Pypy-dev mailing list