This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: pydoc.py uses a hack that depends on implementation details and breaks help() when __builtin__.__import__ is overwritten.
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: dkreuter, r.david.murray
Priority: normal Keywords:

Created on 2012-08-29 19:45 by dkreuter, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg169412 - (view) Author: David Kreuter (dkreuter) Date: 2012-08-29 19:45
help("compile") # this works
import __builtin__
real_import = __import__
__builtin__.__import__ = lambda *a: real_import(*a)
help("compile") # this fails

The line responsible for this is in pydoc.py around line 300:
... elif exc is ImportError and extract_tb(tb)[-1][2]=='safeimport': ...
msg169413 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-08-29 19:51
Replacing __import__ is not supported.

That said, this is fixed in 3.3.
History
Date User Action Args
2022-04-11 14:57:35adminsetgithub: 60020
2012-08-29 19:51:13r.david.murraysetstatus: open -> closed

type: behavior
versions: + Python 3.3, - Python 3.1, Python 2.7, Python 3.2
nosy: + r.david.murray

messages: + msg169413
resolution: out of date
stage: resolved
2012-08-29 19:45:14dkreutercreate