Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6d57fe1

Browse files
committed
Issue #28139: Fix messed up indentation
Also update the classmethod and staticmethod doc strings and comments to match the RST documentation.
1 parent 4a72a7b commit 6d57fe1

8 files changed

Lines changed: 41 additions & 35 deletions

File tree

Include/unicodeobject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ typedef unsigned char Py_UCS1;
176176

177177
#define Py_UNICODE_FILL(target, value, length) \
178178
do {Py_ssize_t i_; Py_UNICODE *t_ = (target); Py_UNICODE v_ = (value);\
179-
for (i_ = 0; i_ < (length); i_++) t_[i_] = v_;\
179+
for (i_ = 0; i_ < (length); i_++) t_[i_] = v_;\
180180
} while (0)
181181

182182
/* macros to work with surrogates */

Modules/_ctypes/_ctypes.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5138,18 +5138,18 @@ comerror_init(PyObject *self, PyObject *args, PyObject *kwds)
51385138
int status;
51395139

51405140
if (!_PyArg_NoKeywords(Py_TYPE(self)->tp_name, kwds))
5141-
return -1;
5141+
return -1;
51425142

51435143
if (!PyArg_ParseTuple(args, "OOO:COMError", &hresult, &text, &details))
51445144
return -1;
51455145

51465146
a = PySequence_GetSlice(args, 1, PySequence_Size(args));
51475147
if (!a)
5148-
return -1;
5148+
return -1;
51495149
status = PyObject_SetAttrString(self, "args", a);
51505150
Py_DECREF(a);
51515151
if (status < 0)
5152-
return -1;
5152+
return -1;
51535153

51545154
if (PyObject_SetAttrString(self, "hresult", hresult) < 0)
51555155
return -1;

Modules/_localemodule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ copy_grouping(char* s)
5454
int i;
5555
PyObject *result, *val = NULL;
5656

57-
if (s[0] == '\0')
57+
if (s[0] == '\0') {
5858
/* empty string: no grouping at all */
5959
return PyList_New(0);
60+
}
6061

6162
for (i = 0; s[i] != '\0' && s[i] != CHAR_MAX; i++)
6263
; /* nothing */

Modules/fcntlmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ conv_descriptor(PyObject *object, int *target)
2626
int fd = PyObject_AsFileDescriptor(object);
2727

2828
if (fd < 0)
29-
return 0;
29+
return 0;
3030
*target = fd;
3131
return 1;
3232
}

Modules/signalmodule.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,18 @@ itimer_retval(struct itimerval *iv)
154154

155155
r = PyTuple_New(2);
156156
if (r == NULL)
157-
return NULL;
157+
return NULL;
158158

159159
if(!(v = PyFloat_FromDouble(double_from_timeval(&iv->it_value)))) {
160-
Py_DECREF(r);
161-
return NULL;
160+
Py_DECREF(r);
161+
return NULL;
162162
}
163163

164164
PyTuple_SET_ITEM(r, 0, v);
165165

166166
if(!(v = PyFloat_FromDouble(double_from_timeval(&iv->it_interval)))) {
167-
Py_DECREF(r);
168-
return NULL;
167+
Py_DECREF(r);
168+
return NULL;
169169
}
170170

171171
PyTuple_SET_ITEM(r, 1, v);
@@ -1479,9 +1479,9 @@ PyInit__signal(void)
14791479

14801480
#if defined (HAVE_SETITIMER) || defined (HAVE_GETITIMER)
14811481
ItimerError = PyErr_NewException("signal.ItimerError",
1482-
PyExc_IOError, NULL);
1482+
PyExc_IOError, NULL);
14831483
if (ItimerError != NULL)
1484-
PyDict_SetItemString(d, "ItimerError", ItimerError);
1484+
PyDict_SetItemString(d, "ItimerError", ItimerError);
14851485
#endif
14861486

14871487
#ifdef CTRL_C_EVENT

Modules/socketmodule.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1967,12 +1967,13 @@ getsockaddrlen(PySocketSockObject *s, socklen_t *len_ret)
19671967
return 1;
19681968
}
19691969
#endif /* AF_UNIX */
1970+
19701971
#if defined(AF_NETLINK)
1971-
case AF_NETLINK:
1972-
{
1973-
*len_ret = sizeof (struct sockaddr_nl);
1974-
return 1;
1975-
}
1972+
case AF_NETLINK:
1973+
{
1974+
*len_ret = sizeof (struct sockaddr_nl);
1975+
return 1;
1976+
}
19761977
#endif
19771978

19781979
#ifdef AF_RDS

Objects/funcobject.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -697,8 +697,9 @@ PyTypeObject PyFunction_Type = {
697697
To declare a class method, use this idiom:
698698
699699
class C:
700-
def f(cls, arg1, arg2, ...): ...
701-
f = classmethod(f)
700+
@classmethod
701+
def f(cls, arg1, arg2, ...):
702+
...
702703
703704
It can be called either on the class (e.g. C.f()) or on an instance
704705
(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\
808809
To declare a class method, use this idiom:\n\
809810
\n\
810811
class C:\n\
811-
def f(cls, arg1, arg2, ...): ...\n\
812-
f = classmethod(f)\n\
812+
@classmethod\n\
813+
def f(cls, arg1, arg2, ...):\n\
814+
...\n\
813815
\n\
814816
It can be called either on the class (e.g. C.f()) or on an instance\n\
815817
(e.g. C().f()). The instance is ignored except for its class.\n\
@@ -880,8 +882,9 @@ PyClassMethod_New(PyObject *callable)
880882
To declare a static method, use this idiom:
881883
882884
class C:
883-
def f(arg1, arg2, ...): ...
884-
f = staticmethod(f)
885+
@staticmethod
886+
def f(arg1, arg2, ...):
887+
...
885888
886889
It can be called either on the class (e.g. C.f()) or on an instance
887890
(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\
986989
To declare a static method, use this idiom:\n\
987990
\n\
988991
class C:\n\
989-
def f(arg1, arg2, ...): ...\n\
990-
f = staticmethod(f)\n\
992+
@staticmethod\n\
993+
def f(arg1, arg2, ...):\n\
994+
...\n\
991995
\n\
992996
It can be called either on the class (e.g. C.f()) or on an instance\n\
993997
(e.g. C().f()). The instance is ignored except for its class.\n\

PC/bdist_wininst/install.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,16 +1657,16 @@ SelectPythonDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
16571657
PropSheet_SetWizButtons(GetParent(hwnd),
16581658
PSWIZB_BACK | PSWIZB_NEXT);
16591659
/* Get the python directory */
1660-
ivi = (InstalledVersionInfo *)
1660+
ivi = (InstalledVersionInfo *)
16611661
SendDlgItemMessage(hwnd,
1662-
IDC_VERSIONS_LIST,
1663-
LB_GETITEMDATA,
1664-
id,
1665-
0);
1666-
hkey_root = ivi->hkey;
1667-
strcpy(python_dir, ivi->prefix);
1668-
SetDlgItemText(hwnd, IDC_PATH, python_dir);
1669-
/* retrieve the python version and pythondll to use */
1662+
IDC_VERSIONS_LIST,
1663+
LB_GETITEMDATA,
1664+
id,
1665+
0);
1666+
hkey_root = ivi->hkey;
1667+
strcpy(python_dir, ivi->prefix);
1668+
SetDlgItemText(hwnd, IDC_PATH, python_dir);
1669+
/* retrieve the python version and pythondll to use */
16701670
result = SendDlgItemMessage(hwnd, IDC_VERSIONS_LIST,
16711671
LB_GETTEXTLEN, (WPARAM)id, 0);
16721672
pbuf = (char *)malloc(result + 1);

0 commit comments

Comments
 (0)