New submission from STINNER Victor <vstin...@redhat.com>:
The PEP 399 requires that C accelerator behaves exactly as Python, but a lot of C code truncates type name to an arbitrary length: 80, 100, 200, up to 500 (not sure if it's a number of bytes or characters). Py_TYPE(obj)->tp_name is a common pattern: it would be nice to have a new "%T" format in PyUnicode_FromFormat(), so it can be used directly in PyErr_Format(), to format an object type name. Attached PR implements the proposed %T format and modify unicodeobject.c to use it. I propose to then write a second PR to modify all C code of CPython using Py_TYPE(obj)->tp_name to use the new %T type. ---------- components: Interpreter Core messages: 324675 nosy: vstinner priority: normal severity: normal status: open title: PyUnicode_FromFormat(): add %T format for an object type name versions: Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34595> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com