PyObject *PySocket_getaccount(PySocket *self, void *closure) { SOCKET_DATA *sock = PySocket_AsSocket((PyObject *)self); if(sock == NULL) return NULL; else { ACCOUNT_DATA *acc = socketGetAccount(sock); if(acc == NULL) return Py_BuildValue("O", Py_None); return Py_BuildValue("O", accountGetPyFormBorrowed(acc)); } }
PyObject *accountGetPyForm(ACCOUNT_DATA *acc) { PyObject *pyform = accountGetPyFormBorrowed(acc); Py_INCREF(pyform); return pyform; }