Skip to content

Commit c25c319

Browse files
ddfishergvanrossum
authored andcommitted
Fix --warn-no-return with unicode docstrings (#2442)
1 parent 1d2a046 commit c25c319

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

mypy/checker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ def is_trivial_body(self, block: Block) -> bool:
668668

669669
# Skip a docstring
670670
if (isinstance(body[0], ExpressionStmt) and
671-
isinstance(body[0].expr, StrExpr)):
671+
isinstance(body[0].expr, (StrExpr, UnicodeExpr))):
672672
body = block.body[1:]
673673

674674
if len(body) == 0:

test-data/unit/check-flags.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ def i() -> int:
9393
"""with docstring"""
9494
...
9595
def j() -> int:
96+
u"""with unicode docstring"""
97+
pass
98+
def k() -> int:
9699
"""docstring only"""
97100

98101
[case testWarnNoReturnWorksWithAlwaysTrue]

0 commit comments

Comments
 (0)