From: Martin Panter Date: Thu, 15 Sep 2016 01:50:53 +0000 (+0000) Subject: Issue #24366: Fix indentation X-Git-Tag: v2.7.13rc1~124 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5f75502a2ed490071514ab0361e1b406a7405de1;p=python Issue #24366: Fix indentation Backports changes by Victor Stinner, Hirokazu Yamamoto, li4ick and Benjamin Peterson. --- diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c index 2f2eb52767..871362800e 100644 --- a/Modules/cjkcodecs/multibytecodec.c +++ b/Modules/cjkcodecs/multibytecodec.c @@ -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); diff --git a/Modules/zipimport.c b/Modules/zipimport.c index 83629839d1..1691773ec1 100644 --- a/Modules/zipimport.c +++ b/Modules/zipimport.c @@ -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. diff --git a/PC/winsound.c b/PC/winsound.c index 05305d2a4f..f3c5be4e88 100644 --- a/PC/winsound.c +++ b/PC/winsound.c @@ -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); diff --git a/Python/pymath.c b/Python/pymath.c index 827a773a6a..6799d200ca 100644 --- a/Python/pymath.c +++ b/Python/pymath.c @@ -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 */ diff --git a/Python/symtable.c b/Python/symtable.c index 137f12ce66..3b4247b415 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -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);