###
### This file is part of Trivial IP Encryption (TrIPE).
###
-### TrIPE is free software; you can redistribute it and/or modify
-### it under the terms of the GNU General Public License as published by
-### the Free Software Foundation; either version 2 of the License, or
-### (at your option) any later version.
+### TrIPE is free software: you can redistribute it and/or modify it under
+### the terms of the GNU General Public License as published by the Free
+### Software Foundation; either version 3 of the License, or (at your
+### option) any later version.
###
-### TrIPE is distributed in the hope that it will be useful,
-### but WITHOUT ANY WARRANTY; without even the implied warranty of
-### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-### GNU General Public License for more details.
+### TrIPE is distributed in the hope that it will be useful, but WITHOUT
+### ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+### FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+### for more details.
###
### You should have received a copy of the GNU General Public License
-### along with TrIPE; if not, write to the Free Software Foundation,
-### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+### along with TrIPE. If not, see <https://www.gnu.org/licenses/>.
__pychecker__ = 'self=me'
### External dependencies.
import thread as T
-from sys import exc_info
+from sys import exc_info, excepthook
###--------------------------------------------------------------------------
### What's going on?
global active
_debug('> _switchto(%s, %s, %s)' % (cr, arg, exc))
if not cr.livep:
- raise ValueError, 'coroutine is dead'
+ raise ValueError('coroutine is dead')
cr._arg = arg
cr._exc = exc
if cr is active:
try:
_debug(' _start(%s): call user (args = %s, kwargs = %s)' %
(me, args, kwargs))
- me._func(*args, **kwargs)
+ me._onexit = [me._func(*args, **kwargs), None]
except:
- _switchto(findvictim(me.parent), None, exc_info())
+ exc = exc_info()
+ _debug(' _start(%s): caught exception (%s)' % (me, exc))
+ me._onexit = [None, exc]
finally:
_debug(' _start(%s): finally' % me)
_debug(' _start(%s): _onexit = %s' % (me, me._onexit))