diff options
author | Stefan Krah <skrah@bytereef.org> | 2016-06-20 10:10:42 (GMT) |
---|---|---|
committer | Stefan Krah <skrah@bytereef.org> | 2016-06-20 10:10:42 (GMT) |
commit | 8113f490c5aa29dbd28af7a47cb70ca470536bed (patch) | |
tree | 5406ccbb8af0624802986f21fec38dd6ca3840bc /Modules/_decimal | |
parent | df1d31c2cdcdd478fbff507d3b906fb93f66c49b (diff) | |
parent | 6817c59cf08ac214737d86f37e63a431385a9613 (diff) | |
download | cpython-8113f490c5aa29dbd28af7a47cb70ca470536bed.zip cpython-8113f490c5aa29dbd28af7a47cb70ca470536bed.tar.gz cpython-8113f490c5aa29dbd28af7a47cb70ca470536bed.tar.bz2 |
Merge 3.5.
Diffstat (limited to 'Modules/_decimal')
-rw-r--r-- | Modules/_decimal/_decimal.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c index e19bbf2..bcc31e5 100644 --- a/Modules/_decimal/_decimal.c +++ b/Modules/_decimal/_decimal.c @@ -2629,12 +2629,18 @@ PyDecType_FromSequenceExact(PyTypeObject *type, PyObject *v, /* class method */ static PyObject * -dec_from_float(PyObject *dec, PyObject *pyfloat) +dec_from_float(PyObject *type, PyObject *pyfloat) { PyObject *context; + PyObject *result; CURRENT_CONTEXT(context); - return PyDecType_FromFloatExact((PyTypeObject *)dec, pyfloat, context); + result = PyDecType_FromFloatExact(&PyDec_Type, pyfloat, context); + if (!PyDec_CheckExact(type) && result != NULL) { + Py_SETREF(result, PyObject_CallFunctionObjArgs(type, result, NULL)); + } + + return result; } /* create_decimal_from_float */ |