Change locking boundaries for shared dict. Add a unit test.
[python_utils.git] / smart_future.py
index c96c5a712d9f8d829eb73a21082f2ffbc0f41d48..2f3cbd9a9949f681e8a7cc70bd35ca43626e2861 100644 (file)
@@ -40,8 +40,11 @@ def wait_any(
             if log_exceptions and not f.cancelled():
                 exception = f.exception()
                 if exception is not None:
+                    logger.warning(
+                        f'Future {id(f)} raised an unhandled exception and exited.'
+                    )
                     logger.exception(exception)
-                    traceback.print_tb(exception.__traceback__)
+                    raise exception
             yield smart_future_by_real_future[f]
     if callback is not None:
         callback()
@@ -62,8 +65,11 @@ def wait_all(
             if not f.cancelled():
                 exception = f.exception()
                 if exception is not None:
+                    logger.warning(
+                        f'Future {id(f)} raised an unhandled exception and exited.'
+                    )
                     logger.exception(exception)
-                    traceback.print_tb(exception.__traceback__)
+                    raise exception
     assert len(done) == len(real_futures)
     assert len(not_done) == 0