Search code examples
pythonpython-c-api

doubles in embedded python


So I'm writing a set of C++ classes that run Python scripts. I've gotten code working to run any script I want from a specified directory, and I can pass and return values just fine.

But the one issue I have is I can't seem to find out how to set Python doubles up. For example, when I was using long values, I could use "PyLong_AsLong([whatever value I'm trying to convert to a long from a PyObject])" -- but is there a PyDouble_Something in the Python/C API I can use for that? My google searching has so far turned up nothing.


Solution

  • You want PyFloat_AsDouble, no?