Skip to content

gh-92345: Import rlcompleter before sys.path is extended - #92346

Merged
tiran merged 1 commit into
python:mainfrom
tiran:early_rlcompleter
May 5, 2022
Merged

tiran merged 1 commit into
python:mainfrom
tiran:early_rlcompleter

Conversation

@tiran

@tiran tiran commented May 5, 2022

Copy link
Copy Markdown
Member

pymain_run_python() now imports readline and rlcompleter
before sys.path is extended to include the current working directory of
an interactive interpreter. Non-interactive interpreters are not
affected.

Also move imports of re and keyword module to top level so they
are materialized early, too. The keyword module is trivial and the
re is already imported via inspect -> linecache.

Signed-off-by: Christian Heimes christian@python.org

``pymain_run_python()`` now imports ``readline`` and ``rlcompleter``
before sys.path is extended to include the current working directory of
an interactive interpreter. Non-interactive interpreters are not
affected.

Also move imports of ``re`` and ``keyword`` module to top level so they
are materialized early, too. The ``keyword`` module is trivial and the
``re`` is already imported via ``inspect`` -> ``linecache``.

Signed-off-by: Christian Heimes <christian@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants