Message1511
Darn, I noticed one more scenario that needs to be taken care. The patch mentioned in the previous comment doesn't fix this.
>>> '%(x)s' % { 'x' : u'xxx' }
'xxx'
This got me thinking that this issue probably ought to be fixed in StringFormatter.format instead of PyString.str___mod__ (as in the current patch). SF.format could keep count on given format items and return PyString or PyUnicode as needed. That would of course require SF.format's return type to be changed from String to PyString. Probably at the same time it would make sense to change SF.formatXXX methods (formaLong, formatInteger, ...) from public to private to make it more clear that they are only helper methods of SF.format (at least they seem to be) and can thus still return String. These changes seem pretty safe because I could find StringFormatter used elsewhere than in PyString.str___mod__ and the only method it uses is SF.format.
Comments about the implementation ideas above are welcome. If the approach seems reasonable I can make a new patch. |
|
| Date |
User |
Action |
Args |
| 2008-02-20 17:17:45 | admin | link | issue1671134 messages |
| 2008-02-20 17:17:45 | admin | create | |
|