Message191437
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. |
|
Date |
User |
Action |
Args |
2013-06-18 22:19:57 | vstinner | set | recipients:
+ vstinner, ezio.melotti, serhiy.storchaka |
2013-06-18 22:19:57 | vstinner | set | messageid: <1371593997.85.0.878682208795.issue18184@psf.upfronthosting.co.za> |
2013-06-18 22:19:57 | vstinner | link | issue18184 messages |
2013-06-18 22:19:57 | vstinner | create | |
|