@@ -3542,7 +3542,7 @@ PyDec_Round(PyObject *dec, PyObject *args)
35423542 }
35433543}
35443544
3545- static PyObject * DecimalTuple = NULL ;
3545+ static PyTypeObject * DecimalTuple = NULL ;
35463546/* Return the DecimalTuple representation of a PyDecObject. */
35473547static PyObject *
35483548PyDec_AsTuple (PyObject * dec , PyObject * dummy UNUSED )
@@ -3625,7 +3625,7 @@ PyDec_AsTuple(PyObject *dec, PyObject *dummy UNUSED)
36253625 }
36263626 }
36273627
3628- result = PyObject_CallFunctionObjArgs (DecimalTuple ,
3628+ result = PyObject_CallFunctionObjArgs (( PyObject * ) DecimalTuple ,
36293629 sign , coeff , expt , NULL );
36303630
36313631out :
@@ -5562,9 +5562,14 @@ PyInit__decimal(void)
55625562
55635563 /* DecimalTuple */
55645564 ASSIGN_PTR (collections , PyImport_ImportModule ("collections" ));
5565- ASSIGN_PTR (DecimalTuple , PyObject_CallMethod (collections ,
5565+ ASSIGN_PTR (DecimalTuple , ( PyTypeObject * ) PyObject_CallMethod (collections ,
55665566 "namedtuple" , "(ss)" , "DecimalTuple" ,
55675567 "sign digits exponent" ));
5568+
5569+ ASSIGN_PTR (obj , PyUnicode_FromString ("decimal" ));
5570+ CHECK_INT (PyDict_SetItemString (DecimalTuple -> tp_dict , "__module__" , obj ));
5571+ Py_CLEAR (obj );
5572+
55685573 /* MutableMapping */
55695574 ASSIGN_PTR (MutableMapping , PyObject_GetAttrString (collections ,
55705575 "MutableMapping" ));
@@ -5591,7 +5596,7 @@ PyInit__decimal(void)
55915596 CHECK_INT (PyModule_AddObject (m , "Context" ,
55925597 (PyObject * )& PyDecContext_Type ));
55935598 Py_INCREF (DecimalTuple );
5594- CHECK_INT (PyModule_AddObject (m , "DecimalTuple" , DecimalTuple ));
5599+ CHECK_INT (PyModule_AddObject (m , "DecimalTuple" , ( PyObject * ) DecimalTuple ));
55955600
55965601
55975602 /* Create top level exception */
0 commit comments