File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ Features added
18
18
Bugs fixed
19
19
----------
20
20
21
+ * #9078: autodoc: Async staticmethods and classmethods are considered as non
22
+ async coroutine-functions with Python3.10
21
23
* #8870: The style of toctree captions has been changed with docutils-0.17
22
24
* #9001: The style of ``sidebar`` directive has been changed with docutils-0.17
23
25
Original file line number Diff line number Diff line change @@ -352,8 +352,18 @@ def isroutine(obj: Any) -> bool:
352
352
353
353
def iscoroutinefunction (obj : Any ) -> bool :
354
354
"""Check if the object is coroutine-function."""
355
- # unwrap staticmethod, classmethod and partial (except wrappers)
356
- obj = unwrap_all (obj , stop = lambda o : hasattr (o , '__wrapped__' ))
355
+ def iswrappedcoroutine (obj : Any ) -> bool :
356
+ """Check if the object is wrapped coroutine-function."""
357
+ if isstaticmethod (obj ) or isclassmethod (obj ) or ispartial (obj ):
358
+ # staticmethod, classmethod and partial method are not a wrapped coroutine-function
359
+ # Note: Since 3.10, staticmethod and classmethod becomes a kind of wrappers
360
+ return False
361
+ elif hasattr (obj , '__wrapped__' ):
362
+ return True
363
+ else :
364
+ return False
365
+
366
+ obj = unwrap_all (obj , stop = iswrappedcoroutine )
357
367
if hasattr (obj , '__code__' ) and inspect .iscoroutinefunction (obj ):
358
368
# check obj.__code__ because iscoroutinefunction() crashes for custom method-like
359
369
# objects (see https://github.com/sphinx-doc/sphinx/issues/6605)
You can’t perform that action at this time.
0 commit comments