Crash in UnicodeError.__str__
with attributes have custom __str__
#128974
Labels
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
topic-unicode
type-crash
A hard crash of the interpreter, possibly with a core dump
Crash report
What happened?
results in
Segmentation fault (core dumped)
. Another possibility for a crash:results in
The segmentation fault is quite easy to fix:
It occurs in
PyUnicode_GET_LENGTH(exc->object);
. And the reason is thatPyObject_Str(...)
may call artrbitary code.I have a PR ready that I will post soon.
See #128975 (comment) for the rationale of not backporting it.
CPython versions tested on:
CPython main branch
Linked PRs
UnicodeError.__str__
when custom attributes have side-effects #128975The text was updated successfully, but these errors were encountered: