[issue7330] PyUnicode_FromFormat: implement width and precision for %s, %S, %R, %V, %U, %A

Ray.Allen report at bugs.python.org
Mon Mar 7 15:27:16 CET 2011


Ray.Allen <ysj.ray at gmail.com> added the comment:

I noticed that after apply my last patch and running full unittest cases, some weird errors which I don't know the reasons occurred, for example:

AttributeError: 'dict' object has no attribute 'get'
and
AttributeError: 'Queue' object has no attribute 'get'

I didn't look deep into it. But I found after I optimist my patch, these errors disappeared: I removed the "unicode_format_align()" function in previous patch, directly add needed spaces and copy part of unicode got from parameters according to width and precision formatters in step 4(using Py_UNICODE_FILL() and Py_UNICODE_COPY()) . This avoid create temporary unicode objects using unicode_format_align() in step 3. And also the patch becomes simpler.

So this patch is intended to replace of the previous. And if I have more time, I will try to find the reasons of the weird errors.

----------
Added file: http://bugs.python.org/file21032/issue7330_3.diff

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


More information about the Python-bugs-list mailing list