Skip to content

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

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

Merged
merged 5 commits into from
Sep 11, 2017

Conversation

orenmn
Copy link
Contributor

@orenmn orenmn commented Sep 10, 2017

  • 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

@@ -514,6 +514,11 @@ warn_explicit(PyObject *category, PyObject *message,
registry = get_once_registry();
if (registry == NULL)
goto cleanup;
if (!PyDict_Check(registry)) {
Copy link
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
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
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
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

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

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