]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
New 'finally' syntax
authorGuido van Rossum <guido@python.org>
Mon, 14 Dec 1992 15:05:16 +0000 (15:05 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 14 Dec 1992 15:05:16 +0000 (15:05 +0000)
Demo/sgi/al/intercom.py

index d6a13e7fb50360f5f827ec4db4ebb49f77029ca1..fd983d39adfbcd80b4b2eece390b1fdba6b9cccf 100755 (executable)
@@ -181,21 +181,22 @@ def ioloop1(s, otheraddr):
                # Child -- microphone handler
                log('child started')
                try:
-                       mike = al.openport('mike', 'r', config)
-                       # Sleep a while to let the other side get started
-                       time.sleep(1)
-                       # Drain the queue before starting to read
-                       data = mike.readsamps(mike.getfilled())
-                       # Loop, sending packets from the mike to the net
-                       while 1:
-                               data = mike.readsamps(SAMPSPERBUF)
-                               s.sendto(data, otheraddr)
-               except KeyboardInterrupt:
-                       log('child got interrupt; exiting')
-                       posix._exit(0)
-               except error:
-                       log('child got error; exiting')
-                       posix._exit(1)
+                   try:
+                           mike = al.openport('mike', 'r', config)
+                           # Sleep a while to let the other side get started
+                           time.sleep(1)
+                           # Drain the queue before starting to read
+                           data = mike.readsamps(mike.getfilled())
+                           # Loop, sending packets from the mike to the net
+                           while 1:
+                                   data = mike.readsamps(SAMPSPERBUF)
+                                   s.sendto(data, otheraddr)
+                   except KeyboardInterrupt:
+                           log('child got interrupt; exiting')
+                           posix._exit(0)
+                   except error:
+                           log('child got error; exiting')
+                           posix._exit(1)
                finally:
                        log('child got unexpected error; leaving w/ traceback')