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: patch for pydoc to work in py3k
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.0
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, sgala
Priority: normal Keywords: easy, patch

Created on 2008-01-18 19:44 by sgala, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
pydoc.patch sgala, 2008-01-18 19:43 patch to make pydoc behave
Messages (4)
msg60112 - (view) Author: Santiago Gala (sgala) Date: 2008-01-18 19:43
Basically I'm finding to simple errors:

 * an iterable where it expects a list, I solved it using a simple list
comprehension on the original iterable
 * it tries to write a string to the socket, I used "UTF-8" both in the
Content-Type header and in the conversion to bytes. It could easyly be
parameterized.

This two changes enabled me to get a basic pydoc running.
msg60229 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-01-19 20:44
Fixed in r60100.
msg61458 - (view) Author: Santiago Gala (sgala) Date: 2008-01-21 22:14
El sáb, 19-01-2008 a las 20:44 +0000, Georg Brandl escribió:
> Georg Brandl added the comment:
> 
> Fixed in r60100.
> 

If the problem with the output of filter is solved at the call site I'd
suggest the second hunk of:

$ svn diff Lib/pydoc.py
Index: Lib/pydoc.py
===================================================================
--- Lib/pydoc.py	(revisión: 60126)
+++ Lib/pydoc.py	(copia de trabajo)
@@ -1192,7 +1192,7 @@
             else:
                 tag = "inherited from %s" % classname(thisclass,

object.__module__)
-            filter(lambda t: not t[0].startswith('_'), attrs)
+            #filter(lambda t: not t[0].startswith('_'), attrs)

             # Sort attrs by name.
             attrs.sort()
@@ -1972,9 +1972,8 @@
 '#ffffff', '#7799ee')
                 def bltinlink(name):
                     return '<a href="%s.html">%s</a>' % (name, name)
-                names = filter(lambda x: x != '__main__',
-                               sys.builtin_module_names)
-                contents = html.multicolumn(list(names), bltinlink)
+                names = [x for x in sys.builtin_module_names if x !=
'__main__']
+                contents = html.multicolumn(names, bltinlink)
                 indices = ['<p>' + html.bigsection(
                     'Built-in Modules', '#ffffff', '#ee77aa',
contents)]

instead, i.e. use a simple list comprehension instead of the filter
expression (ugly) and list(names). The first hunk removes a useles
expression, I'm not sure why it is there, but filter has no side
effects. It looks like attrs = filter... is intended, but then, again a
list comprehension would be clearer.

Regards
Santiago

> ----------
> nosy: +georg.brandl
> resolution:  -> fixed
> status: open -> closed
> 
> __________________________________
> Tracker <report@bugs.python.org>
> <http://bugs.python.org/issue1867>
> __________________________________
msg61744 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-01-27 18:16
Done in r60366, thanks!
History
Date User Action Args
2022-04-11 14:56:29adminsetgithub: 46175
2008-01-27 18:16:20georg.brandlsetmessages: + msg61744
2008-01-21 22:14:43sgalasetmessages: + msg61458
2008-01-19 20:44:38georg.brandlsetstatus: open -> closed
resolution: fixed
messages: + msg60229
nosy: + georg.brandl
2008-01-18 20:22:21christian.heimessetpriority: normal
keywords: + patch, easy
type: behavior
components: + Library (Lib), - Documentation
2008-01-18 19:44:00sgalacreate