Issue #28139: Fix messed up indentation

Also update the classmethod and staticmethod doc strings and comments to
match the RST documentation.
This commit is contained in:
Martin Panter 2016-09-17 03:26:16 +00:00
parent 4a72a7b6c4
commit 6d57fe1c23
8 changed files with 41 additions and 35 deletions

View File

@ -54,9 +54,10 @@ copy_grouping(char* s)
int i;
PyObject *result, *val = NULL;
if (s[0] == '\0')
if (s[0] == '\0') {
/* empty string: no grouping at all */
return PyList_New(0);
}
for (i = 0; s[i] != '\0' && s[i] != CHAR_MAX; i++)
; /* nothing */

View File

@ -1967,6 +1967,7 @@ getsockaddrlen(PySocketSockObject *s, socklen_t *len_ret)
return 1;
}
#endif /* AF_UNIX */
#if defined(AF_NETLINK)
case AF_NETLINK:
{

View File

@ -697,8 +697,9 @@ PyTypeObject PyFunction_Type = {
To declare a class method, use this idiom:
class C:
def f(cls, arg1, arg2, ...): ...
f = classmethod(f)
@classmethod
def f(cls, arg1, arg2, ...):
...
It can be called either on the class (e.g. C.f()) or on an instance
(e.g. C().f()); the instance is ignored except for its class.
@ -808,8 +809,9 @@ just like an instance method receives the instance.\n\
To declare a class method, use this idiom:\n\
\n\
class C:\n\
def f(cls, arg1, arg2, ...): ...\n\
f = classmethod(f)\n\
@classmethod\n\
def f(cls, arg1, arg2, ...):\n\
...\n\
\n\
It can be called either on the class (e.g. C.f()) or on an instance\n\
(e.g. C().f()). The instance is ignored except for its class.\n\
@ -880,8 +882,9 @@ PyClassMethod_New(PyObject *callable)
To declare a static method, use this idiom:
class C:
def f(arg1, arg2, ...): ...
f = staticmethod(f)
@staticmethod
def f(arg1, arg2, ...):
...
It can be called either on the class (e.g. C.f()) or on an instance
(e.g. C().f()); the instance is ignored except for its class.
@ -986,8 +989,9 @@ A static method does not receive an implicit first argument.\n\
To declare a static method, use this idiom:\n\
\n\
class C:\n\
def f(arg1, arg2, ...): ...\n\
f = staticmethod(f)\n\
@staticmethod\n\
def f(arg1, arg2, ...):\n\
...\n\
\n\
It can be called either on the class (e.g. C.f()) or on an instance\n\
(e.g. C().f()). The instance is ignored except for its class.\n\