1. 13 Apr, 2006 7 commits
  2. 12 Apr, 2006 31 commits
  3. 11 Apr, 2006 2 commits
    • Thomas Wouters's avatar
      Fix int() and long() to repr() their argument when formatting the exception, · 9cb28bea
      Thomas Wouters authored
      to avoid confusing situations like:
      
      >>> int("")
      ValueError: invalid literal for int():
      >>> int("2\n\n2")
      ValueError: invalid literal for int(): 2
      
      2
      
      Also report the base used, to avoid:
      
      ValueError: invalid literal for int(): 2
      
      They now report:
      
      >>> int("")
      ValueError: invalid literal for int() with base 10: ''
      >>> int("2\n\n2")
      ValueError: invalid literal for int() with base 10: '2\n\n2'
      >>> int("2", 2)
      ValueError: invalid literal for int() with base 2: '2'
      
      (Reporting the base could be avoided when base is 10, which is the default,
      but hrm.) Another effect of these changes is that the errormessage can be
      longer; before, it was cut off at about 250 characters. Now, it can be up to
      four times as long, as the unrepr'ed string is cut off at 200 characters,
      instead.
      
      No tests were added or changed, since testing for exact errormsgs is (pardon
      the pun) somewhat errorprone, and I consider not testing the exact text
      preferable. The actually changed code is tested frequent enough in the
      test_builtin test as it is (120 runs for each of ints and longs.)
      9cb28bea
    • Vinay Sajip's avatar
      StreamHandler now checks explicitly for None before using sys.stderr as the... · 502348d0
      Vinay Sajip authored
      StreamHandler now checks explicitly for None before using sys.stderr as the stream (see SF bug #1463840).
      502348d0