chiark / gitweb /
server/admin.c: Remove spurious `ping' in usage message.
[tripe] / py / rmcr.py
index 61521b4d66c641863b73c29ddab4e50863c1400d..6c846cb8417ee65fe5f6f9f73d285ba81ddc223f 100644 (file)
@@ -9,19 +9,18 @@
 ###
 ### 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'
 
@@ -29,7 +28,7 @@ __pychecker__ = 'self=me'
 ### External dependencies.
 
 import thread as T
-from sys import exc_info
+from sys import exc_info, excepthook
 
 ###--------------------------------------------------------------------------
 ### What's going on?
@@ -51,7 +50,7 @@ def _switchto(cr, arg = None, exc = None):
   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:
@@ -134,9 +133,11 @@ class Coroutine (object):
       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))