qmsk/net/py.pxd
changeset 14 c44754cc1ffe
parent 11 7ae92c2b433f
child 16 24ce1035b338
equal deleted inserted replaced
13:a1091632a8a7 14:c44754cc1ffe
     1 cimport qmsk.net.libc as libc
     1 from qmsk.net.libc cimport ssize_t, errno
     2 
     2 
     3 cdef extern from "Python.h" :
     3 cdef extern from "Python.h" :
     4     struct PyObject :
     4     struct PyObject :
     5         pass
     5         pass
     6 
     6 
     7     ## string stuff
     7     ## string stuff
     8     int PyObject_AsCharBuffer (object obj, char **buf, libc.ssize_t *len) except -1
     8     int PyObject_AsCharBuffer (object obj, char **buf, ssize_t *len) except -1
       
     9 
       
    10     object PyString_FromStringAndSize (char *v, ssize_t len)
       
    11     char* PyString_AS_STRING (object) except NULL
       
    12     int _PyString_Resize (PyObject **string, ssize_t newsize) except -1
     9     
    13     
    10     ## except setting
    14     ## except setting
    11     PyObject* PyErr_SetFromErrno (PyObject *type)
    15     PyObject* PyErr_SetFromErrno (PyObject *type)
    12 
    16 
    13     PyObject *PyExc_OSError
    17     PyObject *PyExc_OSError
    14     
    18     
       
    19 ## custom haxes
       
    20 #cdef extern from "_py.c" :
       
    21 #    object py_string_resize (object string, ssize_t new_size)
       
    22 
    15 # raise OSError with errno
    23 # raise OSError with errno
    16 # XXX: doesn't do anything with func
    24 # XXX: doesn't do anything with func
    17 cdef int raise_errno (char *func) except -1
    25 cdef int raise_errno (char *func) except -1
    18 
    26