Skip to content

Commit 5185df7

Browse files
committed
Remove 'return' statements from 'finally' clauses
They are deprecated on py3.14, and the one in schedule.py was actually a bug as it silenced exceptions raised by recurring scheduled functions.
1 parent 9b6d1e2 commit 5185df7

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

plugins/Owner/plugin.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,7 @@ def __call__(self, irc, msg):
156156
ircquote_response["irc"].reply(str(msg).strip())
157157
except Exception as e:
158158
self.log.exception("Errored while sending ircquote response")
159-
finally:
160-
return ret
159+
return ret
161160

162161
def outFilter(self, irc, msg):
163162
if msg.command == 'PRIVMSG' and not world.testing:

src/schedule.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import heapq
4040
import functools
4141
from threading import Lock
42+
import traceback
4243

4344
from . import drivers, log, world
4445

@@ -117,12 +118,13 @@ def wrapper():
117118
nonlocal count
118119
try:
119120
f(*args, **kwargs)
120-
finally:
121+
except Exception:
122+
traceback.print_exc()
121123
# Even if it raises an exception, let's schedule it.
122-
if count is not None:
123-
count -= 1
124-
if count is None or count > 0:
125-
return self.addEvent(wrapper, time.time() + t, name)
124+
if count is not None:
125+
count -= 1
126+
if count is None or count > 0:
127+
return self.addEvent(wrapper, time.time() + t, name)
126128
return wrapper
127129

128130
def addPeriodicEvent(

0 commit comments

Comments
 (0)