fork download
  1. #define PY_SSIZE_T_CLEAN
  2. #include <Python.h>
  3.  
  4.  
  5. static PyObject* single_arg(PyObject *args)
  6. {
  7. if (!PyArg_ParseTuple(args, "O", &args)) {
  8. return NULL;
  9. }
  10.  
  11. return args;
  12. }
  13.  
  14.  
  15. static int sequence_to_array(PyObject *seq, double *array, Py_ssize_t size)
  16. {
  17. if (seq == NULL || PySequence_Size(seq) != size) {
  18. return 0;
  19. }
  20.  
  21. while (size--) {
  22. array[size] = PyFloat_AsDouble(PySequence_GetItem(seq, size));
  23. }
  24.  
  25. return 1;
  26. }
  27.  
  28. static PyObject *func(PyObject *self, PyObject *args)
  29. {
  30. double array[3];
  31.  
  32. if (!sequence_to_array(single_arg(args), array, 3)) {
  33. return NULL;
  34. }
  35.  
  36. Py_RETURN_NONE;
  37. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:2:20: fatal error: Python.h: No such file or directory
compilation terminated.
stdout
Standard output is empty