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

SystemError raised by warn_explicit() in case warnings.onceregistry is not a dict #75592

Closed
orenmn mannequin opened this issue Sep 10, 2017 · 4 comments
Closed

SystemError raised by warn_explicit() in case warnings.onceregistry is not a dict #75592

orenmn mannequin opened this issue Sep 10, 2017 · 4 comments
Labels
3.7 (EOL) end of life extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error

Comments

@orenmn
Copy link
Mannequin

orenmn mannequin commented Sep 10, 2017

BPO 31411
Nosy @serhiy-storchaka, @orenmn
PRs
  • bpo-31411: Prevent raising a SystemError in case warnings.onceregistry is not a dictionary #3485
  • [2.7] bpo-31411: Prevent raising a SystemError in case warnings.oncer… #3493
  • [3.6] bpo-31411: Prevent raising a SystemError in case warnings.oncer… #3494
  • 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-09-11.07:07:50.728>
    created_at = <Date 2017-09-10.17:37:43.544>
    labels = ['extension-modules', 'type-bug', '3.7']
    title = 'SystemError raised by warn_explicit() in case warnings.onceregistry is not a dict'
    updated_at = <Date 2017-09-11.07:07:50.727>
    user = 'https://github.com/orenmn'

    bugs.python.org fields:

    activity = <Date 2017-09-11.07:07:50.727>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-09-11.07:07:50.728>
    closer = 'serhiy.storchaka'
    components = ['Extension Modules']
    creation = <Date 2017-09-10.17:37:43.544>
    creator = 'Oren Milman'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31411
    keywords = ['patch']
    message_count = 4.0
    messages = ['301822', '301862', '301865', '301866']
    nosy_count = 2.0
    nosy_names = ['serhiy.storchaka', 'Oren Milman']
    pr_nums = ['3485', '3493', '3494']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue31411'
    versions = ['Python 3.7']

    @orenmn
    Copy link
    Mannequin Author

    orenmn mannequin commented Sep 10, 2017

    The following code causes warn_explicit() (in Python/_warnings.c) to raise a
    SystemError:

    import warnings
    warnings.filterwarnings('once')
    warnings.onceregistry = None
    warnings.warn_explicit(message='foo', category=Warning, filename='bar',
                           lineno=1, registry=None)

    this is because warn_explicit() assumes that warnings.onceregistry is a dict,
    and passes it to update_registry(), which passes it to already_warned(), which
    eventually passes it to _PyDict_SetItemId(), which raises the SystemError.

    @orenmn orenmn mannequin added 3.7 (EOL) end of life extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error labels Sep 10, 2017
    @serhiy-storchaka
    Copy link
    Member

    New changeset 252033d by Serhiy Storchaka (Oren Milman) in branch 'master':
    bpo-31411: Prevent raising a SystemError in case warnings.onceregistry is not a dictionary. (bpo-3485)
    252033d

    @serhiy-storchaka
    Copy link
    Member

    New changeset 004547f by Serhiy Storchaka in branch '2.7':
    [2.7] bpo-31411: Prevent raising a SystemError in case warnings.onceregistry is not a dictionary. (GH-3485). (bpo-3493)
    004547f

    @serhiy-storchaka
    Copy link
    Member

    New changeset 7972ed2 by Serhiy Storchaka in branch '3.6':
    [3.6] bpo-31411: Prevent raising a SystemError in case warnings.onceregistry is not a dictionary. (GH-3485). (bpo-3494)
    7972ed2

    @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 extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant