Skip to content

bpo-31411: Prevent raising a SystemError in case warnings.onceregistry is not a dictionary#3485

Merged
serhiy-storchaka merged 5 commits into
python:masterfrom
orenmn:bpo31411-fix-SystemError
Sep 11, 2017
Merged

bpo-31411: Prevent raising a SystemError in case warnings.onceregistry is not a dictionary#3485
serhiy-storchaka merged 5 commits into
python:masterfrom
orenmn:bpo31411-fix-SystemError

Conversation

@orenmn

@orenmn orenmn commented Sep 10, 2017

Copy link
Copy Markdown
Contributor
  • in _warnings.c: add a check whether warnings.onceregistry is not a dictionary. while we are here, fix a related inaccurate error message.
  • in test_warnings/__init__.py: add a test to verify that the SystemError is no more.

https://bugs.python.org/issue31411

Comment thread Python/_warnings.c Outdated
registry = get_once_registry();
if (registry == NULL)
goto cleanup;
if (!PyDict_Check(registry)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add this check in get_once_registry().

@serhiy-storchaka

Copy link
Copy Markdown
Member

Thank you for your PR @orenmn.

Do you mind to add a NEWS.d entry?

@serhiy-storchaka serhiy-storchaka merged commit 252033d into python:master Sep 11, 2017
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @orenmn for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 2.7, 3.6.
🐍🍒⛏🤖

@miss-islington

Copy link
Copy Markdown
Contributor

Sorry, @orenmn and @serhiy-storchaka, I could not cleanly backport this to 2.7 due to a conflict.
Please backport using cherry_picker on command line.

serhiy-storchaka pushed a commit to serhiy-storchaka/cpython that referenced this pull request Sep 11, 2017
…egistry is not a dictionary. (pythonGH-3485).

(cherry picked from commit 252033d)
@bedevere-bot

Copy link
Copy Markdown

GH-3493 is a backport of this pull request to the 2.7 branch.

serhiy-storchaka pushed a commit to serhiy-storchaka/cpython that referenced this pull request Sep 11, 2017
…egistry is not a dictionary. (pythonGH-3485).

(cherry picked from commit 252033d)
@bedevere-bot

Copy link
Copy Markdown

GH-3494 is a backport of this pull request to the 3.6 branch.

serhiy-storchaka added a commit that referenced this pull request Sep 11, 2017
…egistry is not a dictionary. (GH-3485). (#3493)

(cherry picked from commit 252033d)
serhiy-storchaka added a commit that referenced this pull request Sep 11, 2017
…egistry is not a dictionary. (GH-3485). (#3494)

(cherry picked from commit 252033d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants