diff options
author | Dave Lee <davelee.com@gmail.com> | 2023-02-15 14:01:05 -0800 |
---|---|---|
committer | Dave Lee <davelee.com@gmail.com> | 2023-02-15 15:25:59 -0800 |
commit | f1ddfa6d8a72bcc89e01ab8f73bbe5ae5a0dc475 (patch) | |
tree | 7d22917abe3afb09d292b9861aa2d5bd0474f79c /lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h | |
parent | 7d62bc9cd3805d44d09d1f224c872f07584ac24a (diff) | |
download | llvm-f1ddfa6d8a72bcc89e01ab8f73bbe5ae5a0dc475.zip llvm-f1ddfa6d8a72bcc89e01ab8f73bbe5ae5a0dc475.tar.gz llvm-f1ddfa6d8a72bcc89e01ab8f73bbe5ae5a0dc475.tar.bz2 |
[lldb] Remove pydoc import during script interpreter init
The Python script interpreter imports `pydoc` during initialization, but this can be
slow in some cases, and doesn't seem to be necessary any more.
This can be slow because pydoc may execute shell commands (for example `xcrun` on
macOS). The shell commands may have variable performance, depending on their caches and
search space.
The 2012 bug report for the original commit (f71a8399997bfdc1ddeeb30c6a8897554a11c382)
says the following:
> "script help" in lldb pipes the help documentation through less(1) but there's some
> problem with the key handling and often the keys you'd use to move in less (space to
> move down a page, 'q' to quit) are not received by less (they're going to lldb
> instead)
This was resolved at the time by overriding `pydoc`'s pager to be the `plainpager`
function.
I have manually tested `script help(lldb.SBDebugger)` and found no issues with the
pager, including using "space" for paging, "/" for searching, and "q" for quitting.
The presumption is that lldb and/or Python have improved I/O handling that eliminates
the original problem.
The original bug report gave an ~/.lldbinit workaround:
```
script import pydoc; pydoc.pager = pydoc.plainpager
```
Note that calling Python's `help()` will import `pydoc`, but this will only happen for
users who use `help()` from the `script` command.
Differential Revision: https://reviews.llvm.org/D144138
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h')
0 files changed, 0 insertions, 0 deletions