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.

Author vstinner
Recipients vstinner
Date 2018-09-06.09:13:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1536225210.1.0.56676864532.issue34595@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-09-06 09:13:30vstinnersetrecipients: + vstinner
2018-09-06 09:13:30vstinnersetmessageid: <1536225210.1.0.56676864532.issue34595@psf.upfronthosting.co.za>
2018-09-06 09:13:30vstinnerlinkissue34595 messages
2018-09-06 09:13:29vstinnercreate