summaryrefslogtreecommitdiff
path: root/Objects/complexobject.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-01-19 16:21:02 +0000
committerChristian Heimes <christian@cheimes.de>2008-01-19 16:21:02 +0000
commit587c2bfedee6f6c5ee16b4e7eb5392d270a0c1a6 (patch)
tree72bedc48b7476a8d6251b2652b4fdd520dac02f2 /Objects/complexobject.c
parentbd84a588e30e51c8a0bcca2a27aea5cb0e3817c7 (diff)
downloadcpython-git-587c2bfedee6f6c5ee16b4e7eb5392d270a0c1a6.tar.gz
Merged revisions 60053-60078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r60054 | christian.heimes | 2008-01-18 20:12:56 +0100 (Fri, 18 Jan 2008) | 1 line Silence Coverity false alerts with CIDs #172, #183, #184 ........ r60057 | guido.van.rossum | 2008-01-18 21:56:30 +0100 (Fri, 18 Jan 2008) | 3 lines Fix an edge case whereby the __del__() method of a classic class could create a new weakref to the object. ........ r60058 | raymond.hettinger | 2008-01-18 22:14:58 +0100 (Fri, 18 Jan 2008) | 1 line Better variable name in an example. ........ r60063 | guido.van.rossum | 2008-01-19 00:05:40 +0100 (Sat, 19 Jan 2008) | 3 lines This got fixed for classic classes in r60057, and backported to 2.5.2 in 60056. ........ r60068 | jeffrey.yasskin | 2008-01-19 10:56:06 +0100 (Sat, 19 Jan 2008) | 4 lines Several tweaks: add construction from strings and .from_decimal(), change __init__ to __new__ to enforce immutability, and remove "rational." from repr and the parens from str. ........ r60069 | georg.brandl | 2008-01-19 11:11:27 +0100 (Sat, 19 Jan 2008) | 2 lines Fix markup. ........ r60070 | georg.brandl | 2008-01-19 11:16:09 +0100 (Sat, 19 Jan 2008) | 3 lines Amend curses docs by info how to write non-ascii characters. Thanks to Jeroen Ruigrok van der Werven. ........ r60071 | georg.brandl | 2008-01-19 11:18:07 +0100 (Sat, 19 Jan 2008) | 2 lines Indentation normalization. ........ r60073 | facundo.batista | 2008-01-19 13:32:27 +0100 (Sat, 19 Jan 2008) | 5 lines Fix issue #1822: MIMEMultipart.is_multipart() behaves correctly for a just-created (and empty) instance. Added tests for this. Thanks Jonathan Share. ........ r60074 | andrew.kuchling | 2008-01-19 14:33:20 +0100 (Sat, 19 Jan 2008) | 1 line Polish sentence ........ r60075 | christian.heimes | 2008-01-19 14:46:06 +0100 (Sat, 19 Jan 2008) | 1 line Added unit test to verify that threading.local doesn't cause ref leaks. It seems that the thread local storage always keeps the storage of the last stopped thread alive. Can anybody comment on it, please? ........ r60076 | christian.heimes | 2008-01-19 16:06:09 +0100 (Sat, 19 Jan 2008) | 1 line Update for threading.local test. ........ r60077 | andrew.kuchling | 2008-01-19 16:16:37 +0100 (Sat, 19 Jan 2008) | 1 line Polish sentence ........ r60078 | georg.brandl | 2008-01-19 16:22:16 +0100 (Sat, 19 Jan 2008) | 2 lines Fix typos. ........
Diffstat (limited to 'Objects/complexobject.c')
-rw-r--r--Objects/complexobject.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/Objects/complexobject.c b/Objects/complexobject.c
index de4641cc20..a7bf3425ff 100644
--- a/Objects/complexobject.c
+++ b/Objects/complexobject.c
@@ -375,24 +375,24 @@ complex_hash(PyComplexObject *v)
static int
to_complex(PyObject **pobj, Py_complex *pc)
{
- PyObject *obj = *pobj;
-
- pc->real = pc->imag = 0.0;
- if (PyLong_Check(obj)) {
- 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;
- }
- Py_INCREF(Py_NotImplemented);
- *pobj = Py_NotImplemented;
- return -1;
+ PyObject *obj = *pobj;
+
+ pc->real = pc->imag = 0.0;
+ if (PyLong_Check(obj)) {
+ 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;
+ }
+ Py_INCREF(Py_NotImplemented);
+ *pobj = Py_NotImplemented;
+ return -1;
}
@@ -401,8 +401,8 @@ complex_add(PyObject *v, PyObject *w)
{
Py_complex result;
Py_complex a, b;
- TO_COMPLEX(v, a);
- TO_COMPLEX(w, b);
+ TO_COMPLEX(v, a);
+ TO_COMPLEX(w, b);
PyFPE_START_PROTECT("complex_add", return 0)
result = c_sum(a, b);
PyFPE_END_PROTECT(result)
@@ -414,8 +414,8 @@ complex_sub(PyObject *v, PyObject *w)
{
Py_complex result;
Py_complex a, b;
- TO_COMPLEX(v, a);
- TO_COMPLEX(w, b);
+ TO_COMPLEX(v, a);
+ TO_COMPLEX(w, b);
PyFPE_START_PROTECT("complex_sub", return 0)
result = c_diff(a, b);
PyFPE_END_PROTECT(result)
@@ -427,8 +427,8 @@ complex_mul(PyObject *v, PyObject *w)
{
Py_complex result;
Py_complex a, b;
- TO_COMPLEX(v, a);
- TO_COMPLEX(w, b);
+ TO_COMPLEX(v, a);
+ TO_COMPLEX(w, b);
PyFPE_START_PROTECT("complex_mul", return 0)
result = c_prod(a, b);
PyFPE_END_PROTECT(result)
@@ -440,8 +440,8 @@ complex_div(PyObject *v, PyObject *w)
{
Py_complex quot;
Py_complex a, b;
- TO_COMPLEX(v, a);
- TO_COMPLEX(w, b);
+ TO_COMPLEX(v, a);
+ TO_COMPLEX(w, b);
PyFPE_START_PROTECT("complex_div", return 0)
errno = 0;
quot = c_quot(a, b);
@@ -477,8 +477,8 @@ complex_pow(PyObject *v, PyObject *w, PyObject *z)
Py_complex exponent;
long int_exponent;
Py_complex a, b;
- TO_COMPLEX(v, a);
- TO_COMPLEX(w, b);
+ TO_COMPLEX(v, a);
+ TO_COMPLEX(w, b);
if (z != Py_None) {
PyErr_SetString(PyExc_ValueError, "complex modulo");
@@ -557,8 +557,8 @@ complex_richcompare(PyObject *v, PyObject *w, int op)
{
PyObject *res;
Py_complex i, j;
- TO_COMPLEX(v, i);
- TO_COMPLEX(w, j);
+ TO_COMPLEX(v, i);
+ TO_COMPLEX(w, j);
if (op != Py_EQ && op != Py_NE) {
/* XXX Should eventually return NotImplemented */
@@ -673,11 +673,11 @@ complex_subtype_from_string(PyTypeObject *type, PyObject *v)
start = s;
while (*s && isspace(Py_CHARMASK(*s)))
s++;
- if (s[0] == '\0') {
+ if (s[0] == '\0') {
PyErr_SetString(PyExc_ValueError,
"complex() arg is an empty string");
return NULL;
- }
+ }
if (s[0] == '(') {
/* Skip over possible bracket from repr(). */
got_bracket = 1;
@@ -837,7 +837,7 @@ complex_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
"complex() can't take second arg"
" if first is a string");
return NULL;
- }
+ }
return complex_subtype_from_string(type, r);
}
if (i != NULL && PyUnicode_Check(i)) {
@@ -915,7 +915,7 @@ complex_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return NULL;
}
cr.real = PyFloat_AsDouble(tmp);
- cr.imag = 0.0; /* Shut up compiler warning */
+ cr.imag = 0.0; /* Shut up compiler warning */
Py_DECREF(tmp);
}
if (i == NULL) {