| 502 | } |
| 503 | |
| 504 | static |
| 505 | void _cffi_start_and_call_python(struct _cffi_externpy_s *externpy, char *args) |
| 506 | { |
| 507 | _cffi_call_python_fnptr fnptr; |
| 508 | int current_err = errno; |
| 509 | #ifdef _MSC_VER |
| 510 | int current_lasterr = GetLastError(); |
| 511 | #endif |
| 512 | fnptr = _cffi_start_python(); |
| 513 | if (fnptr == NULL) { |
| 514 | fprintf(stderr, "function %s() called, but initialization code " |
| 515 | "failed. Returning 0.\n", externpy->name); |
| 516 | memset(args, 0, externpy->size_of_result); |
| 517 | } |
| 518 | #ifdef _MSC_VER |
| 519 | SetLastError(current_lasterr); |
| 520 | #endif |
| 521 | errno = current_err; |
| 522 | |
| 523 | if (fnptr != NULL) |
| 524 | fnptr(externpy, args); |
| 525 | } |
| 526 | |
| 527 | |
| 528 | /* The cffi_start_python() function makes sure Python is initialized |
nothing calls this directly
no test coverage detected