New submission from Eric Snow: I'm guessing this is a very seldom (never?) used code path. I've included a patch to test and fix the problem. The patch includes several related tests for pydoc.
$ py3 -c 'import pydoc; pydoc.synopsis("/opt/python3.4/lib/python3.4/lib-dynload/time.cpython-34m.so")' Traceback (most recent call last): File "/opt/python3.4/lib/python3.4/tokenize.py", line 368, in find_cookie line_string = line.decode('utf-8') UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf4 in position 96: invalid continuation byte During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<string>", line 1, in <module> File "/opt/python3.4/lib/python3.4/pydoc.py", line 229, in synopsis file = tokenize.open(filename) File "/opt/python3.4/lib/python3.4/tokenize.py", line 429, in open encoding, lines = detect_encoding(buffer.readline) File "/opt/python3.4/lib/python3.4/tokenize.py", line 409, in detect_encoding encoding = find_cookie(first) File "/opt/python3.4/lib/python3.4/tokenize.py", line 373, in find_cookie raise SyntaxError(msg) SyntaxError: invalid or missing encoding declaration for '/opt/python3.4/lib/python3.4/lib-dynload/time.cpython-34m.so' ---------- messages: 207319 nosy: eric.snow, larry priority: normal severity: normal stage: patch review status: open title: pydoc.synopsis fails to load binary modules type: behavior _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue20123> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com