-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warnings should provide a stacklevel #2106
Labels
Comments
would you create PR? |
@hynek I'm too lazy for pointing exact stack level for deprecation warnings. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Long story short
Warnings have useless frame/position information.
Expected behaviour
Warnings should point to my code so I know what to fix.
Actual behaviour
Warnings point to aiohttp’s lines where the warnings are raised (like
aiohttp/helpers.py:129: DeprecationWarning: ClientSession.close() is a coroutine
) which makes them rather useless. That’s because warnings.warn is called with the default stacklevel value of 1. It’s a rather unknown option but makes the warnings incredibly more useful. :) See also: https://docs.python.org/3/library/warnings.html#warnings.warn for an example.The text was updated successfully, but these errors were encountered: