Skip to content

Display DeprecationWarning, PendingDeprecationWarning and ImportWarning in debug mode #76269

Closed

Description

@vstinner
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']

    Activity

    1. vstinner commented on Nov 20, 2017

      @vstinner
      MemberAuthor

      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.

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-featureA feature request or enhancement
      on Nov 20, 2017
    3. vstinner commented on Nov 20, 2017

      @vstinner
      MemberAuthor

      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.

    4. ambv commented on Nov 20, 2017

      @ambv
      Contributor

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

    5. ambv commented on Nov 20, 2017

      @ambv
      Contributor

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

      Thanks! ✨ 🍰 ✨

    6. transferred this issue fromon Apr 10, 2022
    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

      3.7 (EOL)end of lifestdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions