Skip to content

Commit

Permalink
Fix _countdown_handler not invoking timeout_change; Fix value is valu…
Browse files Browse the repository at this point in the history
…e < 0 (#2287)
  • Loading branch information
TanixLu authored Oct 29, 2023
1 parent 045b8c2 commit 3ff37a8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pwnlib/timeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ def __enter__(self):
self.obj._stop = min(self.obj._stop, self.old_stop)

self.obj._timeout = self.timeout
self.obj.timeout_change()
def __exit__(self, *a):
self.obj._timeout = self.old_timeout
self.obj._stop = self.old_stop
self.obj.timeout_change()

class _local_handler(object):
def __init__(self, obj, timeout):
Expand Down Expand Up @@ -157,7 +159,7 @@ def _get_timeout_seconds(self, value):
else:
value = float(value)

if value is value < 0:
if value < 0:
raise AttributeError("timeout: Timeout cannot be negative")

if value > self.maximum:
Expand Down

0 comments on commit 3ff37a8

Please sign in to comment.