diff --git a/docs/release_notes.rst b/docs/release_notes.rst index 46e3656..3db4c18 100644 --- a/docs/release_notes.rst +++ b/docs/release_notes.rst @@ -4,6 +4,14 @@ Release Notes **pydocstyle** version numbers follow the `Semantic Versioning `_ specification. + +Current development version +--------------------------- + +Bug Fixes + +* Add support for PEP-701 fixing fstring parsing in python3.12 (#656). + 6.3.0 - January 17th, 2023 -------------------------- diff --git a/src/pydocstyle/parser.py b/src/pydocstyle/parser.py index 95bd0a1..77e665b 100644 --- a/src/pydocstyle/parser.py +++ b/src/pydocstyle/parser.py @@ -479,6 +479,20 @@ def parse_docstring(self): ) self.stream.move() return docstring + if (sys.version_info.major, sys.version_info.minor) >= ( + 3, + 12, + ) and self.current.kind == tk.FSTRING_START: + # Reattach fstring tokens together to deal with PEP 701 in python3.12 + value = self.current.value + start = self.current.start[0] + while self.current.kind != tk.FSTRING_END: + self.stream.move() + value += self.current.value + end = self.current.end[0] + docstring = Docstring(value, start, end) + self.stream.move() + return docstring return None def parse_decorators(self):