diff --git a/src/pydocstyle/checker.py b/src/pydocstyle/checker.py index 9b6376b..b67b1ad 100644 --- a/src/pydocstyle/checker.py +++ b/src/pydocstyle/checker.py @@ -253,7 +253,13 @@ def check_one_liners(self, definition, docstring): """ if docstring: - lines = ast.literal_eval(docstring).split('\n') + docstring_text = ast.literal_eval(docstring) + if isinstance(docstring_text, bytes): + # bytes objects are not valid docstrings. + return + + lines = docstring_text.split('\n') + if len(lines) > 1: non_empty_lines = sum(1 for l in lines if not is_blank(l)) if non_empty_lines == 1: