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 alexandre.vassalotti
Recipients alexandre.vassalotti
Date 2009-12-30.23:16:53
SpamBayes Score 0.00011874939
Marked as misclassified No
Message-id <1262215014.59.0.531536027959.issue7608@psf.upfronthosting.co.za>
In-reply-to
Content
It seems PyUnicode_FromFormatV wrongly assumes that the return value of
PyObject_Str and PyObject_Repr is a unicode object. It looks like  the
%S and %R feature was backported from 3.x without updating the code for 2.x.


PyObject *
PyUnicode_FromFormatV(const char *format, va_list vargs)
{
...
            case 'S':
            {
                PyObject *obj = va_arg(count, PyObject *);
                PyObject *str;
                assert(obj);
                str = PyObject_Str(obj);
                if (!str)
                    goto fail;
                n += PyUnicode_GET_SIZE(str);
                /* Remember the str and switch to the next slot */
                *callresult++ = str;
                break;
            }
            case 'R':
            {
                PyObject *obj = va_arg(count, PyObject *);
                PyObject *repr;
                assert(obj);
                repr = PyObject_Repr(obj);
                if (!repr)
                    goto fail;
                n += PyUnicode_GET_SIZE(repr);
                /* Remember the repr and switch to the next slot */
                *callresult++ = repr;
                break;
            }
...
}
History
Date User Action Args
2009-12-30 23:16:54alexandre.vassalottisetrecipients: + alexandre.vassalotti
2009-12-30 23:16:54alexandre.vassalottisetmessageid: <1262215014.59.0.531536027959.issue7608@psf.upfronthosting.co.za>
2009-12-30 23:16:53alexandre.vassalottilinkissue7608 messages
2009-12-30 23:16:53alexandre.vassalotticreate