pydoc -k fails (release30-maint patch) #49703
Copy link
Copy link
Closed
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
Description
| BPO | 5453 |
|---|---|
| Nosy | @birkenfeld |
| Files |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee = None
closed_at = <Date 2009-04-05.15:05:56.060>
created_at = <Date 2009-03-09.02:02:20.833>
labels = ['library', 'type-crash']
title = 'pydoc -k fails (release30-maint patch)'
updated_at = <Date 2009-04-05.15:05:56.058>
user = 'https://bugs.python.org/dariusp'bugs.python.org fields:
activity = <Date 2009-04-05.15:05:56.058>
actor = 'georg.brandl'
assignee = 'none'
closed = True
closed_date = <Date 2009-04-05.15:05:56.060>
closer = 'georg.brandl'
components = ['Library (Lib)']
creation = <Date 2009-03-09.02:02:20.833>
creator = 'dariusp'
dependencies = []
files = ['13277', '13278']
hgrepos = []
issue_num = 5453
keywords = ['patch']
message_count = 2.0
messages = ['83347', '85510']
nosy_count = 2.0
nosy_names = ['georg.brandl', 'dariusp']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = 'crash'
url = 'https://bugs.python.org/issue5453'
versions = ['Python 3.0', 'Python 3.1']Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
Activity
dariusp commentedon Mar 9, 2009
pydoc -k fails for both release30-maint and py3k.
In release30-maint the python io module (or more accurately the
underlying codecs module used by the io module) raises a
LookupError if the encoding is invalid. There is a test module
with a deliberate encoding misspelled as "uft-8". In py3k the C
io module doesn't raise this exception.
In addition both release30-maint and py3k raise a SyntaxError if
the BOM is invalid. Again there is a test module with an invalid
BOM.
The only difference between the patch for release30-maint and the
patch for py3k is that py3k doesn't catch LookupError since the C
io module doesn't raise it.
Apart from that, pkgutil.py handles SyntaxError the same as
ImportError and returns None. pydoc.py handles receiving the
None and also handles the LookupError the same as
UnicodeDecodeError.
A test was added to test_pydoc.py to ensure that a keyword search
sends text to stdout and nothing to stderr.
Before (release30-maint):
$ pydoc -k sys errno - This module makes available standard errno system symbols. posix - This module provides access to operating system functionality that is sys - This module provides access to some objects used or maintained by the colorsys - Conversion functions between RGB and other color systems. distutils.sysconfig - Provide access to Python's configuration information. The specific distutils.tests.test_sysconfig - Tests for distutils.dist. lib2to3.fixes.fix_sys_exc - Fixer for sys.exc_{type, value, traceback} os - OS routines for Mac, NT, or Posix depending on what system we're on. site - Append module search paths for third-party packages to sys.path. Traceback (most recent call last): File "/usr/local/bin/pydoc", line 5, in <module> pydoc.cli() File "/usr/local/lib/python3.0/pydoc.py", line 2260, in cli apropos(val) File "/usr/local/lib/python3.0/pydoc.py", line 1966, in apropos ModuleScanner().run(callback, key, onerror=onerror) File "/usr/local/lib/python3.0/pydoc.py", line 1928, in run source = loader.get_source(modname) File "/usr/local/lib/python3.0/pkgutil.py", line 293, in get_source self.source = self.file.read() File "/usr/local/lib/python3.0/io.py", line 1724, in read decoder = self._decoder or self._get_decoder() File "/usr/local/lib/python3.0/io.py", line 1509, in _get_decoder make_decoder = codecs.getincrementaldecoder(self._encoding) File "/usr/local/lib/python3.0/codecs.py", line 960, in getincrementaldecoder decoder = lookup(encoding).incrementaldecoder LookupError: unknown encoding: uft-8After (release30-maint):
Before (py3k):
$ pydoc -k sys errno - This module makes available standard errno system symbols. posix - This module provides access to operating system functionality that is sys - This module provides access to some objects used or maintained by the colorsys - Conversion functions between RGB and other color systems. distutils.sysconfig - Provide access to Python's configuration information. The specific distutils.tests.test_sysconfig - Tests for distutils.dist. importlib.test.import_.test_caching - Test that sys.modules is used properly by import. lib2to3.fixes.fix_sys_exc - Fixer for sys.exc_{type, value, traceback} os - OS routines for Mac, NT, or Posix depending on what system we're on. site - Append module search paths for third-party packages to sys.path. Traceback (most recent call last): File "/usr/local/bin/pydoc", line 5, in <module> pydoc.cli() File "/usr/local/lib/python3.1/pydoc.py", line 2260, in cli apropos(val) File "/usr/local/lib/python3.1/pydoc.py", line 1966, in apropos ModuleScanner().run(callback, key, onerror=onerror) File "/usr/local/lib/python3.1/pydoc.py", line 1925, in run loader = importer.find_module(modname) File "/usr/local/lib/python3.1/pkgutil.py", line 183, in find_module file, filename, etc = imp.find_module(subname, path) SyntaxError: encoding problem: with BOMAfter (py3k):
birkenfeld commentedon Apr 5, 2009
Fixed in r71242.