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 error on instance of a custom class
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: r.david.murray Nosy List: eric.araujo, flox, peter.otten, python-dev, r.david.murray
Priority: normal Keywords: patch

Created on 2012-04-20 20:45 by flox, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
render_doc.patch peter.otten, 2012-04-21 08:04 review
Messages (4)
msg158887 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2012-04-20 20:45
pydoc fails on custom instances in specific cases. (When instance __name__ does not resolve to a str).

This is a small example:

>>> import pydoc
>>> class A:
...   def __getattr__(self, name):
...     return True
... 
>>> print(pydoc.render_doc(A))
Python Library Documentation: class A in module __main__
(...)
>>> print(pydoc.render_doc(A()))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "./Lib/pydoc.py", line 1534, in render_doc
    if name and '.' in name:
TypeError: argument of type 'bool' is not iterable
msg158912 - (view) Author: Peter Otten (peter.otten) * Date: 2012-04-21 08:04
Patch upload, second attempt.
msg159047 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-04-23 17:27
New changeset 2a35dfbe3d99 by R David Murray in branch '3.2':
#14638: pydoc now treats non-str __name__ as None instead of raising
http://hg.python.org/cpython/rev/2a35dfbe3d99

New changeset 86b4b54bb0fa by R David Murray in branch 'default':
merge #14638: pydoc now treats non-str __name__ as None instead of raising
http://hg.python.org/cpython/rev/86b4b54bb0fa

New changeset 501651b93cb0 by R David Murray in branch '2.7':
#14638: pydoc now treats non-str __name__ as None instead of raising
http://hg.python.org/cpython/rev/501651b93cb0
msg159048 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-04-23 17:30
Thanks Peter.
History
Date User Action Args
2022-04-11 14:57:29adminsetgithub: 58843
2012-04-23 17:30:04r.david.murraysetstatus: open -> closed
resolution: fixed
messages: + msg159048

stage: commit review -> resolved
2012-04-23 17:27:52python-devsetnosy: + python-dev
messages: + msg159047
2012-04-23 17:11:33r.david.murraysetassignee: r.david.murray

nosy: + r.david.murray
stage: commit review
2012-04-21 08:04:30peter.ottensetfiles: + render_doc.patch

nosy: + peter.otten
messages: + msg158912

keywords: + patch
2012-04-20 21:56:31eric.araujosetnosy: + eric.araujo
2012-04-20 20:45:23floxcreate