Author vstinner
Recipients ezio.melotti, serhiy.storchaka, vstinner
Date 2013-06-18.22:19:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1371593997.85.0.878682208795.issue18184@psf.upfronthosting.co.za>
In-reply-to
Content
Both patches look good to me. Do you feel motivated to check if all formating methods have a test? Here is a list of format methods:

PyUnicode_Format():
- 3.3, 3.4: formatchar() raises OverflowError if x > MAX_UNICODE
- 2.7: formatchar() raises OverflowError if x > 0x10ffff (or x > 0xffff, in narrow mode)

PyUnicode_FromFromatV():
- 2.7: no check, *s++ = va_arg(vargs, int); => BUG
- 3.3: indirect check, maxchar = Py_MAX(maxchar, ordinal); and then PyUnicode_New(n, maxchar); should fail => (ok)
- 3.4: raise ValueError if ordinal > MAX_UNICODE => OK

int.__format__('c'):
- 3.3, 3.4: format_long_internal() raises OverflowError if x > 0x10ffff => OK
- 2.7: format_int_or_long_internal() raises OverflowError if x > 0x10ffff (or x > 0xffff in narrow mode) => OK

IMO a ValueError would be better than OverflowError, it's not really an overflow (limitation of the C language, or a C type). It is maybe too late to change this.
History
Date User Action Args
2013-06-18 22:19:57vstinnersetrecipients: + vstinner, ezio.melotti, serhiy.storchaka
2013-06-18 22:19:57vstinnersetmessageid: <1371593997.85.0.878682208795.issue18184@psf.upfronthosting.co.za>
2013-06-18 22:19:57vstinnerlinkissue18184 messages
2013-06-18 22:19:57vstinnercreate