bpo-36045: builtins.help() now prefixes async
for async functions (… · python/cpython@2a37f8f (original) (raw)
`@@ -951,6 +951,12 @@ def docroutine(self, object, name=None, mod=None,
`
951
951
`else:
`
952
952
`note = ' unbound %s method' % self.classlink(imclass,mod)
`
953
953
``
``
954
`+
if (inspect.iscoroutinefunction(object) or
`
``
955
`+
inspect.isasyncgenfunction(object)):
`
``
956
`+
asyncqualifier = 'async '
`
``
957
`+
else:
`
``
958
`+
asyncqualifier = ''
`
``
959
+
954
960
`if name == realname:
`
955
961
`title = '%s' % (anchor, realname)
`
956
962
`else:
`
`@@ -979,8 +985,8 @@ def docroutine(self, object, name=None, mod=None,
`
979
985
`if not argspec:
`
980
986
`argspec = '(...)'
`
981
987
``
982
``
`-
decl = title + self.escape(argspec) + (note and self.grey(
`
983
``
`-
'%s' % note))
`
``
988
`+
decl = asyncqualifier + title + self.escape(argspec) + (note and
`
``
989
`+
self.grey('%s' % note))
`
984
990
``
985
991
`if skipdocs:
`
986
992
`return '
- %s
`
`@@ -1382,6 +1388,12 @@ def docroutine(self, object, name=None, mod=None, cl=None):
`
1382
1388
`else:
`
1383
1389
`note = ' unbound %s method' % classname(imclass,mod)
`
1384
1390
``
``
1391
`+
if (inspect.iscoroutinefunction(object) or
`
``
1392
`+
inspect.isasyncgenfunction(object)):
`
``
1393
`+
asyncqualifier = 'async '
`
``
1394
`+
else:
`
``
1395
`+
asyncqualifier = ''
`
``
1396
+
1385
1397
`if name == realname:
`
1386
1398
`title = self.bold(realname)
`
1387
1399
`else:
`
`@@ -1405,7 +1417,7 @@ def docroutine(self, object, name=None, mod=None, cl=None):
`
1405
1417
`argspec = argspec[1:-1] # remove parentheses
`
1406
1418
`if not argspec:
`
1407
1419
`argspec = '(...)'
`
1408
``
`-
decl = title + argspec + note
`
``
1420
`+
decl = asyncqualifier + title + argspec + note
`
1409
1421
``
1410
1422
`if skipdocs:
`
1411
1423
`return decl + '\n'
`