Hello, this is not a question directly related to cython, but I think the readers of this list may have the right expertise to answer it.
I am working on a Python extension where I need to instantiate a lot of Decimal objects. I would like to make it as efficient as possible. Unfortunately the C-API of the _decimal module is not exposed (as is for example done for the datetime module). The straightforward approach is something on the lines of: PyObject* decimal = PyImport_ImportModule("decimal"); PyObject* constructor = PyObject_GetAttrString(m, "Decimal"); and then instantiate the objects with something like: PyObject* obj = PyObject_CallFunction(PyDec_Type, "s#", str, len); Is there a better way? I was thinking about getting to the PyTypeObject for Decimal, like PyTypeObject* type = Py_TYPE(obj); but then I don't see an easy way to use it to instantiate an object. Am I missing something? Thank you. Cheers, Dan _______________________________________________ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel