From 247e6a3c7b93a27a49f851bf0740016ad4f4fb3f Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Thu, 2 Mar 2023 22:31:58 +0000 Subject: Explicitly set the stack level of the warnings.warn call The warn method from the warnings module uses a stacklevel of 1 by default. This will only show a stack trace for the line on which the warn method is called. It is therefore recommended to use a stacklevel of 2 or greater to provide more information to the user. --- pydis_core/_bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydis_core/_bot.py b/pydis_core/_bot.py index 09ab2a63..0d0682f7 100644 --- a/pydis_core/_bot.py +++ b/pydis_core/_bot.py @@ -73,7 +73,7 @@ class BotBase(commands.Bot): self.statsd_url = statsd_url if redis_session and not REDIS_AVAILABLE: - warnings.warn("redis_session kwarg passed, but async-rediscache not installed!") + warnings.warn("redis_session kwarg passed, but async-rediscache not installed!", stacklevel=2) elif redis_session: self.redis_session = redis_session -- cgit v1.2.3