[Python-checkins] cpython (2.7): Issue #24366: Fix indentation

martin.panter python-checkins at python.org
Thu Sep 15 21:12:22 EDT 2016


https://hg.python.org/cpython/rev/8aa93fd7db2d
changeset: 103850:8aa93fd7db2d
branch: 2.7
parent: 103801:fbc579ec36ab
user: Martin Panter <vadmium+py at gmail.com>
date: Thu Sep 15 01:50:53 2016 +0000
summary:
 Issue #24366: Fix indentation
Backports changes by Victor Stinner, Hirokazu Yamamoto, li4ick and Benjamin
Peterson.
files:
 Modules/cjkcodecs/multibytecodec.c | 26 +++++++-------
 Modules/zipimport.c | 8 ++--
 PC/winsound.c | 32 ++++++++---------
 Python/pymath.c | 2 +-
 Python/symtable.c | 10 ++--
 5 files changed, 38 insertions(+), 40 deletions(-)
diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c
--- a/Modules/cjkcodecs/multibytecodec.c
+++ b/Modules/cjkcodecs/multibytecodec.c
@@ -1275,19 +1275,19 @@
 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
--- a/Modules/zipimport.c
+++ b/Modules/zipimport.c
@@ -380,13 +380,13 @@
 
 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 @@
 
 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 @@
 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
--- a/PC/winsound.c
+++ b/PC/winsound.c
@@ -77,24 +77,23 @@
 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 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
--- a/Python/pymath.c
+++ b/Python/pymath.c
@@ -73,7 +73,7 @@
 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
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -1421,11 +1421,11 @@
 }
 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);
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /