This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: assertion failure in _warnings.warn() in case of a bad __name__ global
Type: crash Stage: resolved
Components: Extension Modules Versions: Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Oren Milman, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2017-09-24 06:53 by Oren Milman, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 3717 merged Oren Milman, 2017-09-24 08:27
PR 3730 merged python-dev, 2017-09-24 18:28
Messages (3)
msg302829 - (view) Author: Oren Milman (Oren Milman) * Date: 2017-09-24 06:53
The following code causes an assertion failure:
__name__ = b'foo'
__file__ = None
import _warnings
_warnings.warn('bar')

This is because setup_context() (in Python/_warnings.c) assumes that __name__
is a string, and so it passes it to _PyUnicode_EqualToASCIIString(), which
asserts it is a string.
msg302877 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-09-24 18:28
New changeset 5d3e80021ab33360191eb0fbff34e0246c913884 by Serhiy Storchaka (Oren Milman) in branch 'master':
bpo-31566: Fix an assertion failure in _warnings.warn() in case of a bad __name__ global. (#3717)
https://github.com/python/cpython/commit/5d3e80021ab33360191eb0fbff34e0246c913884
msg302885 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-09-24 20:14
New changeset 415cc1fa57710614ed3384d0cafc58ccf7adee8c by Serhiy Storchaka (Miss Islington (bot)) in branch '3.6':
[3.6] bpo-31566: Fix an assertion failure in _warnings.warn() in case of a bad __name__ global. (GH-3717) (#3730)
https://github.com/python/cpython/commit/415cc1fa57710614ed3384d0cafc58ccf7adee8c
History
Date User Action Args
2022-04-11 14:58:52adminsetgithub: 75747
2017-09-27 05:01:23serhiy.storchakasetstatus: open -> closed
stage: patch review -> resolved
resolution: fixed
versions: + Python 3.6
2017-09-24 20:14:43serhiy.storchakasetmessages: + msg302885
2017-09-24 18:28:52python-devsetpull_requests: + pull_request3716
2017-09-24 18:28:44serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg302877
2017-09-24 08:27:44Oren Milmansetkeywords: + patch
stage: patch review
pull_requests: + pull_request3701
2017-09-24 06:53:40Oren Milmancreate