Skip to content

Commit

Permalink
Merge pull request #9 from KxSystems/KXI-33061
Browse files Browse the repository at this point in the history
Addition of missing file required for PyKX Compilation
  • Loading branch information
cmccarthy1 authored Oct 24, 2023
2 parents 1cddd76 + 145a587 commit 7de2b7c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/pykx/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Auto-generated files
*.c
!_pykx_helpers.c
!_numpy.c
!python.c
!pykx.c
Expand Down
35 changes: 35 additions & 0 deletions src/pykx/_pykx_helpers.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#define PY_SSIZE_T_CLEAN
#include <assert.h>
#include <stddef.h>
#include <string.h>
#include <Python.h>


static PyObject* clear_all_errors(PyObject* self, PyObject* args) {
PyErr_Clear();
Py_RETURN_NONE;
}


static PyMethodDef _HelperMethods[] = {
{"clean_errors", clear_all_errors, METH_NOARGS, "Clean the python error state."},
{NULL, NULL, 0, NULL} // Sentinel
};


static struct PyModuleDef _helpermodule = {
PyModuleDef_HEAD_INIT,
"_pykx_helpers",// Module name.
NULL, // Module documentation; may be NULL.
-1, // Size of per-interpreter state of the module, or -1 if the module keeps state in global variables.
_HelperMethods, // Module methods.
NULL, // Module slots.
NULL, // A traversal function to call during GC traversal of the module object.
NULL, // A clear function to call during GC clearing of the module object.
NULL // A function to call during deallocation of the module object.
};


PyMODINIT_FUNC PyInit__pykx_helpers(void) {
return PyModule_Create(&_helpermodule);
}

0 comments on commit 7de2b7c

Please sign in to comment.