Message179105
On Win7, 2.7.3 gives me the same output. (Running in IDLE, I don't get the 'socket.' prefix even on the second traceback.) With 3.3, I get socket.timeout both times (console or IDLE). So the problem seems to be 2.x only.
print_exc calls print_exception, which calls print_tb and format_exception_only, which is responsible for the last line.
The 2.7 code
if (isinstance(etype, BaseException) or
isinstance(etype, types.InstanceType) or
etype is None or type(etype) is str):
return [_format_final_exc_line(etype, value)]
is simplified in 3.x to
if etype is None:
return [_format_final_exc_line(etype, value)]
After
stype = etype.__name__
3.3 (and 3.x, I presume) adds
smod = etype.__module__
if smod not in ("__main__", "builtins"):
stype = smod + '.' + stype
That is where the 'socket' prefix is added in 3.3, so perhaps that should be added to 2.7.
Note: indenting code makes it harder to cut, paste, and run ;-(
Using 'print (x)', which works fine in 2.7, instead of 'print x' would also greatly help testing in 3.x, which is needed for any bug report.) |
|
Date |
User |
Action |
Args |
2013-01-05 04:06:23 | terry.reedy | set | recipients:
+ terry.reedy, georg.brandl, waltermundt |
2013-01-05 04:06:23 | terry.reedy | set | messageid: <1357358783.08.0.864468686435.issue16855@psf.upfronthosting.co.za> |
2013-01-05 04:06:23 | terry.reedy | link | issue16855 messages |
2013-01-05 04:06:22 | terry.reedy | create | |
|