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

Display DeprecationWarning, PendingDeprecationWarning and ImportWarning in debug mode #76269

Closed
vstinner opened this issue Nov 20, 2017 · 4 comments
Labels
3.7 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@vstinner
Copy link
Member

BPO 32088
Nosy @warsaw, @vstinner, @ambv
PRs
  • bpo-32088: Display Deprecation in debug mode #4474
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2017-11-20.17:48:41.611>
    created_at = <Date 2017-11-20.14:26:42.890>
    labels = ['3.7', 'type-feature', 'library']
    title = 'Display DeprecationWarning, PendingDeprecationWarning and ImportWarning in debug mode'
    updated_at = <Date 2017-11-20.17:48:41.610>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2017-11-20.17:48:41.610>
    actor = 'lukasz.langa'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-11-20.17:48:41.611>
    closer = 'lukasz.langa'
    components = ['Library (Lib)']
    creation = <Date 2017-11-20.14:26:42.890>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32088
    keywords = ['patch']
    message_count = 4.0
    messages = ['306547', '306549', '306571', '306572']
    nosy_count = 3.0
    nosy_names = ['barry', 'vstinner', 'lukasz.langa']
    pr_nums = ['4474']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue32088'
    versions = ['Python 3.7']

    @vstinner
    Copy link
    Member Author

    Related python-dev thread:
    https://mail.python.org/pipermail/python-dev/2017-November/150608.html
    "[Python-Dev] Show DeprecationWarning in debug mode?"

    I propose to display Display DeprecationWarning, PendingDeprecationWarning and ImportWarning when Python is compiled in debug mode.

    Attached PR implements proposed change.

    @vstinner vstinner added 3.7 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Nov 20, 2017
    @vstinner
    Copy link
    Member Author

    Warnings filters in debug mode.

    Reference (current code):

    $ ./python -c 'import warnings, pprint; pprint.pprint(warnings.filters)'
    [('ignore', None, <class 'DeprecationWarning'>, None, 0),
     ('ignore', None, <class 'PendingDeprecationWarning'>, None, 0),
     ('ignore', None, <class 'ImportWarning'>, None, 0),
     ('ignore', None, <class 'BytesWarning'>, None, 0),
     ('always', None, <class 'ResourceWarning'>, None, 0)]

    With my PR 4474:

    $ ./python -c 'import warnings, pprint; pprint.pprint(warnings.filters)'
    [('ignore', None, <class 'BytesWarning'>, None, 0),
     ('always', None, <class 'ResourceWarning'>, None, 0)]

    BytesWarning is not modified by my PR since this specific warning is controlled by the -b option. Example with my PR.

    -b option, ignore => default:

    $ ./python -b -c 'import warnings, pprint; pprint.pprint(warnings.filters)'
    [('default', None, <class 'BytesWarning'>, None, 0),
     ('always', None, <class 'ResourceWarning'>, None, 0)]

    -bb option, ignore => error:

    $ ./python -bb -c 'import warnings, pprint; pprint.pprint(warnings.filters)'
    [('error', None, <class 'BytesWarning'>, None, 0),
     ('always', None, <class 'ResourceWarning'>, None, 0)]

    Note: While writing this comment, I also found a bug in the new developer mode (-X dev): bpo-32089.

    @ambv
    Copy link
    Contributor

    ambv commented Nov 20, 2017

    New changeset 895862a by Łukasz Langa (Victor Stinner) in branch 'master':
    bpo-32088: Display Deprecation in debug mode (bpo-4474)
    895862a

    @ambv
    Copy link
    Contributor

    ambv commented Nov 20, 2017

    Merged. This is an important improvement to make sure 3.7's quality is the best possible.

    Thanks! ✨ 🍰 ✨

    @ambv ambv closed this as completed Nov 20, 2017
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants