Merge branch '3.x'

This commit is contained in:
Takeshi KOMIYA 2021-04-11 02:22:32 +09:00
commit 9263eea383
4 changed files with 22 additions and 4 deletions

View File

@ -140,6 +140,8 @@ Release 3.5.4 (in development)
Dependencies
------------
* #9071: Restrict docutils to 0.16
Incompatible changes
--------------------
@ -152,7 +154,10 @@ Features added
Bugs fixed
----------
* #9078: autodoc: Async staticmethods and classmethods are considered as non
async coroutine-functions with Python3.10
* #8870: The style of toctree captions has been changed with docutils-0.17
* #9001: The style of ``sidebar`` directive has been changed with docutils-0.17
Testing
--------

View File

@ -23,7 +23,7 @@ install_requires = [
'sphinxcontrib-qthelp',
'Jinja2>=2.3',
'Pygments>=2.0',
'docutils>=0.14',
'docutils>=0.14,<0.17',
'snowballstemmer>=1.1',
'babel>=1.3',
'alabaster>=0.7,<0.8',

View File

@ -319,7 +319,8 @@ img.align-default, .figure.align-default {
/* -- sidebars -------------------------------------------------------------- */
div.sidebar {
div.sidebar,
aside.sidebar {
margin: 0 0 0.5em 1em;
border: 1px solid #ddb;
padding: 7px;
@ -377,12 +378,14 @@ div.body p.centered {
/* -- content of sidebars/topics/admonitions -------------------------------- */
div.sidebar > :last-child,
aside.sidebar > :last-child,
div.topic > :last-child,
div.admonition > :last-child {
margin-bottom: 0;
}
div.sidebar::after,
aside.sidebar::after,
div.topic::after,
div.admonition::after,
blockquote::after {

View File

@ -361,8 +361,18 @@ def isroutine(obj: Any) -> bool:
def iscoroutinefunction(obj: Any) -> bool:
"""Check if the object is coroutine-function."""
# unwrap staticmethod, classmethod and partial (except wrappers)
obj = unwrap_all(obj, stop=lambda o: hasattr(o, '__wrapped__'))
def iswrappedcoroutine(obj: Any) -> bool:
"""Check if the object is wrapped coroutine-function."""
if isstaticmethod(obj) or isclassmethod(obj) or ispartial(obj):
# staticmethod, classmethod and partial method are not a wrapped coroutine-function
# Note: Since 3.10, staticmethod and classmethod becomes a kind of wrappers
return False
elif hasattr(obj, '__wrapped__'):
return True
else:
return False
obj = unwrap_all(obj, stop=iswrappedcoroutine)
if hasattr(obj, '__code__') and inspect.iscoroutinefunction(obj):
# check obj.__code__ because iscoroutinefunction() crashes for custom method-like
# objects (see https://github.com/sphinx-doc/sphinx/issues/6605)