Skip to content

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented May 14, 2018

Don't crash on warnings.warn_explicit() if module_globals is None.

https://bugs.python.org/issue33509

Don't crash on warnings.warn_explicit() if module_globals is None.
PyObject *source_list;
PyObject *source_line;

if (!PyDict_Check(module_globals)) {
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 move this check into warnings_warn_explicit().

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed


if (!PyDict_Check(module_globals)) {
PyErr_Format(PyExc_TypeError,
"module_globals must be a dict, " "not '%.200s'",
Copy link
Member

Choose a reason for hiding this comment

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

Why " "?

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@serhiy-storchaka
Copy link
Member

Sorry, I don't see you latest changes Victor.

@vstinner
Copy link
Member Author

Sorry, I don't see you latest changes Victor.

Woops. I just forgot to commit my changes... They are now published.

@vstinner vstinner merged commit b056562 into python:master May 15, 2018
@bedevere-bot
Copy link

@vstinner: Please replace # with GH- in the commit message next time. Thanks!

@vstinner vstinner deleted the warn_explicit_None branch May 15, 2018 18:42
@miss-islington
Copy link
Contributor

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 15, 2018
Don't crash on warnings.warn_explicit() if module_globals is not a dict.
(cherry picked from commit b056562)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
@bedevere-bot
Copy link

GH-6870 is a backport of this pull request to the 3.7 branch.

miss-islington added a commit that referenced this pull request May 15, 2018
Don't crash on warnings.warn_explicit() if module_globals is not a dict.
(cherry picked from commit b056562)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants