[issue15952] format(value) and value.__format__() behave differently with unicode format

2020-05-31 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> out of date stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue15952] format(value) and value.__format__() behave differently with unicode format

2012-09-23 Thread Ezio Melotti
Ezio Melotti added the comment: ``format(value, format_spec)`` merely calls - ``value.__format__(format_spec)``. + ``value.__format__(format_spec)`` and, if *format_spec* is Unicode, + converts the value to Unicode if it is not already Unicode. This is correct, but should be

[issue15952] format(value) and value.__format__() behave differently with unicode format

2012-09-22 Thread Chris Jerdonek
Changes by Chris Jerdonek chris.jerdo...@gmail.com: -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15952 ___ ___

[issue15952] format(value) and value.__format__() behave differently with unicode format

2012-09-18 Thread Chris Jerdonek
Chris Jerdonek added the comment: Here is a proposed patch. One note on the patch. I feel the second sentence of the note is worth adding because value.__format__() departs from what PEP 3101 says: Note for Python 2.x: The 'format_spec' argument will be either a string object or a unicode

[issue15952] format(value) and value.__format__() behave differently with unicode format

2012-09-18 Thread Chris Jerdonek
Chris Jerdonek added the comment: To clarify, one of the sentences above should have read, I feel the second sentence of the note *in the patch* was worth adding... (not the second sentence of the PEP note I quoted). -- ___ Python tracker

[issue15952] format(value) and value.__format__() behave differently with unicode format

2012-09-17 Thread Chris Jerdonek
Chris Jerdonek added the comment: See this code comment: /* don't define FORMAT_LONG, FORMAT_FLOAT, and FORMAT_COMPLEX, since we can live with only the string versions of those. The builtin format() will convert them to unicode. */ from

[issue15952] format(value) and value.__format__() behave differently with unicode format

2012-09-17 Thread Eric V. Smith
Eric V. Smith added the comment: I believe the conversion is happening in Objects/abstract.c in PyObject_Format, around line 864, near this comment: /* Convert to unicode, if needed. Required if spec is unicode and result is str */ I think changing the docs will result in more

[issue15952] format(value) and value.__format__() behave differently with unicode format

2012-09-16 Thread Chris Jerdonek
New submission from Chris Jerdonek: format(value) and value.__format__() behave differently even though the documentation says otherwise: Note: format(value, format_spec) merely calls value.__format__(format_spec). (from http://docs.python.org/library/functions.html?#format ) The difference

[issue15952] format(value) and value.__format__() behave differently with unicode format

2012-09-16 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15952 ___