Issue #28139: Fix messed up indentation
Also update the classmethod and staticmethod doc strings and comments to
match the RST documentation.
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index a1c0be8..5b4ac47 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -5396,11 +5396,11 @@
a = PySequence_GetSlice(args, 1, PySequence_Size(args));
if (!a)
- return NULL;
+ return NULL;
status = PyObject_SetAttrString(self, "args", a);
Py_DECREF(a);
if (status < 0)
- return NULL;
+ return NULL;
if (PyObject_SetAttrString(self, "hresult", hresult) < 0)
return NULL;
@@ -5755,25 +5755,25 @@
PyUnicodeObject *unicode;
if (w == NULL) {
- PyErr_BadInternalCall();
- return NULL;
+ PyErr_BadInternalCall();
+ return NULL;
}
unicode = (PyUnicodeObject *)PyUnicode_FromUnicode(NULL, size);
if (!unicode)
- return NULL;
+ return NULL;
/* Copy the wchar_t data into the new object */
#ifdef HAVE_USABLE_WCHAR_T
memcpy(unicode->str, w, size * sizeof(wchar_t));
#else
{
- register Py_UNICODE *u;
- register int i;
- u = PyUnicode_AS_UNICODE(unicode);
- /* In Python, the following line has a one-off error */
- for (i = size; i > 0; i--)
- *u++ = *w++;
+ register Py_UNICODE *u;
+ register int i;
+ u = PyUnicode_AS_UNICODE(unicode);
+ /* In Python, the following line has a one-off error */
+ for (i = size; i > 0; i--)
+ *u++ = *w++;
}
#endif
@@ -5785,21 +5785,21 @@
Py_ssize_t size)
{
if (unicode == NULL) {
- PyErr_BadInternalCall();
- return -1;
+ PyErr_BadInternalCall();
+ return -1;
}
if (size > PyUnicode_GET_SIZE(unicode))
- size = PyUnicode_GET_SIZE(unicode);
+ size = PyUnicode_GET_SIZE(unicode);
#ifdef HAVE_USABLE_WCHAR_T
memcpy(w, unicode->str, size * sizeof(wchar_t));
#else
{
- register Py_UNICODE *u;
- register int i;
- u = PyUnicode_AS_UNICODE(unicode);
- /* In Python, the following line has a one-off error */
- for (i = size; i > 0; i--)
- *w++ = *u++;
+ register Py_UNICODE *u;
+ register int i;
+ u = PyUnicode_AS_UNICODE(unicode);
+ /* In Python, the following line has a one-off error */
+ for (i = size; i > 0; i--)
+ *w++ = *u++;
}
#endif
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c
index e497a8f..7e2f1a9 100644
--- a/Modules/_localemodule.c
+++ b/Modules/_localemodule.c
@@ -57,9 +57,10 @@
int i;
PyObject *result, *val = NULL;
- if (s[0] == '\0')
- /* empty string: no grouping at all */
- return PyList_New(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 */
@@ -534,7 +535,7 @@
{
int item, i;
if (!PyArg_ParseTuple(args, "i:nl_langinfo", &item))
- return NULL;
+ return NULL;
/* Check whether this is a supported constant. GNU libc sometimes
returns numeric values in the char* return value, which would
crash PyString_FromString. */
diff --git a/Modules/_multiprocessing/connection.h b/Modules/_multiprocessing/connection.h
index 1d97bd4..12e6eee 100644
--- a/Modules/_multiprocessing/connection.h
+++ b/Modules/_multiprocessing/connection.h
@@ -19,14 +19,14 @@
#define CHECK_READABLE(self) \
if (!(self->flags & READABLE)) { \
- PyErr_SetString(PyExc_IOError, "connection is write-only"); \
- return NULL; \
+ PyErr_SetString(PyExc_IOError, "connection is write-only"); \
+ return NULL; \
}
#define CHECK_WRITABLE(self) \
if (!(self->flags & WRITABLE)) { \
- PyErr_SetString(PyExc_IOError, "connection is read-only"); \
- return NULL; \
+ PyErr_SetString(PyExc_IOError, "connection is read-only"); \
+ return NULL; \
}
/*
diff --git a/Modules/binascii.c b/Modules/binascii.c
index dce511d..06af60f 100644
--- a/Modules/binascii.c
+++ b/Modules/binascii.c
@@ -880,7 +880,7 @@
int signed_val;
if (!PyArg_ParseTuple(args, "s*|I:crc32", &pbuf, &crc32val))
- return NULL;
+ return NULL;
/* In Python 2.x we return a signed integer regardless of native platform
* long size (the 32bit unsigned long is treated as 32-bit signed and sign
* extended into a 64-bit long inside the integer object). 3.0 does the
diff --git a/Modules/bsddbmodule.c b/Modules/bsddbmodule.c
index 578cf3d..478d75d 100644
--- a/Modules/bsddbmodule.c
+++ b/Modules/bsddbmodule.c
@@ -851,7 +851,7 @@
if (PyErr_WarnPy3k("the bsddb185 module has been removed in "
"Python 3.0", 2) < 0)
- return;
+ return;
Bsddbtype.ob_type = &PyType_Type;
m = Py_InitModule("bsddb185", bsddbmodule_methods);
diff --git a/Modules/cPickle.c b/Modules/cPickle.c
index 88f4f23..845ad8f 100644
--- a/Modules/cPickle.c
+++ b/Modules/cPickle.c
@@ -1323,71 +1323,71 @@
#endif
if (size > PY_SSIZE_T_MAX / expandsize)
- return PyErr_NoMemory();
+ return PyErr_NoMemory();
repr = PyString_FromStringAndSize(NULL, expandsize * size);
if (repr == NULL)
- return NULL;
+ return NULL;
if (size == 0)
- return repr;
+ return repr;
p = q = PyString_AS_STRING(repr);
while (size-- > 0) {
- Py_UNICODE ch = *s++;
+ Py_UNICODE ch = *s++;
#ifdef Py_UNICODE_WIDE
- /* Map 32-bit characters to '\Uxxxxxxxx' */
- if (ch >= 0x10000) {
- *p++ = '\\';
- *p++ = 'U';
- *p++ = hexdigit[(ch >> 28) & 0xf];
- *p++ = hexdigit[(ch >> 24) & 0xf];
- *p++ = hexdigit[(ch >> 20) & 0xf];
- *p++ = hexdigit[(ch >> 16) & 0xf];
- *p++ = hexdigit[(ch >> 12) & 0xf];
- *p++ = hexdigit[(ch >> 8) & 0xf];
- *p++ = hexdigit[(ch >> 4) & 0xf];
- *p++ = hexdigit[ch & 15];
- }
- else
-#else
- /* Map UTF-16 surrogate pairs to '\U00xxxxxx' */
- if (ch >= 0xD800 && ch < 0xDC00) {
- Py_UNICODE ch2;
- Py_UCS4 ucs;
-
- ch2 = *s++;
- size--;
- if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) {
- ucs = (((ch & 0x03FF) << 10) | (ch2 & 0x03FF)) + 0x00010000;
- *p++ = '\\';
- *p++ = 'U';
- *p++ = hexdigit[(ucs >> 28) & 0xf];
- *p++ = hexdigit[(ucs >> 24) & 0xf];
- *p++ = hexdigit[(ucs >> 20) & 0xf];
- *p++ = hexdigit[(ucs >> 16) & 0xf];
- *p++ = hexdigit[(ucs >> 12) & 0xf];
- *p++ = hexdigit[(ucs >> 8) & 0xf];
- *p++ = hexdigit[(ucs >> 4) & 0xf];
- *p++ = hexdigit[ucs & 0xf];
- continue;
+ /* Map 32-bit characters to '\Uxxxxxxxx' */
+ if (ch >= 0x10000) {
+ *p++ = '\\';
+ *p++ = 'U';
+ *p++ = hexdigit[(ch >> 28) & 0xf];
+ *p++ = hexdigit[(ch >> 24) & 0xf];
+ *p++ = hexdigit[(ch >> 20) & 0xf];
+ *p++ = hexdigit[(ch >> 16) & 0xf];
+ *p++ = hexdigit[(ch >> 12) & 0xf];
+ *p++ = hexdigit[(ch >> 8) & 0xf];
+ *p++ = hexdigit[(ch >> 4) & 0xf];
+ *p++ = hexdigit[ch & 15];
}
- /* Fall through: isolated surrogates are copied as-is */
- s--;
- size++;
- }
+ else
+#else
+ /* Map UTF-16 surrogate pairs to '\U00xxxxxx' */
+ if (ch >= 0xD800 && ch < 0xDC00) {
+ Py_UNICODE ch2;
+ Py_UCS4 ucs;
+
+ ch2 = *s++;
+ size--;
+ if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) {
+ ucs = (((ch & 0x03FF) << 10) | (ch2 & 0x03FF)) + 0x00010000;
+ *p++ = '\\';
+ *p++ = 'U';
+ *p++ = hexdigit[(ucs >> 28) & 0xf];
+ *p++ = hexdigit[(ucs >> 24) & 0xf];
+ *p++ = hexdigit[(ucs >> 20) & 0xf];
+ *p++ = hexdigit[(ucs >> 16) & 0xf];
+ *p++ = hexdigit[(ucs >> 12) & 0xf];
+ *p++ = hexdigit[(ucs >> 8) & 0xf];
+ *p++ = hexdigit[(ucs >> 4) & 0xf];
+ *p++ = hexdigit[ucs & 0xf];
+ continue;
+ }
+ /* Fall through: isolated surrogates are copied as-is */
+ s--;
+ size++;
+ }
#endif
- /* Map 16-bit characters to '\uxxxx' */
- if (ch >= 256 || ch == '\\' || ch == '\n') {
- *p++ = '\\';
- *p++ = 'u';
- *p++ = hexdigit[(ch >> 12) & 0xf];
- *p++ = hexdigit[(ch >> 8) & 0xf];
- *p++ = hexdigit[(ch >> 4) & 0xf];
- *p++ = hexdigit[ch & 15];
- }
- /* Copy everything else as-is */
- else
- *p++ = (char) ch;
+ /* Map 16-bit characters to '\uxxxx' */
+ if (ch >= 256 || ch == '\\' || ch == '\n') {
+ *p++ = '\\';
+ *p++ = 'u';
+ *p++ = hexdigit[(ch >> 12) & 0xf];
+ *p++ = hexdigit[(ch >> 8) & 0xf];
+ *p++ = hexdigit[(ch >> 4) & 0xf];
+ *p++ = hexdigit[ch & 15];
+ }
+ /* Copy everything else as-is */
+ else
+ *p++ = (char) ch;
}
*p = '\0';
_PyString_Resize(&repr, p - q);
diff --git a/Modules/cStringIO.c b/Modules/cStringIO.c
index 5b78789..ce62f40 100644
--- a/Modules/cStringIO.c
+++ b/Modules/cStringIO.c
@@ -496,17 +496,17 @@
Py_DECREF(it);
Py_DECREF(s);
return NULL;
- }
- Py_DECREF(s);
- }
+ }
+ Py_DECREF(s);
+ }
- Py_DECREF(it);
+ Py_DECREF(it);
- /* See if PyIter_Next failed */
- if (PyErr_Occurred())
- return NULL;
+ /* See if PyIter_Next failed */
+ if (PyErr_Occurred())
+ return NULL;
- Py_RETURN_NONE;
+ Py_RETURN_NONE;
}
static struct PyMethodDef O_methods[] = {
/* Common methods: */
diff --git a/Modules/clmodule.c b/Modules/clmodule.c
index e5d568f..2179bcd 100644
--- a/Modules/clmodule.c
+++ b/Modules/clmodule.c
@@ -964,7 +964,7 @@
if (PyErr_WarnPy3k("the cl module has been removed in "
"Python 3.0", 2) < 0)
- return;
+ return;
m = Py_InitModule("cl", cl_methods);
if (m == NULL)
diff --git a/Modules/dlmodule.c b/Modules/dlmodule.c
index c349ad0..dfecf9d 100644
--- a/Modules/dlmodule.c
+++ b/Modules/dlmodule.c
@@ -240,7 +240,7 @@
if (PyErr_WarnPy3k("the dl module has been removed in "
"Python 3.0; use the ctypes module instead", 2) < 0)
- return;
+ return;
/* Initialize object type */
Py_TYPE(&Dltype) = &PyType_Type;
diff --git a/Modules/fcntlmodule.c b/Modules/fcntlmodule.c
index 9d8b587..988d942 100644
--- a/Modules/fcntlmodule.c
+++ b/Modules/fcntlmodule.c
@@ -21,7 +21,7 @@
int fd = PyObject_AsFileDescriptor(object);
if (fd < 0)
- return 0;
+ return 0;
*target = fd;
return 1;
}
diff --git a/Modules/flmodule.c b/Modules/flmodule.c
index 0ddf600..a21489e 100644
--- a/Modules/flmodule.c
+++ b/Modules/flmodule.c
@@ -151,9 +151,9 @@
g->ob_callback_arg = NULL;
}
else {
- PyObject *a, *b;
- if (!PyArg_UnpackTuple(args, "set_call_back", 2, 2, &a, &b))
- return NULL;
+ PyObject *a, *b;
+ if (!PyArg_UnpackTuple(args, "set_call_back", 2, 2, &a, &b))
+ return NULL;
Py_XDECREF(g->ob_callback);
Py_XDECREF(g->ob_callback_arg);
g->ob_callback = a;
@@ -2124,10 +2124,9 @@
PyMODINIT_FUNC
initfl(void)
{
-
if (PyErr_WarnPy3k("the fl module has been removed in "
"Python 3.0", 2) < 0)
- return;
+ return;
Py_InitModule("fl", forms_methods);
if (m == NULL)
diff --git a/Modules/fmmodule.c b/Modules/fmmodule.c
index 3a74107..bf3b330 100644
--- a/Modules/fmmodule.c
+++ b/Modules/fmmodule.c
@@ -257,10 +257,9 @@
void
initfm(void)
{
-
if (PyErr_WarnPy3k("the fm module has been removed in "
"Python 3.0", 2) < 0)
- return;
+ return;
Py_InitModule("fm", fm_methods);
if (m == NULL)
diff --git a/Modules/glmodule.c b/Modules/glmodule.c
index b9c64fb..9609378 100644
--- a/Modules/glmodule.c
+++ b/Modules/glmodule.c
@@ -7624,10 +7624,9 @@
void
initgl(void)
{
-
if (PyErr_WarnPy3k("the gl module has been removed in "
"Python 3.0", 2) < 0)
- return;
+ return;
(void) Py_InitModule("gl", gl_methods);
}
diff --git a/Modules/main.c b/Modules/main.c
index ef9b245..44217c6 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -153,15 +153,15 @@
(void) PyRun_SimpleFileExFlags(fp, startup, 0, cf);
PyErr_Clear();
fclose(fp);
- } else {
- int save_errno;
- save_errno = errno;
- PySys_WriteStderr("Could not open PYTHONSTARTUP\n");
- errno = save_errno;
- PyErr_SetFromErrnoWithFilename(PyExc_IOError,
- startup);
- PyErr_Print();
- PyErr_Clear();
+ } else {
+ int save_errno;
+ save_errno = errno;
+ PySys_WriteStderr("Could not open PYTHONSTARTUP\n");
+ errno = save_errno;
+ PyErr_SetFromErrnoWithFilename(PyExc_IOError,
+ startup);
+ PyErr_Print();
+ PyErr_Clear();
}
}
}
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index c0e17f3..1d7ba4b 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -126,18 +126,18 @@
r = PyTuple_New(2);
if (r == NULL)
- return NULL;
+ return NULL;
if(!(v = PyFloat_FromDouble(double_from_timeval(&iv->it_value)))) {
- Py_DECREF(r);
- return NULL;
+ Py_DECREF(r);
+ return NULL;
}
PyTuple_SET_ITEM(r, 0, v);
if(!(v = PyFloat_FromDouble(double_from_timeval(&iv->it_interval)))) {
- Py_DECREF(r);
- return NULL;
+ Py_DECREF(r);
+ return NULL;
}
PyTuple_SET_ITEM(r, 1, v);
@@ -455,14 +455,14 @@
struct itimerval new, old;
if(!PyArg_ParseTuple(args, "id|d:setitimer", &which, &first, &interval))
- return NULL;
+ return NULL;
timeval_from_double(first, &new.it_value);
timeval_from_double(interval, &new.it_interval);
/* Let OS check "which" value */
if (setitimer(which, &new, &old) != 0) {
- PyErr_SetFromErrno(ItimerError);
- return NULL;
+ PyErr_SetFromErrno(ItimerError);
+ return NULL;
}
return itimer_retval(&old);
@@ -488,11 +488,11 @@
struct itimerval old;
if (!PyArg_ParseTuple(args, "i:getitimer", &which))
- return NULL;
+ return NULL;
if (getitimer(which, &old) != 0) {
- PyErr_SetFromErrno(ItimerError);
- return NULL;
+ PyErr_SetFromErrno(ItimerError);
+ return NULL;
}
return itimer_retval(&old);
@@ -834,9 +834,9 @@
#if defined (HAVE_SETITIMER) || defined (HAVE_GETITIMER)
ItimerError = PyErr_NewException("signal.ItimerError",
- PyExc_IOError, NULL);
+ PyExc_IOError, NULL);
if (ItimerError != NULL)
- PyDict_SetItemString(d, "ItimerError", ItimerError);
+ PyDict_SetItemString(d, "ItimerError", ItimerError);
#endif
#ifdef CTRL_C_EVENT
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 9c5fa54..c046178 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -1637,12 +1637,13 @@
return 1;
}
#endif /* AF_UNIX */
+
#if defined(AF_NETLINK)
- case AF_NETLINK:
- {
- *len_ret = sizeof (struct sockaddr_nl);
- return 1;
- }
+ case AF_NETLINK:
+ {
+ *len_ret = sizeof (struct sockaddr_nl);
+ return 1;
+ }
#endif
case AF_INET:
diff --git a/Modules/timingmodule.c b/Modules/timingmodule.c
index a4e2c7e..c19dafd 100644
--- a/Modules/timingmodule.c
+++ b/Modules/timingmodule.c
@@ -56,7 +56,7 @@
{
if (PyErr_WarnPy3k("the timing module has been removed in "
"Python 3.0; use time.clock() instead", 2) < 0)
- return;
+ return;
(void)Py_InitModule("timing", timing_methods);
}