diff options
| author | Rapptz <[email protected]> | 2017-03-26 18:43:57 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-03-26 18:43:57 -0400 |
| commit | cac84e517bb7c3a41969d37bf5eafc141277c120 (patch) | |
| tree | 823d433de4cb1103ee77573dd924c64aa2f95bb9 | |
| parent | Remove unnecessary shielding. (diff) | |
| download | discord.py-cac84e517bb7c3a41969d37bf5eafc141277c120.tar.xz discord.py-cac84e517bb7c3a41969d37bf5eafc141277c120.zip | |
Always overwrite Emoji references in the state.
There is potential that when recreating the Emoji list in the
GUILD_EMOJIS_UPDATE event would just fetch from cache and the element
in cache having an out of date Guild reference. This Guild reference
will be kept alive for longer than it should be.
By always overwriting the Emoji reference, this problem goes away.
| -rw-r--r-- | discord/state.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/discord/state.py b/discord/state.py index 497fa130..72a4f01a 100644 --- a/discord/state.py +++ b/discord/state.py @@ -141,11 +141,8 @@ class ConnectionState: def store_emoji(self, guild, data): emoji_id = int(data['id']) - try: - return self._emojis[emoji_id] - except KeyError: - self._emojis[emoji_id] = emoji = Emoji(guild=guild, state=self, data=data) - return emoji + self._emojis[emoji_id] = emoji = Emoji(guild=guild, state=self, data=data) + return emoji @property def guilds(self): |