Re: [Cython] Most efficient way to create an object with Python C-API

2020-06-17 Thread Greg Ewing
On 17/06/20 8:32 am, Daniele Nicolodi wrote: PyObject* decimal = PyImport_ImportModule("decimal"); PyObject* constructor = PyObject_GetAttrString(m, "Decimal"); PyObject* obj = PyObject_CallFunction(PyDec_Type, "s#", str, len); Is there a better way? I was thinking about getting to the PyTypeOb

[Cython] Most efficient way to create an object with Python C-API

2020-06-16 Thread Daniele Nicolodi
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-