[New-bugs-announce] [issue19984] Add new format of fix length string for PyErr_Format

Vajrasky Kok report at bugs.python.org
Sun Dec 15 06:23:22 CET 2013


New submission from Vajrasky Kok:

This ticket sprung from this discussion:
https://mail.python.org/pipermail/python-dev/2013-December/130756.html

Basically I am always confused when writing error message in C-API.

Is it:

PyErr_Format(PyExc_TypeError,"can't intern %.400s", s->ob_type->tp_name);

or

PyErr_Format(PyExc_TypeError,"can't intern %.80s", s->ob_type->tp_name);

or

PyErr_Format(PyExc_TypeError,"can't intern %s", s->ob_type->tp_name);

In conclusion, is it %s or %.80s or %.400s?

This patch will add one true way of writing fixed length string of the wrong type. This is just preliminary patch. I'll write the documentation later (and maybe test?).

----------
components: Interpreter Core
files: add_T_format_for_PyErr_Format.patch
keywords: patch
messages: 206216
nosy: vajrasky
priority: normal
severity: normal
status: open
title: Add new format of fix length string for PyErr_Format
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file33141/add_T_format_for_PyErr_Format.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19984>
_______________________________________


More information about the New-bugs-announce mailing list