aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-05-31 23:22:53 -0400
committerRapptz <[email protected]>2016-05-31 23:22:53 -0400
commit20e86973ea03229225739579e5b650a9517f206f (patch)
tree75cd15ee787d1f336156b7c7535bef6fe72e6162
parentFix discord.Object documentation. (diff)
downloaddiscord.py-20e86973ea03229225739579e5b650a9517f206f.tar.xz
discord.py-20e86973ea03229225739579e5b650a9517f206f.zip
[commands] Delete frame objects when done using them.
-rw-r--r--discord/ext/commands/bot.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py
index 0a18698e..768e7cc1 100644
--- a/discord/ext/commands/bot.py
+++ b/discord/ext/commands/bot.py
@@ -40,9 +40,13 @@ def _get_variable(name):
stack = inspect.stack()
try:
for frames in stack:
- current_locals = frames[0].f_locals
- if name in current_locals:
- return current_locals[name]
+ try:
+ frame = frames[0]
+ current_locals = frame.f_locals
+ if name in current_locals:
+ return current_locals[name]
+ finally:
+ del frame
finally:
del stack