diff options
Diffstat (limited to 'Objects')
| -rw-r--r-- | Objects/complexobject.c | 48 | ||||
| -rw-r--r-- | Objects/funcobject.c | 20 | ||||
| -rw-r--r-- | Objects/intobject.c | 4 | ||||
| -rw-r--r-- | Objects/rangeobject.c | 6 | ||||
| -rw-r--r-- | Objects/stringobject.c | 4 |
5 files changed, 43 insertions, 39 deletions
diff --git a/Objects/complexobject.c b/Objects/complexobject.c index c4e3895..ef18e3f 100644 --- a/Objects/complexobject.c +++ b/Objects/complexobject.c @@ -495,20 +495,20 @@ to_complex(PyObject **pobj, Py_complex *pc) pc->real = pc->imag = 0.0; if (PyInt_Check(obj)) { - pc->real = PyInt_AS_LONG(obj); - return 0; + pc->real = PyInt_AS_LONG(obj); + return 0; } if (PyLong_Check(obj)) { - pc->real = PyLong_AsDouble(obj); - if (pc->real == -1.0 && PyErr_Occurred()) { - *pobj = NULL; - return -1; - } - return 0; + pc->real = PyLong_AsDouble(obj); + if (pc->real == -1.0 && PyErr_Occurred()) { + *pobj = NULL; + return -1; + } + return 0; } if (PyFloat_Check(obj)) { - pc->real = PyFloat_AsDouble(obj); - return 0; + pc->real = PyFloat_AsDouble(obj); + return 0; } Py_INCREF(Py_NotImplemented); *pobj = Py_NotImplemented; @@ -909,25 +909,25 @@ complex__format__(PyObject* self, PyObject* args) PyObject *format_spec; if (!PyArg_ParseTuple(args, "O:__format__", &format_spec)) - return NULL; + return NULL; if (PyBytes_Check(format_spec)) - return _PyComplex_FormatAdvanced(self, - PyBytes_AS_STRING(format_spec), - PyBytes_GET_SIZE(format_spec)); + return _PyComplex_FormatAdvanced(self, + PyBytes_AS_STRING(format_spec), + PyBytes_GET_SIZE(format_spec)); if (PyUnicode_Check(format_spec)) { - /* Convert format_spec to a str */ - PyObject *result; - PyObject *str_spec = PyObject_Str(format_spec); + /* Convert format_spec to a str */ + PyObject *result; + PyObject *str_spec = PyObject_Str(format_spec); - if (str_spec == NULL) - return NULL; + if (str_spec == NULL) + return NULL; - result = _PyComplex_FormatAdvanced(self, - PyBytes_AS_STRING(str_spec), - PyBytes_GET_SIZE(str_spec)); + result = _PyComplex_FormatAdvanced(self, + PyBytes_AS_STRING(str_spec), + PyBytes_GET_SIZE(str_spec)); - Py_DECREF(str_spec); - return result; + Py_DECREF(str_spec); + return result; } PyErr_SetString(PyExc_TypeError, "__format__ requires str or unicode"); return NULL; diff --git a/Objects/funcobject.c b/Objects/funcobject.c index 0e76a44..c62de9c 100644 --- a/Objects/funcobject.c +++ b/Objects/funcobject.c @@ -590,8 +590,9 @@ PyTypeObject PyFunction_Type = { To declare a class method, use this idiom: class C: - def f(cls, arg1, arg2, ...): ... - f = classmethod(f) + @classmethod + def f(cls, arg1, arg2, ...): + ... It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()); the instance is ignored except for its class. @@ -676,8 +677,9 @@ just like an instance method receives the instance.\n\ To declare a class method, use this idiom:\n\ \n\ class C:\n\ - def f(cls, arg1, arg2, ...): ...\n\ - f = classmethod(f)\n\ + @classmethod\n\ + def f(cls, arg1, arg2, ...):\n\ + ...\n\ \n\ It can be called either on the class (e.g. C.f()) or on an instance\n\ (e.g. C().f()). The instance is ignored except for its class.\n\ @@ -748,8 +750,9 @@ PyClassMethod_New(PyObject *callable) To declare a static method, use this idiom: class C: - def f(arg1, arg2, ...): ... - f = staticmethod(f) + @staticmethod + def f(arg1, arg2, ...): + .... It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()); the instance is ignored except for its class. @@ -828,8 +831,9 @@ A static method does not receive an implicit first argument.\n\ To declare a static method, use this idiom:\n\ \n\ class C:\n\ - def f(arg1, arg2, ...): ...\n\ - f = staticmethod(f)\n\ + @staticmethod\n\ + def f(arg1, arg2, ...):\n\ + ...\n\ \n\ It can be called either on the class (e.g. C.f()) or on an instance\n\ (e.g. C().f()). The instance is ignored except for its class.\n\ diff --git a/Objects/intobject.c b/Objects/intobject.c index 41bb074..189413e 100644 --- a/Objects/intobject.c +++ b/Objects/intobject.c @@ -1461,8 +1461,8 @@ _PyInt_Init(void) int ival; #if NSMALLNEGINTS + NSMALLPOSINTS > 0 for (ival = -NSMALLNEGINTS; ival < NSMALLPOSINTS; ival++) { - if (!free_list && (free_list = fill_free_list()) == NULL) - return 0; + if (!free_list && (free_list = fill_free_list()) == NULL) + return 0; /* PyObject_New is inlined */ v = free_list; free_list = (PyIntObject *)Py_TYPE(v); diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c index 5203f40..baa8dee 100644 --- a/Objects/rangeobject.c +++ b/Objects/rangeobject.c @@ -30,11 +30,11 @@ get_len_of_range(long lo, long hi, long step) ---------------------------------------------------------------*/ assert(step != 0); if (step > 0 && lo < hi) - return 1UL + (hi - 1UL - lo) / step; + return 1UL + (hi - 1UL - lo) / step; else if (step < 0 && lo > hi) - return 1UL + (lo - 1UL - hi) / (0UL - step); + return 1UL + (lo - 1UL - hi) / (0UL - step); else - return 0UL; + return 0UL; } /* Return a stop value suitable for reconstructing the xrange from diff --git a/Objects/stringobject.c b/Objects/stringobject.c index aa88152..60104d5 100644 --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -3287,8 +3287,8 @@ string_zfill(PyStringObject *self, PyObject *args) } else return PyString_FromStringAndSize( - PyString_AS_STRING(self), - PyString_GET_SIZE(self) + PyString_AS_STRING(self), + PyString_GET_SIZE(self) ); } |
