Skip to content

Fix doctest prompt stripping regression#15260

Open
Erotemic wants to merge 1 commit into
ipython:mainfrom
Erotemic:fix-docstr-paste
Open

Fix doctest prompt stripping regression#15260
Erotemic wants to merge 1 commit into
ipython:mainfrom
Erotemic:fix-docstr-paste

Conversation

@Erotemic

Copy link
Copy Markdown
Contributor

Fixes #15259

A regression in IPython 9.10 caused doctest prompts (>>> or ...) to stop being stripped in multiline strings.

The change in the regex from \s to [ \t] prevents it from eating newlines for "blank lines" (i.e. a bare ... ).

The new code add checks when the stripper encounts a multiline string and strips leading PS1/PS2 prompts if they agree with the indentation of outer stripped prompts. This should be safe and real >>> or ... inside a multiline string should be preserved (CLASSIC_PROMPT_INDENTED_LITERAL_MULTILINE_STRING tests this).

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.

Doctest paste regression with multiline strings.

1 participant