diff --git a/Doc/includes/noddy.c b/Doc/includes/noddy.c index 8f79fcf6bf4..19a27a89e88 100644 --- a/Doc/includes/noddy.c +++ b/Doc/includes/noddy.c @@ -38,7 +38,7 @@ static PyModuleDef noddymodule = { }; PyMODINIT_FUNC -PyInit_noddy(void) +PyInit_noddy(void) { PyObject* m; diff --git a/Include/codecs.h b/Include/codecs.h index 466913540fd..9e4f3050952 100644 --- a/Include/codecs.h +++ b/Include/codecs.h @@ -71,7 +71,7 @@ PyAPI_FUNC(int) PyCodec_KnownEncoding( object is passed through the encoder function found for the given encoding using the error handling method defined by errors. errors may be NULL to use the default method defined for the codec. - + Raises a LookupError in case no encoder can be found. */ @@ -87,7 +87,7 @@ PyAPI_FUNC(PyObject *) PyCodec_Encode( object is passed through the decoder function found for the given encoding using the error handling method defined by errors. errors may be NULL to use the default method defined for the codec. - + Raises a LookupError in case no encoder can be found. */ @@ -145,7 +145,7 @@ PyAPI_FUNC(PyObject *) _PyCodecInfo_GetIncrementalEncoder( -/* --- Codec Lookup APIs -------------------------------------------------- +/* --- Codec Lookup APIs -------------------------------------------------- All APIs return a codec object with incremented refcount and are based on _PyCodec_Lookup(). The same comments w/r to the encoding diff --git a/Include/sliceobject.h b/Include/sliceobject.h index f7ee90c3cc8..26370e01757 100644 --- a/Include/sliceobject.h +++ b/Include/sliceobject.h @@ -41,7 +41,7 @@ PyAPI_FUNC(int) _PySlice_GetLongIndices(PySliceObject *self, PyObject *length, PyAPI_FUNC(int) PySlice_GetIndices(PyObject *r, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step); PyAPI_FUNC(int) PySlice_GetIndicesEx(PyObject *r, Py_ssize_t length, - Py_ssize_t *start, Py_ssize_t *stop, + Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, Py_ssize_t *slicelength); #ifdef __cplusplus diff --git a/Include/ucnhash.h b/Include/ucnhash.h index 8de9ba0cff7..45362e997df 100644 --- a/Include/ucnhash.h +++ b/Include/ucnhash.h @@ -16,7 +16,7 @@ typedef struct { int size; /* Get name for a given character code. Returns non-zero if - success, zero if not. Does not set Python exceptions. + success, zero if not. Does not set Python exceptions. If self is NULL, data come from the default version of the database. If it is not NULL, it should be a unicodedata.ucd_X_Y_Z object */ int (*getname)(PyObject *self, Py_UCS4 code, char* buffer, int buflen, diff --git a/Modules/_bz2module.c b/Modules/_bz2module.c index f284cd611d5..51da7aeaec1 100644 --- a/Modules/_bz2module.c +++ b/Modules/_bz2module.c @@ -666,7 +666,7 @@ _bz2_BZ2Decompressor___init___impl(BZ2Decompressor *self) self->unused_data = PyBytes_FromStringAndSize(NULL, 0); if (self->unused_data == NULL) goto error; - + bzerror = BZ2_bzDecompressInit(&self->bzs, 0, 0); if (catch_bz2_error(bzerror)) goto error; diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c index 370bb5ec453..358a94dce27 100644 --- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -1055,7 +1055,7 @@ _buffered_readinto_generic(buffered *self, PyObject *args, char readinto1) } else n = 0; - + if (n == 0 || (n == -2 && written > 0)) break; if (n < 0) { @@ -1065,7 +1065,7 @@ _buffered_readinto_generic(buffered *self, PyObject *args, char readinto1) } goto end; } - + /* At most one read in readinto1 mode */ if (readinto1) { written += n; diff --git a/Modules/_lzmamodule.c b/Modules/_lzmamodule.c index bae7df6e130..9abdf63c74e 100644 --- a/Modules/_lzmamodule.c +++ b/Modules/_lzmamodule.c @@ -149,10 +149,10 @@ grow_buffer(PyObject **buf, Py_ssize_t max_length) { Py_ssize_t size = PyBytes_GET_SIZE(*buf); Py_ssize_t newsize = size + (size >> 3) + 6; - + if (max_length > 0 && newsize > max_length) newsize = max_length; - + return _PyBytes_Resize(buf, newsize); } @@ -906,7 +906,7 @@ decompress_buf(Decompressor *d, Py_ssize_t max_length) Py_ssize_t data_size = 0; PyObject *result; lzma_stream *lzs = &d->lzs; - + if (max_length < 0 || max_length >= INITIAL_BUFFER_SIZE) result = PyBytes_FromStringAndSize(NULL, INITIAL_BUFFER_SIZE); else @@ -916,7 +916,7 @@ decompress_buf(Decompressor *d, Py_ssize_t max_length) lzs->next_out = (uint8_t *)PyBytes_AS_STRING(result); lzs->avail_out = PyBytes_GET_SIZE(result); - + for (;;) { lzma_ret lzret; @@ -947,7 +947,7 @@ decompress_buf(Decompressor *d, Py_ssize_t max_length) goto error; return result; - + error: Py_XDECREF(result); return NULL; @@ -959,11 +959,11 @@ decompress(Decompressor *d, uint8_t *data, size_t len, Py_ssize_t max_length) char input_buffer_in_use; PyObject *result; lzma_stream *lzs = &d->lzs; - + /* Prepend unconsumed input if necessary */ if (lzs->next_in != NULL) { size_t avail_now, avail_total; - + /* Number of bytes we can append to input buffer */ avail_now = (d->input_buffer + d->input_buffer_size) - (lzs->next_in + lzs->avail_in); @@ -987,7 +987,7 @@ decompress(Decompressor *d, uint8_t *data, size_t len, Py_ssize_t max_length) } d->input_buffer = tmp; d->input_buffer_size = new_size; - + lzs->next_in = d->input_buffer + offset; } else if (avail_now < len) { @@ -1054,7 +1054,7 @@ decompress(Decompressor *d, uint8_t *data, size_t len, Py_ssize_t max_length) lzs->next_in = d->input_buffer; } } - + return result; error: @@ -1247,7 +1247,7 @@ Decompressor_dealloc(Decompressor *self) { if(self->input_buffer != NULL) PyMem_Free(self->input_buffer); - + lzma_end(&self->lzs); Py_CLEAR(self->unused_data); #ifdef WITH_THREAD diff --git a/Modules/_sqlite/microprotocols.h b/Modules/_sqlite/microprotocols.h index 3a9944fc794..6941716c4cf 100644 --- a/Modules/_sqlite/microprotocols.h +++ b/Modules/_sqlite/microprotocols.h @@ -48,7 +48,7 @@ extern PyObject *pysqlite_microprotocols_adapt( PyObject *obj, PyObject *proto, PyObject *alt); extern PyObject * - pysqlite_adapt(pysqlite_Cursor* self, PyObject *args); + pysqlite_adapt(pysqlite_Cursor* self, PyObject *args); #define pysqlite_adapt_doc \ "adapt(obj, protocol, alternate) -> adapt obj to given protocol. Non-standard." diff --git a/Modules/_testbuffer.c b/Modules/_testbuffer.c index de7b567c697..43db8a8e53a 100644 --- a/Modules/_testbuffer.c +++ b/Modules/_testbuffer.c @@ -190,7 +190,7 @@ ndbuf_delete(NDArrayObject *nd, ndbuf_t *elt) elt->prev->next = elt->next; else nd->head = elt->next; - + if (elt->next) elt->next->prev = elt->prev; @@ -767,7 +767,7 @@ out: +-----------------+-----------+-------------+----------------+ | base.readonly | 0 | OK | OK | +-----------------+-----------+-------------+----------------+ - | base.format | NULL | OK | OK | + | base.format | NULL | OK | OK | +-----------------+-----------+-------------+----------------+ | base.ndim | 1 | 1 | OK | +-----------------+-----------+-------------+----------------+ @@ -2018,7 +2018,7 @@ ndarray_get_obj(NDArrayObject *self, void *closure) { Py_buffer *base = &self->head->base; - if (base->obj == NULL) { + if (base->obj == NULL) { Py_RETURN_NONE; } Py_INCREF(base->obj); @@ -2558,7 +2558,7 @@ result: PyBuffer_Release(&v1); PyBuffer_Release(&v2); - ret = equal ? Py_True : Py_False; + ret = equal ? Py_True : Py_False; Py_INCREF(ret); return ret; } diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index a8ce0dc4eb3..df35197198d 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -2476,7 +2476,7 @@ make_memoryview_from_NULL_pointer(PyObject *self) return NULL; return PyMemoryView_FromBuffer(&info); } - + static PyObject * test_from_contiguous(PyObject* self, PyObject *noargs) { diff --git a/Modules/atexitmodule.c b/Modules/atexitmodule.c index 79e9962fc2a..739c18836f9 100644 --- a/Modules/atexitmodule.c +++ b/Modules/atexitmodule.c @@ -94,7 +94,7 @@ atexit_callfuncs(void) if (exc_type) { Py_DECREF(exc_type); Py_XDECREF(exc_value); - Py_XDECREF(exc_tb); + Py_XDECREF(exc_tb); } PyErr_Fetch(&exc_type, &exc_value, &exc_tb); if (!PyErr_ExceptionMatches(PyExc_SystemExit)) { @@ -147,7 +147,7 @@ atexit_register(PyObject *self, PyObject *args, PyObject *kwargs) if (PyTuple_GET_SIZE(args) == 0) { PyErr_SetString(PyExc_TypeError, "register() takes at least 1 argument (0 given)"); - return NULL; + return NULL; } func = PyTuple_GET_ITEM(args, 0); @@ -159,7 +159,7 @@ atexit_register(PyObject *self, PyObject *args, PyObject *kwargs) new_callback = PyMem_Malloc(sizeof(atexit_callback)); if (new_callback == NULL) - return PyErr_NoMemory(); + return PyErr_NoMemory(); new_callback->args = PyTuple_GetSlice(args, 1, PyTuple_GET_SIZE(args)); if (new_callback->args == NULL) { @@ -336,7 +336,7 @@ PyInit_atexit(void) modstate = GET_ATEXIT_STATE(m); modstate->callback_len = 32; modstate->ncallbacks = 0; - modstate->atexit_callbacks = PyMem_New(atexit_callback*, + modstate->atexit_callbacks = PyMem_New(atexit_callback*, modstate->callback_len); if (modstate->atexit_callbacks == NULL) return NULL; diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c index 36e9893da84..56ee4453385 100644 --- a/Modules/parsermodule.c +++ b/Modules/parsermodule.c @@ -2788,7 +2788,7 @@ validate_argument(node *tree) int nch = NCH(tree); int res = (validate_ntype(tree, argument) && ((nch == 1) || (nch == 2) || (nch == 3))); - if (res) + if (res) res = validate_test(CHILD(tree, 0)); if (res && (nch == 2)) res = validate_comp_for(CHILD(tree, 1)); diff --git a/Modules/xxlimited.c b/Modules/xxlimited.c index eecdab96975..7bfcb911e45 100644 --- a/Modules/xxlimited.c +++ b/Modules/xxlimited.c @@ -169,7 +169,7 @@ xx_roj(PyObject *self, PyObject *args) /* ---------- */ -static PyType_Slot Str_Type_slots[] = { +static PyType_Slot Str_Type_slots[] = { {Py_tp_base, NULL}, /* filled out in module init function */ {0, 0}, }; diff --git a/Objects/classobject.c b/Objects/classobject.c index 07cb6395b41..5e8ac59df25 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -260,7 +260,7 @@ method_repr(PyMethodObject *a) PyErr_Clear(); } } - + if (funcname != NULL && !PyUnicode_Check(funcname)) { Py_DECREF(funcname); funcname = NULL; diff --git a/Objects/iterobject.c b/Objects/iterobject.c index 77ff8106fd2..baa51da1a75 100644 --- a/Objects/iterobject.c +++ b/Objects/iterobject.c @@ -212,7 +212,7 @@ calliter_iternext(calliterobject *it) Py_DECREF(args); if (result != NULL) { int ok; - ok = PyObject_RichCompareBool(it->it_sentinel, result, Py_EQ); + ok = PyObject_RichCompareBool(it->it_sentinel, result, Py_EQ); if (ok == 0) return result; /* Common case, fast path */ Py_DECREF(result); diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c index b611dc864ce..6142b4cf739 100644 --- a/Objects/memoryobject.c +++ b/Objects/memoryobject.c @@ -892,7 +892,7 @@ memory_from_contiguous_copy(Py_buffer *src, char order) The logical structure of the input and output buffers is the same (i.e. tolist(input) == tolist(output)), but the physical layout in memory can be explicitly chosen. - + As usual, if buffertype=PyBUF_WRITE, the exporter's buffer must be writable, otherwise it may be writable or read-only. @@ -1241,7 +1241,7 @@ cast_to_1D(PyMemoryViewObject *mv, PyObject *format) view->suboffsets = NULL; init_flags(mv); - + ret = 0; out: @@ -2288,7 +2288,7 @@ memory_subscript(PyMemoryViewObject *self, PyObject *key) { Py_buffer *view; view = &(self->view); - + CHECK_RELEASED(self); if (view->ndim == 0) { diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c index 441e73111b7..dca5e58c44a 100644 --- a/Objects/moduleobject.c +++ b/Objects/moduleobject.c @@ -37,7 +37,7 @@ module_init_dict(PyModuleObject *mod, PyObject *md_dict, _Py_IDENTIFIER(__package__); _Py_IDENTIFIER(__loader__); _Py_IDENTIFIER(__spec__); - + if (md_dict == NULL) return -1; if (doc == NULL) diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c index 7e6c733f3e2..0f8cd60a620 100644 --- a/Objects/rangeobject.c +++ b/Objects/rangeobject.c @@ -987,7 +987,7 @@ static PyObject * longrangeiter_setstate(longrangeiterobject *r, PyObject *state) { int cmp; - + /* clip the value */ PyObject *zero = PyLong_FromLong(0); if (zero == NULL) @@ -1007,7 +1007,7 @@ longrangeiter_setstate(longrangeiterobject *r, PyObject *state) return NULL; if (cmp > 0) state = r->len; - + Py_CLEAR(r->index); r->index = state; Py_INCREF(r->index); diff --git a/Objects/stringlib/transmogrify.h b/Objects/stringlib/transmogrify.h index cae6ea113a1..b559b5356b8 100644 --- a/Objects/stringlib/transmogrify.h +++ b/Objects/stringlib/transmogrify.h @@ -59,7 +59,7 @@ stringlib_expandtabs(PyObject *self, PyObject *args, PyObject *kwds) j = 0; q = STRINGLIB_STR(u); - + for (p = STRINGLIB_STR(self); p < e; p++) { if (*p == '\t') { if (tabsize > 0) { diff --git a/Objects/unicodectype.c b/Objects/unicodectype.c index ea540d605de..d8c95c8b44c 100644 --- a/Objects/unicodectype.c +++ b/Objects/unicodectype.c @@ -27,7 +27,7 @@ #define EXTENDED_CASE_MASK 0x4000 typedef struct { - /* + /* These are either deltas to the character or offsets in _PyUnicode_ExtendedCase. */ diff --git a/PC/launcher.c b/PC/launcher.c index 15230207790..fada4c9c16a 100644 --- a/PC/launcher.c +++ b/PC/launcher.c @@ -96,7 +96,7 @@ error(int rc, wchar_t * format, ... ) fwprintf(stderr, L"%ls\n", message); #else MessageBox(NULL, message, TEXT("Python Launcher is sorry to say ..."), - MB_OK); + MB_OK); #endif ExitProcess(rc); } @@ -349,7 +349,7 @@ locate_all_pythons() locate_pythons_for_key(HKEY_CURRENT_USER, KEY_READ | KEY_WOW64_64KEY); locate_pythons_for_key(HKEY_LOCAL_MACHINE, KEY_READ | KEY_WOW64_64KEY); } -#endif +#endif // now hit the "native" key for this process bittedness. debug(L"locating Pythons in native registry\n"); locate_pythons_for_key(HKEY_CURRENT_USER, KEY_READ); @@ -604,7 +604,7 @@ run_child(wchar_t * cmdline) // window, or fetching a message). As this launcher doesn't do this // directly, that cursor remains even after the child process does these // things. We avoid that by doing a simple post+get message. - // See http://bugs.python.org/issue17290 and + // See http://bugs.python.org/issue17290 and // https://bitbucket.org/vinay.sajip/pylauncher/issue/20/busy-cursor-for-a-long-time-when-running MSG msg; diff --git a/Python/ceval_gil.h b/Python/ceval_gil.h index 4db56b6f5cb..aafcbc2bc9c 100644 --- a/Python/ceval_gil.h +++ b/Python/ceval_gil.h @@ -31,7 +31,7 @@ static unsigned long gil_interval = DEFAULT_INTERVAL; variable (gil_drop_request) is used for that purpose, which is checked at every turn of the eval loop. That variable is set after a wait of `interval` microseconds on `gil_cond` has timed out. - + [Actually, another volatile boolean variable (eval_breaker) is used which ORs several conditions into one. Volatile booleans are sufficient as inter-thread signalling means since Python is run @@ -41,7 +41,7 @@ static unsigned long gil_interval = DEFAULT_INTERVAL; time (`interval` microseconds) before setting gil_drop_request. This encourages a defined switching period, but doesn't enforce it since opcodes can take an arbitrary time to execute. - + The `interval` value is available for the user to read and modify using the Python API `sys.{get,set}switchinterval()`. @@ -51,7 +51,7 @@ static unsigned long gil_interval = DEFAULT_INTERVAL; the value of gil_last_holder is changed to something else than its own thread state pointer, indicating that another thread was able to take the GIL. - + This is meant to prohibit the latency-adverse behaviour on multi-core machines where one thread would speculatively release the GIL, but still run and end up being the first to re-acquire it, making the "timeslices" @@ -186,7 +186,7 @@ static void drop_gil(PyThreadState *tstate) _Py_atomic_store_relaxed(&gil_locked, 0); COND_SIGNAL(gil_cond); MUTEX_UNLOCK(gil_mutex); - + #ifdef FORCE_SWITCHING if (_Py_atomic_load_relaxed(&gil_drop_request) && tstate != NULL) { MUTEX_LOCK(switch_mutex); @@ -215,7 +215,7 @@ static void take_gil(PyThreadState *tstate) if (!_Py_atomic_load_relaxed(&gil_locked)) goto _ready; - + while (_Py_atomic_load_relaxed(&gil_locked)) { int timed_out = 0; unsigned long saved_switchnum; @@ -254,7 +254,7 @@ _ready: if (tstate->async_exc != NULL) { _PyEval_SignalAsyncExc(); } - + MUTEX_UNLOCK(gil_mutex); errno = err; } diff --git a/Python/condvar.h b/Python/condvar.h index ef818c4d4b5..bb5b1b661f1 100644 --- a/Python/condvar.h +++ b/Python/condvar.h @@ -1,4 +1,4 @@ -/* +/* * Portable condition variable support for windows and pthreads. * Everything is inline, this header can be included where needed. * @@ -105,7 +105,7 @@ PyCOND_TIMEDWAIT(PyCOND_T *cond, PyMUTEX_T *mut, PY_LONG_LONG us) return 1; else if (r) return -1; - else + else return 0; } @@ -255,7 +255,7 @@ _PyCOND_WAIT_MS(PyCOND_T *cv, PyMUTEX_T *cs, DWORD ms) * a new thread comes along, it will pass right throuhgh, having * adjusted it to (waiting == 0 && sem.count == 0). */ - + if (wait == WAIT_FAILED) return -1; /* return 0 on success, 1 on timeout */ diff --git a/Python/pyfpe.c b/Python/pyfpe.c index 4b7f5bae159..ab0ef83ead0 100644 --- a/Python/pyfpe.c +++ b/Python/pyfpe.c @@ -1,6 +1,6 @@ #include "pyconfig.h" #include "pyfpe.h" -/* +/* * The signal handler for SIGFPE is actually declared in an external * module fpectl, or as preferred by the user. These variable * definitions are required in order to compile Python without @@ -13,7 +13,7 @@ jmp_buf PyFPE_jbuf; int PyFPE_counter = 0; #endif -/* Have this outside the above #ifdef, since some picky ANSI compilers issue a +/* Have this outside the above #ifdef, since some picky ANSI compilers issue a warning when compiling an empty file. */ double diff --git a/Python/pystate.c b/Python/pystate.c index ee1e469635d..926ef07e211 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -228,7 +228,7 @@ new_threadstate(PyInterpreterState *interp, int init) tstate->next->prev = tstate; interp->tstate_head = tstate; HEAD_UNLOCK(); - + #if defined _MSC_VER && _MSC_VER >= 1900 /* Issue #23524: Temporary fix to disable termination due to invalid parameters */ _set_thread_local_invalid_parameter_handler((_invalid_parameter_handler)_Py_silent_invalid_parameter_handler);