| 580 | } |
| 581 | |
| 582 | static PyObject* ExportTaskSMT2(PyObject *self, PyObject *args) { |
| 583 | if (__z3_parser == nullptr) { |
| 584 | PyErr_SetString(PyExc_RuntimeError, "parser not initialized"); |
| 585 | return NULL; |
| 586 | } |
| 587 | |
| 588 | uint64_t id = 0; |
| 589 | const char *filename = NULL; |
| 590 | if (!PyArg_ParseTuple(args, "Ks", &id, &filename)) { |
| 591 | return NULL; |
| 592 | } |
| 593 | |
| 594 | int fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644); |
| 595 | if (fd < 0) { |
| 596 | PyErr_SetFromErrnoWithFilename(PyExc_OSError, filename); |
| 597 | return NULL; |
| 598 | } |
| 599 | |
| 600 | int ret = __z3_parser->export_task_smt2(id, fd); |
| 601 | close(fd); |
| 602 | |
| 603 | if (ret != 0) { |
| 604 | PyErr_SetString(PyExc_RuntimeError, "failed to export task as SMT2"); |
| 605 | return NULL; |
| 606 | } |
| 607 | |
| 608 | Py_RETURN_NONE; |
| 609 | } |
| 610 | |
| 611 | static PyMethodDef SymSanMethods[] = { |
| 612 | {"init", (PyCFunction)SymSanInit, METH_VARARGS | METH_KEYWORDS, "initialize symsan target"}, |
nothing calls this directly
no test coverage detected