zhechen-cs opened a new issue, #2198:
URL: https://github.com/apache/libcloud/issues/2198

   ## Summary
   
   `MinimalRetry(timeout=0)` and `Retry(timeout=0)` never call the wrapped 
function and raise `TypeError: exceptions must derive from BaseException`. 
Negative timeouts, which the constructor clamps to zero, have the same behavior.
   
   ## Reproducer
   
   On current `trunk` (`bd9cbb3e393bc42f57684481e7c62e9293007584`), Python 3.12:
   
   ```python
   from unittest.mock import Mock
   from libcloud.utils.retry import Retry
   
   request = Mock(return_value="success")
   Retry(timeout=0)(request)()
   # TypeError: exceptions must derive from BaseException
   # request.call_count == 0
   ```
   
   The initial request should still run when there is no time available for 
retries: return its result, or propagate its original exception without 
sleeping. A positive-timeout control returns `"success"` as expected.
   
   The loop checks the deadline before its first attempt and subsequently 
executes `raise last_exc` while `last_exc` is still `None`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to