Bugs item #1412580, was opened at 2006-01-23 07:46 Message generated for change (Comment added) made by gbrandl You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1412580&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.4 >Status: Closed >Resolution: Out of Date Priority: 5 Submitted By: Tim Diggins (tdiggins) Assigned to: Nobody/Anonymous (nobody) Summary: locale.format gives wrong exception on some erroneous input Initial Comment: using '2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)]' on WinXpPro SP2 locale.format(formatString, val, grouping) when passed a formatString of the wrong type, ought to raise a TypeError (as some erroneous input does) Example: locale.format(2.3, 2.3) passes through AttributeError ("float has no attribute 'split'"). I thought perhaps the body of the method should be wrapped in a try:except block, and if any error is caught, then the arguments should be rigorously tested for type and lucid exceptions raised. See attachment for suggestion (with tests). I'm not clear whether if the format string is erroneous (bad syntax, or has too many/no %-s, the raised error should be ValueError (contractually correct) or conceivably whatever StringInterpolation raises (parallelism). I've put tests for both in - currently ValueError wins. ---------------------------------------------------------------------- >Comment By: Georg Brandl (gbrandl) Date: 2006-09-30 10:27 Message: Logged In: YES user_id=849994 format() has been overhauled in 2.5. This doesn't apply anymore. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1412580&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com