[issue7574] PyUnicode_FromFormat broken and not documented for 2.x

Ronald Oussoren report at bugs.python.org
Thu Dec 24 12:54:41 CET 2009


New submission from Ronald Oussoren <ronaldoussoren at mac.com>:

Include/unicodeobject.h includes prototypes for PyUnicode_FromFormat and 
PyUnicode_FromFormatV in both 2.6 and 2.7, but those functions are not 
included in the documention.

And worse, the implementation contains bugs: the %R format code tries to 
include the repr() of an object and blindly assumes that the result of 
PyObject_Repr is a unicode string. In the 2.x tree PyObject_Repr usually 
(but not allways) returns a regular string (str instead of unicode).

The same problem is present in the implementation of %S.

For the %U and %V formats the code does typechecking in an assert 
statement rather than always testing and bailing out using a NULL result 
from the function.

----------
assignee: georg.brandl
components: Documentation, Interpreter Core
messages: 96853
nosy: georg.brandl, ronaldoussoren
severity: normal
stage: needs patch
status: open
title: PyUnicode_FromFormat broken and not documented for 2.x
type: crash
versions: Python 2.6, Python 2.7

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


More information about the Python-bugs-list mailing list