]> granicus.if.org Git - python/commitdiff
Issue #24366: Fix indentation
authorMartin Panter <vadmium+py@gmail.com>
Thu, 15 Sep 2016 01:50:53 +0000 (01:50 +0000)
committerMartin Panter <vadmium+py@gmail.com>
Thu, 15 Sep 2016 01:50:53 +0000 (01:50 +0000)
Backports changes by Victor Stinner, Hirokazu Yamamoto, li4ick and Benjamin
Peterson.

Modules/cjkcodecs/multibytecodec.c
Modules/zipimport.c
PC/winsound.c
Python/pymath.c
Python/symtable.c

index 2f2eb5276744ed4d15357a1b4e8fd4da74724324..871362800ef497d3ad5786489412125cff56f38b 100644 (file)
@@ -1275,19 +1275,19 @@ mbstreamreader_iread(MultibyteStreamReaderObject *self,
             if (PyString_GET_SIZE(cres) > PY_SSIZE_T_MAX - self->pendingsize) {
                 PyErr_NoMemory();
                 goto errorexit;
-        }
-                    rsize = PyString_GET_SIZE(cres) + self->pendingsize;
-                    ctr = PyString_FromStringAndSize(NULL, rsize);
-                    if (ctr == NULL)
-                            goto errorexit;
-                    ctrdata = PyString_AS_STRING(ctr);
-                    memcpy(ctrdata, self->pending, self->pendingsize);
-                    memcpy(ctrdata + self->pendingsize,
-                            PyString_AS_STRING(cres),
-                            PyString_GET_SIZE(cres));
-                    Py_DECREF(cres);
-                    cres = ctr;
-                    self->pendingsize = 0;
+            }
+            rsize = PyString_GET_SIZE(cres) + self->pendingsize;
+            ctr = PyString_FromStringAndSize(NULL, rsize);
+            if (ctr == NULL)
+                goto errorexit;
+            ctrdata = PyString_AS_STRING(ctr);
+            memcpy(ctrdata, self->pending, self->pendingsize);
+            memcpy(ctrdata + self->pendingsize,
+                    PyString_AS_STRING(cres),
+                    PyString_GET_SIZE(cres));
+            Py_DECREF(cres);
+            cres = ctr;
+            self->pendingsize = 0;
         }
 
         rsize = PyString_GET_SIZE(cres);
index 83629839d19c88f2dfe052bb502b695f2d28df63..1691773ec10f2dd274eca9e27094725c4ca0d734 100644 (file)
@@ -380,13 +380,13 @@ zipimporter_get_filename(PyObject *obj, PyObject *args)
 
     if (!PyArg_ParseTuple(args, "s:zipimporter.get_filename",
                          &fullname))
-    return NULL;
+        return NULL;
 
     /* Deciding the filename requires working out where the code
        would come from if the module was actually loaded */
     code = get_module_code(self, fullname, &ispackage, &modpath);
     if (code == NULL)
-    return NULL;
+        return NULL;
     Py_DECREF(code); /* Only need the path info */
 
     return PyString_FromString(modpath);
@@ -689,7 +689,7 @@ set_file_error(const char *archive, int eof)
 
    A toc_entry is a tuple:
 
-       (__file__,      # value to use for __file__, available for all files
+   (__file__,      # value to use for __file__, available for all files
     compress,      # compression kind; 0 for uncompressed
     data_size,     # size of compressed data on disk
     file_size,     # size of decompressed data
@@ -697,7 +697,7 @@ set_file_error(const char *archive, int eof)
     time,          # mod time of file (in dos format)
     date,          # mod data of file (in dos format)
     crc,           # crc checksum of the data
-       )
+   )
 
    Directories can be recognized by the trailing SEP in the name,
    data_size and file_offset are 0.
index 05305d2a4fcc88ae85560e3db15167f3ede71a2f..f3c5be4e88779de2cc0f9638ced1e526e6bc0a7a 100644 (file)
@@ -77,24 +77,23 @@ sound_playsound(PyObject *s, PyObject *args)
     int length;
     int ok;
 
-    if(!PyArg_ParseTuple(args,"z#i:PlaySound",&sound,&length,&flags)) {
-    return NULL;
+    if (!PyArg_ParseTuple(args, "z#i:PlaySound", &sound, &length, &flags)) {
+        return NULL;
     }
 
-    if(flags&SND_ASYNC && flags &SND_MEMORY) {
-    /* Sidestep reference counting headache; unfortunately this also
-       prevent SND_LOOP from memory. */
-    PyErr_SetString(PyExc_RuntimeError,"Cannot play asynchronously from memory");
-    return NULL;
+    if (flags & SND_ASYNC && flags & SND_MEMORY) {
+        /* Sidestep reference counting headache; unfortunately this also
+           prevent SND_LOOP from memory. */
+        PyErr_SetString(PyExc_RuntimeError, "Cannot play asynchronously from memory");
+        return NULL;
     }
 
     Py_BEGIN_ALLOW_THREADS
-    ok = PlaySound(sound,NULL,flags);
+    ok = PlaySound(sound, NULL, flags);
     Py_END_ALLOW_THREADS
-    if(!ok)
-    {
-    PyErr_SetString(PyExc_RuntimeError,"Failed to play sound");
-    return NULL;
+    if (!ok) {
+        PyErr_SetString(PyExc_RuntimeError, "Failed to play sound");
+        return NULL;
     }
 
     Py_INCREF(Py_None);
@@ -151,11 +150,10 @@ static struct PyMethodDef sound_methods[] =
 static void
 add_define(PyObject *dict, const char *key, long value)
 {
-    PyObject *k=PyString_FromString(key);
-    PyObject *v=PyLong_FromLong(value);
-    if(v&&k)
-    {
-    PyDict_SetItem(dict,k,v);
+    PyObject *k = PyString_FromString(key);
+    PyObject *v = PyLong_FromLong(value);
+    if (v && k) {
+        PyDict_SetItem(dict, k, v);
     }
     Py_XDECREF(k);
     Py_XDECREF(v);
index 827a773a6a3efffb46896ee2985539723ead4922..6799d200caf60fc94945b6e13a4b9ddd001cc203 100644 (file)
@@ -73,7 +73,7 @@ round(double x)
     absx = fabs(x);
     y = floor(absx);
     if (absx - y >= 0.5)
-    y += 1.0;
+        y += 1.0;
     return copysign(y, x);
 }
 #endif /* HAVE_ROUND */
index 137f12ce66590f49cc1ffdcdd33f11d2befa3005..3b4247b4153efd162bcb5223946c3e4eec350627 100644 (file)
@@ -1421,11 +1421,11 @@ symtable_visit_alias(struct symtable *st, alias_ty a)
     }
     else {
         if (st->st_cur->ste_type != ModuleBlock) {
-        int lineno = st->st_cur->ste_lineno;
-        if (!symtable_warn(st, IMPORT_STAR_WARNING, lineno)) {
-            Py_DECREF(store_name);
-            return 0;
-        }
+            int lineno = st->st_cur->ste_lineno;
+            if (!symtable_warn(st, IMPORT_STAR_WARNING, lineno)) {
+                Py_DECREF(store_name);
+                return 0;
+            }
         }
         st->st_cur->ste_unoptimized |= OPT_IMPORT_STAR;
         Py_DECREF(store_name);