Skip to content

help() does not use pager on python 3 #228

@ikanobori

Description

@ikanobori

On python 3.2.3 (and probably on some other python 3 versions) help() in bpython (curses frontend) does not use the pager, it just dumps everything to stdout. This is caused by bpython._internal using "pydoc.Helper(sys.stdin, sys.stdout)". On older pythons this worked fine, on newer pythons this forces actual help output to go straight to stdout instead of using the pager.

A workaround is to pass None instead of sys.stdout (which is the default, so it is probably best to just use "pydoc.Helper()"). On older pythons (including 2.7, did not check older python 2) all access goes through a property that returns sys.stdin/stdout if the value passed was None. On python 3.2.3 there is exactly one spot that bypasses the property, and that uses the pager if it sees None (which is what we want).

Someone should check pydoc.Helper() does the right thing on all older pythons still supported before committing this, though (I do not have older pythons handy).


Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions