Terry J. Reedy added the comment:

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.)

----------
nosy: +georg.brandl, terry.reedy

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16855>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to