Malte Helmert added the comment: And here's a patch for case 2 (int) conversion. There is still a slight inconsistency in error reporting (base 0 vs. base 16) between int and long, but I'd see this as long's fault:
>>> int("0x", 0) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: invalid literal for int() with base 0: '0x' >>> int("0x", 16) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: invalid literal for int() with base 16: '0x' >>> long("0x", 0) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: invalid literal for long() with base 16: '0x' >>> long("0x", 16) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: invalid literal for long() with base 16: '0x' The patch is not pretty because it duplicates a lot of code, but it's probably easier to see what was changed that way. I'll add a prettier patch soon. Added file: http://bugs.python.org/file9224/PATCH-2a.diff __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1679> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com