Repository: qpid-proton
Updated Branches:
  refs/heads/master df2cd6c0c -> 65aa64c0e


fixed exception handling for events occuring during reactor shutdown


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/65aa64c0
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/65aa64c0
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/65aa64c0

Branch: refs/heads/master
Commit: 65aa64c0e3ce88e119b0a4bf416fc2b924cf5bfb
Parents: df2cd6c
Author: Rafael Schloming <[email protected]>
Authored: Fri Mar 27 09:45:25 2015 -0400
Committer: Rafael Schloming <[email protected]>
Committed: Fri Mar 27 09:45:25 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/python/proton/reactor.py |  8 ++++++--
 tests/python/proton_tests/reactor.py       | 13 +++++++++++++
 2 files changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/65aa64c0/proton-c/bindings/python/proton/reactor.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/proton/reactor.py 
b/proton-c/bindings/python/proton/reactor.py
index f95bd16..dcd2507 100644
--- a/proton-c/bindings/python/proton/reactor.py
+++ b/proton-c/bindings/python/proton/reactor.py
@@ -131,17 +131,21 @@ class Reactor(Wrapper):
     def quiesced(self):
         return pn_reactor_quiesced(self._impl)
 
-    def process(self):
-        result = pn_reactor_process(self._impl)
+    def _check_errors(self):
         if self.errors:
             for exc, value, tb in self.errors[:-1]:
                 traceback.print_exception(exc, value, tb)
             exc, value, tb = self.errors[-1]
             raise exc, value, tb
+
+    def process(self):
+        result = pn_reactor_process(self._impl)
+        self._check_errors()
         return result
 
     def stop(self):
         pn_reactor_stop(self._impl)
+        self._check_errors()
 
     def schedule(self, delay, task):
         impl = _chandler(task, self.on_error)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/65aa64c0/tests/python/proton_tests/reactor.py
----------------------------------------------------------------------
diff --git a/tests/python/proton_tests/reactor.py 
b/tests/python/proton_tests/reactor.py
index 4bf3cdf..4e660a5 100644
--- a/tests/python/proton_tests/reactor.py
+++ b/tests/python/proton_tests/reactor.py
@@ -42,11 +42,24 @@ class BarfOnTask:
     def on_timer_task(self, event):
         raise Barf()
 
+class BarfOnFinal:
+
+    def on_reactor_final(self, event):
+        raise Barf()
+
 class ExceptionTest(Test):
 
     def setup(self):
         self.reactor = Reactor()
 
+    def test_reactor_final(self):
+        self.reactor.global_handler = BarfOnFinal()
+        try:
+            self.reactor.run()
+            assert False, "expected to barf"
+        except Barf:
+            pass
+
     def test_global_set(self):
         self.reactor.global_handler = BarfOnInit()
         try:


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to