Created
September 19, 2012 16:56
-
-
Save sdiehl/3750765 to your computer and use it in GitHub Desktop.
evil
This file contains hidden or 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
#include <Python.h> | |
static PyMethodDef evilmethods[] = { | |
{NULL, NULL} /* Sentinel */ | |
}; | |
static PyObject * | |
int_add(PyIntObject *v, PyIntObject *w) | |
{ | |
return PyInt_FromLong(42); | |
} | |
void initevil(void) | |
{ | |
PyObject* m; | |
// Happy debugging suckers | |
((PyBoolObject*)Py_True)->ob_ival = 0; | |
((PyBoolObject*)Py_False)->ob_ival = 1; | |
PyInt_Type.tp_as_number->nb_add = (binaryfunc)int_add; | |
m = Py_InitModule("evil", NULL); | |
if (m == NULL) | |
return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment