Skip to content
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

Closed
hynek opened this issue Jul 17, 2017 · 3 comments · Fixed by #2125
Closed

Warnings should provide a stacklevel #2106

hynek opened this issue Jul 17, 2017 · 3 comments · Fixed by #2125
Labels

Comments

@hynek
Copy link
Contributor

hynek commented Jul 17, 2017

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.

@fafhrd91
Copy link
Member

would you create PR?

@asvetlov
Copy link
Member

@hynek I'm too lazy for pointing exact stack level for deprecation warnings.
Feel free to point on other places where the level is not correct.

@lock
Copy link

lock bot commented Oct 28, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants