From 63ba4f8f032cae4eb6990947130dd79f86a6b04b Mon Sep 17 00:00:00 2001 From: zhanglinyan Date: Mon, 12 Jan 2026 17:01:37 +0800 Subject: [PATCH] fix: resolve numpydoc StopIteration error for async functions --- numpydoc/validate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/numpydoc/validate.py b/numpydoc/validate.py index 30b0f413..9b17efaf 100644 --- a/numpydoc/validate.py +++ b/numpydoc/validate.py @@ -328,7 +328,7 @@ def source_file_def_line(self): def_line = next( i for i, x in enumerate( - re.match("^ *(def|class) ", s) for s in sourcelines[0] + re.match(r"^\s*(async\s+)?(?:def|class)\s+", s) for s in sourcelines[0] ) if x is not None )