Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eecb9a2

Browse files
committed
Fix doctest empty line parsing error (felix-hilden#176)
1 parent f8e580f commit eecb9a2

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

docs/src/release_notes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ sphinx-codeautolink adheres to
1111
Unreleased
1212
----------
1313
- Fix attribute and call after walrus leading parser error (:issue:`174`)
14+
- Fix parsing error in doctest blocks with empty lines (:issue:`176`)
1415
- Improve error message on uncaught parsing errors (:issue:`177`)
1516

1617
0.17.0 (2025-02-18)

src/sphinx_codeautolink/extension/block.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def clean_pycon(source: str) -> tuple[str, str]:
5050
if line.startswith(">>> "):
5151
in_statement = True
5252
clean_lines.append(line[4:])
53-
elif in_statement and line.startswith("... "):
53+
elif in_statement and line.startswith("..."):
5454
clean_lines.append(line[4:])
5555
else:
5656
in_statement = False
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# split
2+
# split
3+
Test project
4+
============
5+
6+
>>> ast.dump(ast.parse("""\
7+
... for a in b:
8+
... if a > 5:
9+
... break
10+
... else:
11+
... continue
12+
...
13+
... """), indent=4)
14+
15+
.. automodule:: test_project

0 commit comments

Comments
 (0)