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.

python: Catch BaseException when we need to clean something up.

Anders Kaseorgb7a94be152dc
diff --git a/scripts/lib/zulip_tools.py b/scripts/lib/zulip_tools.py
index 743cfe0d475..45d5ba2b313 100755
--- a/scripts/lib/zulip_tools.py
+++ b/scripts/lib/zulip_tools.py
@@ -53,7 +53,7 @@ def overwrite_symlink(src: str, dst: str) -> None:
break
try:
os.rename(tmp, dst)
- except Exception:
+ except BaseException:
os.remove(tmp)
raise
diff --git a/zerver/lib/queue.py b/zerver/lib/queue.py
index 87c454c402d..13890adb466 100644
--- a/zerver/lib/queue.py
+++ b/zerver/lib/queue.py
@@ -167,7 +167,7 @@ class SimpleQueueClient:
try:
callback(events)
channel.basic_ack(max_processed, multiple=True)
- except Exception:
+ except BaseException:
channel.basic_nack(max_processed, multiple=True)
raise
events = []
diff --git a/zerver/management/commands/export_usermessage_batch.py b/zerver/management/commands/export_usermessage_batch.py
index cb5ce69bd99..0e07f2804df 100644
--- a/zerver/management/commands/export_usermessage_batch.py
+++ b/zerver/management/commands/export_usermessage_batch.py
@@ -35,7 +35,7 @@ class Command(BaseCommand):
logging.info("Thread %s processing %s", options['thread'], output_path)
try:
export_usermessages_batch(locked_path, output_path, options["consent_message_id"])
- except Exception:
+ except BaseException:
# Put the item back in the free pool when we fail
os.rename(locked_path, partial_path)
raise