summaryrefslogtreecommitdiffstats
path: root/Modules/_decimal
diff options
context:
space:
mode:
authorStefan Krah <skrah@bytereef.org>2012-11-08 10:17:29 (GMT)
committerStefan Krah <skrah@bytereef.org>2012-11-08 10:17:29 (GMT)
commit0f82b76b574724618f7de929c0f30aecc58c3bf7 (patch)
tree216c9b54663d9684657bba8503422071278fdf0d /Modules/_decimal
parent9cfa1ff891af6394cfcd4373c0c7d1e2a2dfd371 (diff)
downloadcpython-0f82b76b574724618f7de929c0f30aecc58c3bf7.zip
cpython-0f82b76b574724618f7de929c0f30aecc58c3bf7.tar.gz
cpython-0f82b76b574724618f7de929c0f30aecc58c3bf7.tar.bz2
Issue #16431: Finally, consider all permutations.
Diffstat (limited to 'Modules/_decimal')
-rw-r--r--Modules/_decimal/_decimal.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c
index 0e1d304..e951ded 100644
--- a/Modules/_decimal/_decimal.c
+++ b/Modules/_decimal/_decimal.c
@@ -2338,14 +2338,14 @@ PyDecType_FromFloat(PyTypeObject *type, PyObject *v,
return dec;
}
-/* Return a new PyDecObject (subtype) from a Decimal. */
+/* Return a new PyDecObject or a subtype from a Decimal. */
static PyObject *
PyDecType_FromDecimalExact(PyTypeObject *type, PyObject *v, PyObject *context)
{
PyObject *dec;
uint32_t status = 0;
- if (type == Py_TYPE(v)) {
+ if (type == &PyDec_Type && PyDec_CheckExact(v)) {
Py_INCREF(v);
return v;
}