[New-bugs-announce] [issue31592] assertion failure in Python/ast.c in case of a bad unicodedata.normalize()

Oren Milman report at bugs.python.org
Tue Sep 26 08:54:08 EDT 2017


New submission from Oren Milman:

The following code causes an assertion failure:

import unicodedata
def bad_normalize(*args):
    return None

unicodedata.normalize = bad_normalize
import ast
ast.parse('\u03D5')


This is because init_normalization() (in Python/ast.c) assumes that
unicodedata.normalize() is valid, and stores it in the compiling struct.
Later, new_identifier() calls the stored function, assumes it returned a
string, and passes it to PyUnicode_InternInPlace(), which asserts it is a
string.

----------
components: Interpreter Core
messages: 303036
nosy: Oren Milman
priority: normal
severity: normal
status: open
title: assertion failure in Python/ast.c in case of a bad unicodedata.normalize()
type: crash
versions: Python 3.7

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


More information about the New-bugs-announce mailing list