[New-bugs-announce] [issue31566] assertion failure in _warnings.warn() in case of a bad __name__ global

Oren Milman report at bugs.python.org
Sun Sep 24 02:53:41 EDT 2017


New submission from Oren Milman:

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.

----------
components: Extension Modules
messages: 302829
nosy: Oren Milman
priority: normal
severity: normal
status: open
title: assertion failure in _warnings.warn() in case of a bad __name__ global
type: crash
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31566>
_______________________________________


More information about the New-bugs-announce mailing list