terom@14: from qmsk.net.libc cimport ssize_t, errno terom@7: terom@7: cdef extern from "Python.h" : terom@16: ctypedef struct PyObject : terom@7: pass terom@7: terom@16: ## refcounting terom@16: void Py_XDECREF (PyObject *obj) terom@16: terom@7: ## string stuff terom@14: int PyObject_AsCharBuffer (object obj, char **buf, ssize_t *len) except -1 terom@14: terom@16: PyObject* PyString_FromStringAndSize (char *v, ssize_t len) terom@16: terom@16: # no error checking terom@16: ssize_t PyString_GET_SIZE (PyObject *str) terom@16: char* PyString_AS_STRING (PyObject *str) terom@16: terom@14: int _PyString_Resize (PyObject **string, ssize_t newsize) except -1 terom@7: terom@7: ## except setting terom@7: PyObject* PyErr_SetFromErrno (PyObject *type) terom@7: terom@7: PyObject *PyExc_OSError terom@7: terom@14: ## custom haxes terom@14: #cdef extern from "_py.c" : terom@14: # object py_string_resize (object string, ssize_t new_size) terom@14: terom@7: # raise OSError with errno terom@7: # XXX: doesn't do anything with func terom@7: cdef int raise_errno (char *func) except -1 terom@7: