-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from KxSystems/KXI-33061
Addition of missing file required for PyKX Compilation
- Loading branch information
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |