Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

timeout: Remove cargo-culted and impossible-to-reach code block.

Alex Vandiver85eeaf5f18c0
diff --git a/zerver/lib/timeout.py b/zerver/lib/timeout.py
index 180d9fc7830..ad642ff938f 100644
--- a/zerver/lib/timeout.py
+++ b/zerver/lib/timeout.py
@@ -59,17 +59,9 @@ def timeout(timeout: float, func: Callable[[], ResultT]) -> ResultT:
# Attempt to raise a TimeoutExpired in the thread represented by 'self'.
assert self.ident is not None # Thread should be running; c_long expects int
tid = ctypes.c_long(self.ident)
- result = ctypes.pythonapi.PyThreadState_SetAsyncExc(
+ ctypes.pythonapi.PyThreadState_SetAsyncExc(
tid, ctypes.py_object(TimeoutExpired)
)
- if result > 1:
- # "if it returns a number greater than one, you're in trouble,
- # and you should call it again with exc=NULL to revert the effect"
- #
- # I was unable to find the actual source of this quote, but it
- # appears in the many projects across the Internet that have
- # copy-pasted this recipe.
- ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, None)
thread = TimeoutThread()
thread.start()