Skip to content

Most warnings calls do not set the stacklevel #10643

Closed

Description

@anntzer

Bug report

Bug summary

Calls to warnings.warn should usually set stacklevel=2 (or higher) so that the source line that gets displayed in the warnings message is the line triggering the code, not the line in mpl that has the warnings call (which is basically redundant with the warnings message itself). Right now most of the calls do not include the stacklevel argument.

Activity

  1. added this to the milestone on Mar 2, 2018
  2. tacaswell commented on Mar 2, 2018

    @tacaswell
    Member

    I am 👍 on adding stacklevel to all of our warnings

  3. added
    🌱 Good first issueOpen a pull request against these issues if there are no active ones!
    on Mar 2, 2018
  4. ImportanceOfBeingErnest commented on May 4, 2018

    @ImportanceOfBeingErnest
    Member

    Interesting. Can the documentation state this as a general advise then? E.g. in logging-level or where else would that fit?

  5. tacaswell commented on May 4, 2018

    @tacaswell
    Member

    re-opening an the issue that closed this only addressed a few warnings.

  6. hsl-code commented on May 9, 2018

    @hsl-code

    I'd like to try to find and address more warnings if that's okay?

  7. anntzer commented on May 9, 2018

    @anntzer
    ContributorAuthor

    go for it!

  8. hsl-code commented on May 10, 2018

    @hsl-code

    Have found some more calls and set stacklevels to 2. There are more though.

  9. modified the milestones: v3.0, v3.1 on Aug 11, 2018
  10. hershen commented on Oct 29, 2018

    @hershen
    Contributor

    This is fixed in #12006. Can this be closed?

  11. jklymak commented on Oct 29, 2018

    @jklymak
    Member

    Thanks a lot @hershen!

  12. hershen commented on Oct 29, 2018

    @hershen
    Contributor

    You're welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🌱 Good first issueOpen a pull request against these issues if there are no active ones!

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions