Kaydet (Commit) fa2e4c27 authored tarafından Guido van Rossum's avatar Guido van Rossum

Declare real and imag as read-only attributes.

This fixes SF bug #514858 (Gregory Smith): complex not entirely
immutable

2.2.1 Bugfix candidate!
üst 5ff8cb4f
...@@ -629,9 +629,9 @@ static PyMethodDef complex_methods[] = { ...@@ -629,9 +629,9 @@ static PyMethodDef complex_methods[] = {
}; };
static PyMemberDef complex_members[] = { static PyMemberDef complex_members[] = {
{"real", T_DOUBLE, offsetof(PyComplexObject, cval.real), 0, {"real", T_DOUBLE, offsetof(PyComplexObject, cval.real), READONLY,
"the real part of a complex number"}, "the real part of a complex number"},
{"imag", T_DOUBLE, offsetof(PyComplexObject, cval.imag), 0, {"imag", T_DOUBLE, offsetof(PyComplexObject, cval.imag), READONLY,
"the imaginary part of a complex number"}, "the imaginary part of a complex number"},
{0}, {0},
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment