From 88df8f6ce0c9d3c0391336c684f3ca2fe881590a Mon Sep 17 00:00:00 2001 From: Panos Date: Sat, 19 Sep 2020 11:05:43 +0100 Subject: [PATCH 1/2] Added trace function to session. Added trace bitmasks. TODO: Optionally enable debug build in _setup_libssh2 to ease debugging. --- _setup_libssh2.py | 6 +- ssh2/c_ssh2.pxd | 10 + ssh2/session.c | 1596 +++++++++++++++++++++++------------------ ssh2/session.pyx | 20 +- tests/test_session.py | 9 +- 5 files changed, 940 insertions(+), 701 deletions(-) diff --git a/_setup_libssh2.py b/_setup_libssh2.py index d451d9d6..ce45edc1 100644 --- a/_setup_libssh2.py +++ b/_setup_libssh2.py @@ -20,9 +20,11 @@ def build_ssh2(): os.chdir('src') check_call('cmake ../libssh2 -DBUILD_SHARED_LIBS=ON \ -DENABLE_ZLIB_COMPRESSION=ON -DENABLE_CRYPT_NONE=ON \ - -DENABLE_MAC_NONE=ON -DCRYPTO_BACKEND=OpenSSL', + -DENABLE_MAC_NONE=ON -DCRYPTO_BACKEND=OpenSSL \ + -DENABLE_DEBUG_LOGGING=ON', shell=True, env=os.environ) - check_call('cmake --build . --config Release', shell=True, env=os.environ) + # check_call('cmake --build . --config Release', shell=True, env=os.environ) + check_call('cmake --build . --config Debug', shell=True, env=os.environ) os.chdir('..') for src in glob('src/src/libssh2.so*'): diff --git a/ssh2/c_ssh2.pxd b/ssh2/c_ssh2.pxd index d62ec70a..c3e3b87b 100644 --- a/ssh2/c_ssh2.pxd +++ b/ssh2/c_ssh2.pxd @@ -455,3 +455,13 @@ cdef extern from "libssh2.h" nogil: const char *path) IF HAVE_AGENT_FWD: int libssh2_channel_request_auth_agent(LIBSSH2_CHANNEL *channel) + enum: + LIBSSH2_TRACE_TRANS + LIBSSH2_TRACE_KEX + LIBSSH2_TRACE_AUTH + LIBSSH2_TRACE_CONN + LIBSSH2_TRACE_SCP + LIBSSH2_TRACE_SFTP + LIBSSH2_TRACE_ERROR + LIBSSH2_TRACE_PUBLICKEY + LIBSSH2_TRACE_SOCKET diff --git a/ssh2/session.c b/ssh2/session.c index f3ed9d1d..55f5db50 100644 --- a/ssh2/session.c +++ b/ssh2/session.c @@ -1576,11 +1576,20 @@ static const char __pyx_k_queue_maxsize[] = "queue_maxsize"; static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; static const char __pyx_k_KnownHostError[] = "KnownHostError"; static const char __pyx_k_setstate_cython[] = "__setstate_cython__"; +static const char __pyx_k_LIBSSH2_TRACE_KEX[] = "LIBSSH2_TRACE_KEX"; +static const char __pyx_k_LIBSSH2_TRACE_SCP[] = "LIBSSH2_TRACE_SCP"; static const char __pyx_k_publickeyfiledata[] = "publickeyfiledata"; +static const char __pyx_k_LIBSSH2_TRACE_AUTH[] = "LIBSSH2_TRACE_AUTH"; +static const char __pyx_k_LIBSSH2_TRACE_CONN[] = "LIBSSH2_TRACE_CONN"; +static const char __pyx_k_LIBSSH2_TRACE_SFTP[] = "LIBSSH2_TRACE_SFTP"; static const char __pyx_k_PublicKeyInitError[] = "PublicKeyInitError"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_privatekeyfiledata[] = "privatekeyfiledata"; +static const char __pyx_k_LIBSSH2_TRACE_ERROR[] = "LIBSSH2_TRACE_ERROR"; +static const char __pyx_k_LIBSSH2_TRACE_TRANS[] = "LIBSSH2_TRACE_TRANS"; static const char __pyx_k_SessionHostKeyError[] = "SessionHostKeyError"; +static const char __pyx_k_LIBSSH2_TRACE_SOCKET[] = "LIBSSH2_TRACE_SOCKET"; +static const char __pyx_k_LIBSSH2_TRACE_PUBLICKEY[] = "LIBSSH2_TRACE_PUBLICKEY"; static const char __pyx_k_LIBSSH2_HOSTKEY_HASH_MD5[] = "LIBSSH2_HOSTKEY_HASH_MD5"; static const char __pyx_k_LIBSSH2_HOSTKEY_TYPE_DSS[] = "LIBSSH2_HOSTKEY_TYPE_DSS"; static const char __pyx_k_LIBSSH2_HOSTKEY_TYPE_RSA[] = "LIBSSH2_HOSTKEY_TYPE_RSA"; @@ -1601,6 +1610,15 @@ static PyObject *__pyx_n_s_LIBSSH2_HOSTKEY_TYPE_RSA; static PyObject *__pyx_n_s_LIBSSH2_HOSTKEY_TYPE_UNKNOWN; static PyObject *__pyx_n_s_LIBSSH2_SESSION_BLOCK_INBOUND; static PyObject *__pyx_n_s_LIBSSH2_SESSION_BLOCK_OUTBOUND; +static PyObject *__pyx_n_s_LIBSSH2_TRACE_AUTH; +static PyObject *__pyx_n_s_LIBSSH2_TRACE_CONN; +static PyObject *__pyx_n_s_LIBSSH2_TRACE_ERROR; +static PyObject *__pyx_n_s_LIBSSH2_TRACE_KEX; +static PyObject *__pyx_n_s_LIBSSH2_TRACE_PUBLICKEY; +static PyObject *__pyx_n_s_LIBSSH2_TRACE_SCP; +static PyObject *__pyx_n_s_LIBSSH2_TRACE_SFTP; +static PyObject *__pyx_n_s_LIBSSH2_TRACE_SOCKET; +static PyObject *__pyx_n_s_LIBSSH2_TRACE_TRANS; static PyObject *__pyx_n_s_MemoryError; static PyObject *__pyx_n_s_PublicKeyInitError; static PyObject *__pyx_n_s_Session; @@ -1686,16 +1704,17 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_4ssh2_7session_7Session_74keepalive_config(struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self, int __pyx_v_want_reply, unsigned int __pyx_v_interval); /* proto */ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4ssh2_7session_7Session_78trace(struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self, int __pyx_v_bitmask); /* proto */ static PyObject *__pyx_pf_4ssh2_7session_7Session_4sock___get__(struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4ssh2_7session_7Session_78__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4ssh2_7session_7Session_80__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_4ssh2_7session_7Session_80__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4ssh2_7session_7Session_82__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_tp_new_4ssh2_7session_Session(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static __Pyx_CachedCFunction __pyx_umethod_PyString_Type_split = {0, &__pyx_n_s_split, 0, 0, 0}; static PyObject *__pyx_tuple__3; static PyObject *__pyx_tuple__4; /* Late includes */ -/* "ssh2/session.pyx":53 +/* "ssh2/session.pyx":64 * """LibSSH2 Session class providing session functions""" * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -1728,7 +1747,7 @@ static int __pyx_pf_4ssh2_7session_7Session___cinit__(struct __pyx_obj_4ssh2_7se int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "ssh2/session.pyx":54 + /* "ssh2/session.pyx":65 * * def __cinit__(self): * self._session = c_ssh2.libssh2_session_init() # <<<<<<<<<<<<<< @@ -1737,7 +1756,7 @@ static int __pyx_pf_4ssh2_7session_7Session___cinit__(struct __pyx_obj_4ssh2_7se */ __pyx_v_self->_session = libssh2_session_init(); - /* "ssh2/session.pyx":55 + /* "ssh2/session.pyx":66 * def __cinit__(self): * self._session = c_ssh2.libssh2_session_init() * if self._session is NULL: # <<<<<<<<<<<<<< @@ -1747,16 +1766,16 @@ static int __pyx_pf_4ssh2_7session_7Session___cinit__(struct __pyx_obj_4ssh2_7se __pyx_t_1 = ((__pyx_v_self->_session == NULL) != 0); if (unlikely(__pyx_t_1)) { - /* "ssh2/session.pyx":56 + /* "ssh2/session.pyx":67 * self._session = c_ssh2.libssh2_session_init() * if self._session is NULL: * raise MemoryError # <<<<<<<<<<<<<< * self._sock = 0 * self.sock = None */ - PyErr_NoMemory(); __PYX_ERR(0, 56, __pyx_L1_error) + PyErr_NoMemory(); __PYX_ERR(0, 67, __pyx_L1_error) - /* "ssh2/session.pyx":55 + /* "ssh2/session.pyx":66 * def __cinit__(self): * self._session = c_ssh2.libssh2_session_init() * if self._session is NULL: # <<<<<<<<<<<<<< @@ -1765,7 +1784,7 @@ static int __pyx_pf_4ssh2_7session_7Session___cinit__(struct __pyx_obj_4ssh2_7se */ } - /* "ssh2/session.pyx":57 + /* "ssh2/session.pyx":68 * if self._session is NULL: * raise MemoryError * self._sock = 0 # <<<<<<<<<<<<<< @@ -1774,7 +1793,7 @@ static int __pyx_pf_4ssh2_7session_7Session___cinit__(struct __pyx_obj_4ssh2_7se */ __pyx_v_self->_sock = 0; - /* "ssh2/session.pyx":58 + /* "ssh2/session.pyx":69 * raise MemoryError * self._sock = 0 * self.sock = None # <<<<<<<<<<<<<< @@ -1787,7 +1806,7 @@ static int __pyx_pf_4ssh2_7session_7Session___cinit__(struct __pyx_obj_4ssh2_7se __Pyx_DECREF(__pyx_v_self->sock); __pyx_v_self->sock = Py_None; - /* "ssh2/session.pyx":53 + /* "ssh2/session.pyx":64 * """LibSSH2 Session class providing session functions""" * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -1806,7 +1825,7 @@ static int __pyx_pf_4ssh2_7session_7Session___cinit__(struct __pyx_obj_4ssh2_7se return __pyx_r; } -/* "ssh2/session.pyx":60 +/* "ssh2/session.pyx":71 * self.sock = None * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -1830,7 +1849,7 @@ static void __pyx_pf_4ssh2_7session_7Session_2__dealloc__(struct __pyx_obj_4ssh2 int __pyx_t_1; __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "ssh2/session.pyx":61 + /* "ssh2/session.pyx":72 * * def __dealloc__(self): * if self._session is not NULL: # <<<<<<<<<<<<<< @@ -1840,7 +1859,7 @@ static void __pyx_pf_4ssh2_7session_7Session_2__dealloc__(struct __pyx_obj_4ssh2 __pyx_t_1 = ((__pyx_v_self->_session != NULL) != 0); if (__pyx_t_1) { - /* "ssh2/session.pyx":62 + /* "ssh2/session.pyx":73 * def __dealloc__(self): * if self._session is not NULL: * c_ssh2.libssh2_session_free(self._session) # <<<<<<<<<<<<<< @@ -1849,7 +1868,7 @@ static void __pyx_pf_4ssh2_7session_7Session_2__dealloc__(struct __pyx_obj_4ssh2 */ (void)(libssh2_session_free(__pyx_v_self->_session)); - /* "ssh2/session.pyx":61 + /* "ssh2/session.pyx":72 * * def __dealloc__(self): * if self._session is not NULL: # <<<<<<<<<<<<<< @@ -1858,7 +1877,7 @@ static void __pyx_pf_4ssh2_7session_7Session_2__dealloc__(struct __pyx_obj_4ssh2 */ } - /* "ssh2/session.pyx":63 + /* "ssh2/session.pyx":74 * if self._session is not NULL: * c_ssh2.libssh2_session_free(self._session) * self._session = NULL # <<<<<<<<<<<<<< @@ -1867,7 +1886,7 @@ static void __pyx_pf_4ssh2_7session_7Session_2__dealloc__(struct __pyx_obj_4ssh2 */ __pyx_v_self->_session = NULL; - /* "ssh2/session.pyx":60 + /* "ssh2/session.pyx":71 * self.sock = None * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -1879,7 +1898,7 @@ static void __pyx_pf_4ssh2_7session_7Session_2__dealloc__(struct __pyx_obj_4ssh2 __Pyx_RefNannyFinishContext(); } -/* "ssh2/session.pyx":65 +/* "ssh2/session.pyx":76 * self._session = NULL * * def disconnect(self): # <<<<<<<<<<<<<< @@ -1912,7 +1931,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_4disconnect(struct __pyx_obj_4 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("disconnect", 0); - /* "ssh2/session.pyx":67 + /* "ssh2/session.pyx":78 * def disconnect(self): * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -1927,7 +1946,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_4disconnect(struct __pyx_obj_4 #endif /*try:*/ { - /* "ssh2/session.pyx":68 + /* "ssh2/session.pyx":79 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_session_disconnect(self._session, b"end") # <<<<<<<<<<<<<< @@ -1937,7 +1956,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_4disconnect(struct __pyx_obj_4 __pyx_v_rc = libssh2_session_disconnect(__pyx_v_self->_session, ((char const *)"end")); } - /* "ssh2/session.pyx":67 + /* "ssh2/session.pyx":78 * def disconnect(self): * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -1956,7 +1975,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_4disconnect(struct __pyx_obj_4 } } - /* "ssh2/session.pyx":69 + /* "ssh2/session.pyx":80 * with nogil: * rc = c_ssh2.libssh2_session_disconnect(self._session, b"end") * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -1964,14 +1983,14 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_4disconnect(struct __pyx_obj_4 * def handshake(self, sock not None): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 69, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 80, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":65 + /* "ssh2/session.pyx":76 * self._session = NULL * * def disconnect(self): # <<<<<<<<<<<<<< @@ -1990,7 +2009,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_4disconnect(struct __pyx_obj_4 return __pyx_r; } -/* "ssh2/session.pyx":71 +/* "ssh2/session.pyx":82 * return handle_error_codes(rc) * * def handshake(self, sock not None): # <<<<<<<<<<<<<< @@ -2009,7 +2028,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_7handshake(PyObject *__pyx_v_s __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("handshake (wrapper)", 0); if (unlikely(((PyObject *)__pyx_v_sock) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sock"); __PYX_ERR(0, 71, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sock"); __PYX_ERR(0, 82, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_6handshake(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), ((PyObject *)__pyx_v_sock)); @@ -2034,17 +2053,17 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("handshake", 0); - /* "ssh2/session.pyx":75 + /* "ssh2/session.pyx":86 * * Must be called after Session initialisation.""" * cdef int _sock = PyObject_AsFileDescriptor(sock) # <<<<<<<<<<<<<< * cdef int rc * with nogil: */ - __pyx_t_1 = PyObject_AsFileDescriptor(__pyx_v_sock); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 75, __pyx_L1_error) + __pyx_t_1 = PyObject_AsFileDescriptor(__pyx_v_sock); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 86, __pyx_L1_error) __pyx_v__sock = __pyx_t_1; - /* "ssh2/session.pyx":77 + /* "ssh2/session.pyx":88 * cdef int _sock = PyObject_AsFileDescriptor(sock) * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -2059,7 +2078,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4s #endif /*try:*/ { - /* "ssh2/session.pyx":78 + /* "ssh2/session.pyx":89 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_session_handshake(self._session, _sock) # <<<<<<<<<<<<<< @@ -2068,7 +2087,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4s */ __pyx_v_rc = libssh2_session_handshake(__pyx_v_self->_session, __pyx_v__sock); - /* "ssh2/session.pyx":79 + /* "ssh2/session.pyx":90 * with nogil: * rc = c_ssh2.libssh2_session_handshake(self._session, _sock) * self._sock = _sock # <<<<<<<<<<<<<< @@ -2078,7 +2097,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4s __pyx_v_self->_sock = __pyx_v__sock; } - /* "ssh2/session.pyx":77 + /* "ssh2/session.pyx":88 * cdef int _sock = PyObject_AsFileDescriptor(sock) * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -2097,7 +2116,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4s } } - /* "ssh2/session.pyx":80 + /* "ssh2/session.pyx":91 * rc = c_ssh2.libssh2_session_handshake(self._session, _sock) * self._sock = _sock * self.sock = sock # <<<<<<<<<<<<<< @@ -2110,7 +2129,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4s __Pyx_DECREF(__pyx_v_self->sock); __pyx_v_self->sock = __pyx_v_sock; - /* "ssh2/session.pyx":81 + /* "ssh2/session.pyx":92 * self._sock = _sock * self.sock = sock * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -2118,14 +2137,14 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4s * def startup(self, sock): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 81, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":71 + /* "ssh2/session.pyx":82 * return handle_error_codes(rc) * * def handshake(self, sock not None): # <<<<<<<<<<<<<< @@ -2144,7 +2163,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4s return __pyx_r; } -/* "ssh2/session.pyx":83 +/* "ssh2/session.pyx":94 * return handle_error_codes(rc) * * def startup(self, sock): # <<<<<<<<<<<<<< @@ -2178,17 +2197,17 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_8startup(struct __pyx_obj_4ssh int __pyx_clineno = 0; __Pyx_RefNannySetupContext("startup", 0); - /* "ssh2/session.pyx":85 + /* "ssh2/session.pyx":96 * def startup(self, sock): * """Deprecated - use self.handshake""" * cdef int _sock = PyObject_AsFileDescriptor(sock) # <<<<<<<<<<<<<< * cdef int rc * rc = c_ssh2.libssh2_session_startup(self._session, _sock) */ - __pyx_t_1 = PyObject_AsFileDescriptor(__pyx_v_sock); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 85, __pyx_L1_error) + __pyx_t_1 = PyObject_AsFileDescriptor(__pyx_v_sock); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 96, __pyx_L1_error) __pyx_v__sock = __pyx_t_1; - /* "ssh2/session.pyx":87 + /* "ssh2/session.pyx":98 * cdef int _sock = PyObject_AsFileDescriptor(sock) * cdef int rc * rc = c_ssh2.libssh2_session_startup(self._session, _sock) # <<<<<<<<<<<<<< @@ -2197,7 +2216,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_8startup(struct __pyx_obj_4ssh */ __pyx_v_rc = libssh2_session_startup(__pyx_v_self->_session, __pyx_v__sock); - /* "ssh2/session.pyx":88 + /* "ssh2/session.pyx":99 * cdef int rc * rc = c_ssh2.libssh2_session_startup(self._session, _sock) * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -2205,14 +2224,14 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_8startup(struct __pyx_obj_4ssh * def set_blocking(self, bint blocking): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 88, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 99, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":83 + /* "ssh2/session.pyx":94 * return handle_error_codes(rc) * * def startup(self, sock): # <<<<<<<<<<<<<< @@ -2231,7 +2250,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_8startup(struct __pyx_obj_4ssh return __pyx_r; } -/* "ssh2/session.pyx":90 +/* "ssh2/session.pyx":101 * return handle_error_codes(rc) * * def set_blocking(self, bint blocking): # <<<<<<<<<<<<<< @@ -2251,7 +2270,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_11set_blocking(PyObject *__pyx __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_blocking (wrapper)", 0); assert(__pyx_arg_blocking); { - __pyx_v_blocking = __Pyx_PyObject_IsTrue(__pyx_arg_blocking); if (unlikely((__pyx_v_blocking == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 90, __pyx_L3_error) + __pyx_v_blocking = __Pyx_PyObject_IsTrue(__pyx_arg_blocking); if (unlikely((__pyx_v_blocking == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -2271,7 +2290,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_10set_blocking(struct __pyx_ob __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_blocking", 0); - /* "ssh2/session.pyx":96 + /* "ssh2/session.pyx":107 * Session default is blocking unless set otherwise. * :type blocking: bool""" * with nogil: # <<<<<<<<<<<<<< @@ -2286,7 +2305,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_10set_blocking(struct __pyx_ob #endif /*try:*/ { - /* "ssh2/session.pyx":97 + /* "ssh2/session.pyx":108 * :type blocking: bool""" * with nogil: * c_ssh2.libssh2_session_set_blocking( # <<<<<<<<<<<<<< @@ -2296,7 +2315,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_10set_blocking(struct __pyx_ob libssh2_session_set_blocking(__pyx_v_self->_session, __pyx_v_blocking); } - /* "ssh2/session.pyx":96 + /* "ssh2/session.pyx":107 * Session default is blocking unless set otherwise. * :type blocking: bool""" * with nogil: # <<<<<<<<<<<<<< @@ -2315,7 +2334,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_10set_blocking(struct __pyx_ob } } - /* "ssh2/session.pyx":90 + /* "ssh2/session.pyx":101 * return handle_error_codes(rc) * * def set_blocking(self, bint blocking): # <<<<<<<<<<<<<< @@ -2330,7 +2349,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_10set_blocking(struct __pyx_ob return __pyx_r; } -/* "ssh2/session.pyx":100 +/* "ssh2/session.pyx":111 * self._session, blocking) * * def get_blocking(self): # <<<<<<<<<<<<<< @@ -2363,7 +2382,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_12get_blocking(struct __pyx_ob int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_blocking", 0); - /* "ssh2/session.pyx":105 + /* "ssh2/session.pyx":116 * :rtype: bool""" * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -2378,7 +2397,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_12get_blocking(struct __pyx_ob #endif /*try:*/ { - /* "ssh2/session.pyx":106 + /* "ssh2/session.pyx":117 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_session_get_blocking(self._session) # <<<<<<<<<<<<<< @@ -2388,7 +2407,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_12get_blocking(struct __pyx_ob __pyx_v_rc = libssh2_session_get_blocking(__pyx_v_self->_session); } - /* "ssh2/session.pyx":105 + /* "ssh2/session.pyx":116 * :rtype: bool""" * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -2407,7 +2426,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_12get_blocking(struct __pyx_ob } } - /* "ssh2/session.pyx":107 + /* "ssh2/session.pyx":118 * with nogil: * rc = c_ssh2.libssh2_session_get_blocking(self._session) * return bool(rc) # <<<<<<<<<<<<<< @@ -2415,17 +2434,17 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_12get_blocking(struct __pyx_ob * def set_timeout(self, long timeout): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 107, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyBool_FromLong((!(!__pyx_t_2))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBool_FromLong((!(!__pyx_t_2))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":100 + /* "ssh2/session.pyx":111 * self._session, blocking) * * def get_blocking(self): # <<<<<<<<<<<<<< @@ -2444,7 +2463,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_12get_blocking(struct __pyx_ob return __pyx_r; } -/* "ssh2/session.pyx":109 +/* "ssh2/session.pyx":120 * return bool(rc) * * def set_timeout(self, long timeout): # <<<<<<<<<<<<<< @@ -2464,7 +2483,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_15set_timeout(PyObject *__pyx_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_timeout (wrapper)", 0); assert(__pyx_arg_timeout); { - __pyx_v_timeout = __Pyx_PyInt_As_long(__pyx_arg_timeout); if (unlikely((__pyx_v_timeout == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 109, __pyx_L3_error) + __pyx_v_timeout = __Pyx_PyInt_As_long(__pyx_arg_timeout); if (unlikely((__pyx_v_timeout == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -2484,7 +2503,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_14set_timeout(struct __pyx_obj __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_timeout", 0); - /* "ssh2/session.pyx":117 + /* "ssh2/session.pyx":128 * time out. * :param timeout: Milliseconds to wait before timeout.""" * with nogil: # <<<<<<<<<<<<<< @@ -2499,7 +2518,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_14set_timeout(struct __pyx_obj #endif /*try:*/ { - /* "ssh2/session.pyx":118 + /* "ssh2/session.pyx":129 * :param timeout: Milliseconds to wait before timeout.""" * with nogil: * c_ssh2.libssh2_session_set_timeout(self._session, timeout) # <<<<<<<<<<<<<< @@ -2509,7 +2528,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_14set_timeout(struct __pyx_obj libssh2_session_set_timeout(__pyx_v_self->_session, __pyx_v_timeout); } - /* "ssh2/session.pyx":117 + /* "ssh2/session.pyx":128 * time out. * :param timeout: Milliseconds to wait before timeout.""" * with nogil: # <<<<<<<<<<<<<< @@ -2528,7 +2547,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_14set_timeout(struct __pyx_obj } } - /* "ssh2/session.pyx":109 + /* "ssh2/session.pyx":120 * return bool(rc) * * def set_timeout(self, long timeout): # <<<<<<<<<<<<<< @@ -2543,7 +2562,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_14set_timeout(struct __pyx_obj return __pyx_r; } -/* "ssh2/session.pyx":120 +/* "ssh2/session.pyx":131 * c_ssh2.libssh2_session_set_timeout(self._session, timeout) * * def get_timeout(self): # <<<<<<<<<<<<<< @@ -2575,7 +2594,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_16get_timeout(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_timeout", 0); - /* "ssh2/session.pyx":123 + /* "ssh2/session.pyx":134 * """Get current session timeout setting""" * cdef long timeout * with nogil: # <<<<<<<<<<<<<< @@ -2590,7 +2609,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_16get_timeout(struct __pyx_obj #endif /*try:*/ { - /* "ssh2/session.pyx":124 + /* "ssh2/session.pyx":135 * cdef long timeout * with nogil: * timeout = c_ssh2.libssh2_session_get_timeout(self._session) # <<<<<<<<<<<<<< @@ -2600,7 +2619,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_16get_timeout(struct __pyx_obj __pyx_v_timeout = libssh2_session_get_timeout(__pyx_v_self->_session); } - /* "ssh2/session.pyx":123 + /* "ssh2/session.pyx":134 * """Get current session timeout setting""" * cdef long timeout * with nogil: # <<<<<<<<<<<<<< @@ -2619,7 +2638,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_16get_timeout(struct __pyx_obj } } - /* "ssh2/session.pyx":125 + /* "ssh2/session.pyx":136 * with nogil: * timeout = c_ssh2.libssh2_session_get_timeout(self._session) * return timeout # <<<<<<<<<<<<<< @@ -2627,13 +2646,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_16get_timeout(struct __pyx_obj * def userauth_authenticated(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_timeout); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_timeout); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":120 + /* "ssh2/session.pyx":131 * c_ssh2.libssh2_session_set_timeout(self._session, timeout) * * def get_timeout(self): # <<<<<<<<<<<<<< @@ -2652,7 +2671,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_16get_timeout(struct __pyx_obj return __pyx_r; } -/* "ssh2/session.pyx":127 +/* "ssh2/session.pyx":138 * return timeout * * def userauth_authenticated(self): # <<<<<<<<<<<<<< @@ -2685,7 +2704,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_18userauth_authenticated(struc int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_authenticated", 0); - /* "ssh2/session.pyx":132 + /* "ssh2/session.pyx":143 * :rtype: bool""" * cdef bint rc * with nogil: # <<<<<<<<<<<<<< @@ -2700,7 +2719,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_18userauth_authenticated(struc #endif /*try:*/ { - /* "ssh2/session.pyx":133 + /* "ssh2/session.pyx":144 * cdef bint rc * with nogil: * rc = c_ssh2.libssh2_userauth_authenticated(self._session) # <<<<<<<<<<<<<< @@ -2710,7 +2729,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_18userauth_authenticated(struc __pyx_v_rc = libssh2_userauth_authenticated(__pyx_v_self->_session); } - /* "ssh2/session.pyx":132 + /* "ssh2/session.pyx":143 * :rtype: bool""" * cdef bint rc * with nogil: # <<<<<<<<<<<<<< @@ -2729,7 +2748,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_18userauth_authenticated(struc } } - /* "ssh2/session.pyx":134 + /* "ssh2/session.pyx":145 * with nogil: * rc = c_ssh2.libssh2_userauth_authenticated(self._session) * return bool(rc) # <<<<<<<<<<<<<< @@ -2738,13 +2757,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_18userauth_authenticated(struc */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_v_rc; - __pyx_t_2 = __Pyx_PyBool_FromLong((!(!__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBool_FromLong((!(!__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":127 + /* "ssh2/session.pyx":138 * return timeout * * def userauth_authenticated(self): # <<<<<<<<<<<<<< @@ -2763,7 +2782,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_18userauth_authenticated(struc return __pyx_r; } -/* "ssh2/session.pyx":136 +/* "ssh2/session.pyx":147 * return bool(rc) * * def userauth_list(self, username not None): # <<<<<<<<<<<<<< @@ -2782,7 +2801,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_21userauth_list(PyObject *__py __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("userauth_list (wrapper)", 0); if (unlikely(((PyObject *)__pyx_v_username) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 136, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 147, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_20userauth_list(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), ((PyObject *)__pyx_v_username)); @@ -2812,19 +2831,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_list", 0); - /* "ssh2/session.pyx":140 + /* "ssh2/session.pyx":151 * * :rtype: list""" * cdef bytes b_username = to_bytes(username) # <<<<<<<<<<<<<< * cdef char *_username = b_username * cdef size_t username_len = len(b_username) */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 140, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":141 + /* "ssh2/session.pyx":152 * :rtype: list""" * cdef bytes b_username = to_bytes(username) * cdef char *_username = b_username # <<<<<<<<<<<<<< @@ -2833,12 +2852,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o */ if (unlikely(__pyx_v_b_username == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 141, __pyx_L1_error) + __PYX_ERR(0, 152, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 152, __pyx_L1_error) __pyx_v__username = __pyx_t_2; - /* "ssh2/session.pyx":142 + /* "ssh2/session.pyx":153 * cdef bytes b_username = to_bytes(username) * cdef char *_username = b_username * cdef size_t username_len = len(b_username) # <<<<<<<<<<<<<< @@ -2847,12 +2866,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o */ if (unlikely(__pyx_v_b_username == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 142, __pyx_L1_error) + __PYX_ERR(0, 153, __pyx_L1_error) } - __pyx_t_3 = PyBytes_GET_SIZE(__pyx_v_b_username); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 142, __pyx_L1_error) + __pyx_t_3 = PyBytes_GET_SIZE(__pyx_v_b_username); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 153, __pyx_L1_error) __pyx_v_username_len = __pyx_t_3; - /* "ssh2/session.pyx":145 + /* "ssh2/session.pyx":156 * cdef char *_auth * cdef str auth * with nogil: # <<<<<<<<<<<<<< @@ -2867,7 +2886,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o #endif /*try:*/ { - /* "ssh2/session.pyx":146 + /* "ssh2/session.pyx":157 * cdef str auth * with nogil: * _auth = c_ssh2.libssh2_userauth_list( # <<<<<<<<<<<<<< @@ -2877,7 +2896,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o __pyx_v__auth = libssh2_userauth_list(__pyx_v_self->_session, __pyx_v__username, __pyx_v_username_len); } - /* "ssh2/session.pyx":145 + /* "ssh2/session.pyx":156 * cdef char *_auth * cdef str auth * with nogil: # <<<<<<<<<<<<<< @@ -2896,7 +2915,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o } } - /* "ssh2/session.pyx":148 + /* "ssh2/session.pyx":159 * _auth = c_ssh2.libssh2_userauth_list( * self._session, _username, username_len) * if _auth is NULL: # <<<<<<<<<<<<<< @@ -2906,7 +2925,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o __pyx_t_4 = ((__pyx_v__auth == NULL) != 0); if (__pyx_t_4) { - /* "ssh2/session.pyx":149 + /* "ssh2/session.pyx":160 * self._session, _username, username_len) * if _auth is NULL: * return # <<<<<<<<<<<<<< @@ -2917,7 +2936,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "ssh2/session.pyx":148 + /* "ssh2/session.pyx":159 * _auth = c_ssh2.libssh2_userauth_list( * self._session, _username, username_len) * if _auth is NULL: # <<<<<<<<<<<<<< @@ -2926,20 +2945,20 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o */ } - /* "ssh2/session.pyx":150 + /* "ssh2/session.pyx":161 * if _auth is NULL: * return * auth = to_str(_auth) # <<<<<<<<<<<<<< * return auth.split(',') * */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_str(__pyx_v__auth); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_str(__pyx_v__auth); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 150, __pyx_L1_error) + if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 161, __pyx_L1_error) __pyx_v_auth = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":151 + /* "ssh2/session.pyx":162 * return * auth = to_str(_auth) * return auth.split(',') # <<<<<<<<<<<<<< @@ -2947,13 +2966,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o * def userauth_publickey_fromfile(self, username not None, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_split, __pyx_v_auth, __pyx_kp_s_); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error) + __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_split, __pyx_v_auth, __pyx_kp_s_); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":136 + /* "ssh2/session.pyx":147 * return bool(rc) * * def userauth_list(self, username not None): # <<<<<<<<<<<<<< @@ -2974,7 +2993,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o return __pyx_r; } -/* "ssh2/session.pyx":153 +/* "ssh2/session.pyx":164 * return auth.split(',') * * def userauth_publickey_fromfile(self, username not None, # <<<<<<<<<<<<<< @@ -3001,7 +3020,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_23userauth_publickey_fromfile( PyObject* values[4] = {0,0,0,0}; values[2] = ((PyObject *)__pyx_kp_s__2); - /* "ssh2/session.pyx":156 + /* "ssh2/session.pyx":167 * privatekey not None, * passphrase='', * publickey=None): # <<<<<<<<<<<<<< @@ -3033,7 +3052,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_23userauth_publickey_fromfile( case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_privatekey)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("userauth_publickey_fromfile", 0, 2, 4, 1); __PYX_ERR(0, 153, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_publickey_fromfile", 0, 2, 4, 1); __PYX_ERR(0, 164, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -3049,7 +3068,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_23userauth_publickey_fromfile( } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_publickey_fromfile") < 0)) __PYX_ERR(0, 153, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_publickey_fromfile") < 0)) __PYX_ERR(0, 164, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3070,21 +3089,21 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_23userauth_publickey_fromfile( } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("userauth_publickey_fromfile", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 153, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_publickey_fromfile", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 164, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.userauth_publickey_fromfile", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(((PyObject *)__pyx_v_username) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 153, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 164, __pyx_L1_error) } if (unlikely(((PyObject *)__pyx_v_privatekey) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "privatekey"); __PYX_ERR(0, 154, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "privatekey"); __PYX_ERR(0, 165, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_username, __pyx_v_privatekey, __pyx_v_passphrase, __pyx_v_publickey); - /* "ssh2/session.pyx":153 + /* "ssh2/session.pyx":164 * return auth.split(',') * * def userauth_publickey_fromfile(self, username not None, # <<<<<<<<<<<<<< @@ -3124,19 +3143,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_publickey_fromfile", 0); - /* "ssh2/session.pyx":161 + /* "ssh2/session.pyx":172 * :rtype: int""" * cdef int rc * cdef bytes b_username = to_bytes(username) # <<<<<<<<<<<<<< * cdef bytes b_publickey = to_bytes(publickey) \ * if publickey is not None else None */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":163 + /* "ssh2/session.pyx":174 * cdef bytes b_username = to_bytes(username) * cdef bytes b_publickey = to_bytes(publickey) \ * if publickey is not None else None # <<<<<<<<<<<<<< @@ -3146,20 +3165,20 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( __pyx_t_2 = (__pyx_v_publickey != Py_None); if ((__pyx_t_2 != 0)) { - /* "ssh2/session.pyx":162 + /* "ssh2/session.pyx":173 * cdef int rc * cdef bytes b_username = to_bytes(username) * cdef bytes b_publickey = to_bytes(publickey) \ # <<<<<<<<<<<<<< * if publickey is not None else None * cdef bytes b_privatekey = to_bytes(privatekey) */ - __pyx_t_3 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_publickey); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_t_3 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_publickey); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; } else { - /* "ssh2/session.pyx":163 + /* "ssh2/session.pyx":174 * cdef bytes b_username = to_bytes(username) * cdef bytes b_publickey = to_bytes(publickey) \ * if publickey is not None else None # <<<<<<<<<<<<<< @@ -3172,31 +3191,31 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( __pyx_v_b_publickey = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":164 + /* "ssh2/session.pyx":175 * cdef bytes b_publickey = to_bytes(publickey) \ * if publickey is not None else None * cdef bytes b_privatekey = to_bytes(privatekey) # <<<<<<<<<<<<<< * cdef bytes b_passphrase = to_bytes(passphrase) * cdef char *_username = b_username */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_privatekey); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 164, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_privatekey); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_privatekey = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":165 + /* "ssh2/session.pyx":176 * if publickey is not None else None * cdef bytes b_privatekey = to_bytes(privatekey) * cdef bytes b_passphrase = to_bytes(passphrase) # <<<<<<<<<<<<<< * cdef char *_username = b_username * cdef char *_publickey = NULL */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_passphrase); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_passphrase); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_passphrase = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":166 + /* "ssh2/session.pyx":177 * cdef bytes b_privatekey = to_bytes(privatekey) * cdef bytes b_passphrase = to_bytes(passphrase) * cdef char *_username = b_username # <<<<<<<<<<<<<< @@ -3205,12 +3224,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( */ if (unlikely(__pyx_v_b_username == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 166, __pyx_L1_error) + __PYX_ERR(0, 177, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 166, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 177, __pyx_L1_error) __pyx_v__username = __pyx_t_4; - /* "ssh2/session.pyx":167 + /* "ssh2/session.pyx":178 * cdef bytes b_passphrase = to_bytes(passphrase) * cdef char *_username = b_username * cdef char *_publickey = NULL # <<<<<<<<<<<<<< @@ -3219,7 +3238,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( */ __pyx_v__publickey = NULL; - /* "ssh2/session.pyx":168 + /* "ssh2/session.pyx":179 * cdef char *_username = b_username * cdef char *_publickey = NULL * cdef char *_privatekey = b_privatekey # <<<<<<<<<<<<<< @@ -3228,12 +3247,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( */ if (unlikely(__pyx_v_b_privatekey == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 168, __pyx_L1_error) + __PYX_ERR(0, 179, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_privatekey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_privatekey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 179, __pyx_L1_error) __pyx_v__privatekey = __pyx_t_4; - /* "ssh2/session.pyx":169 + /* "ssh2/session.pyx":180 * cdef char *_publickey = NULL * cdef char *_privatekey = b_privatekey * cdef char *_passphrase = b_passphrase # <<<<<<<<<<<<<< @@ -3242,12 +3261,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( */ if (unlikely(__pyx_v_b_passphrase == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 169, __pyx_L1_error) + __PYX_ERR(0, 180, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_passphrase); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 169, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_passphrase); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L1_error) __pyx_v__passphrase = __pyx_t_4; - /* "ssh2/session.pyx":170 + /* "ssh2/session.pyx":181 * cdef char *_privatekey = b_privatekey * cdef char *_passphrase = b_passphrase * if b_publickey is not None: # <<<<<<<<<<<<<< @@ -3258,7 +3277,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( __pyx_t_5 = (__pyx_t_2 != 0); if (__pyx_t_5) { - /* "ssh2/session.pyx":171 + /* "ssh2/session.pyx":182 * cdef char *_passphrase = b_passphrase * if b_publickey is not None: * _publickey = b_publickey # <<<<<<<<<<<<<< @@ -3267,12 +3286,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( */ if (unlikely(__pyx_v_b_publickey == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 171, __pyx_L1_error) + __PYX_ERR(0, 182, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_publickey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_publickey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L1_error) __pyx_v__publickey = __pyx_t_4; - /* "ssh2/session.pyx":170 + /* "ssh2/session.pyx":181 * cdef char *_privatekey = b_privatekey * cdef char *_passphrase = b_passphrase * if b_publickey is not None: # <<<<<<<<<<<<<< @@ -3281,7 +3300,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( */ } - /* "ssh2/session.pyx":172 + /* "ssh2/session.pyx":183 * if b_publickey is not None: * _publickey = b_publickey * with nogil: # <<<<<<<<<<<<<< @@ -3296,7 +3315,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( #endif /*try:*/ { - /* "ssh2/session.pyx":173 + /* "ssh2/session.pyx":184 * _publickey = b_publickey * with nogil: * rc = c_ssh2.libssh2_userauth_publickey_fromfile( # <<<<<<<<<<<<<< @@ -3306,7 +3325,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( __pyx_v_rc = libssh2_userauth_publickey_fromfile(__pyx_v_self->_session, __pyx_v__username, __pyx_v__publickey, __pyx_v__privatekey, __pyx_v__passphrase); } - /* "ssh2/session.pyx":172 + /* "ssh2/session.pyx":183 * if b_publickey is not None: * _publickey = b_publickey * with nogil: # <<<<<<<<<<<<<< @@ -3325,7 +3344,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( } } - /* "ssh2/session.pyx":175 + /* "ssh2/session.pyx":186 * rc = c_ssh2.libssh2_userauth_publickey_fromfile( * self._session, _username, _publickey, _privatekey, _passphrase) * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -3333,14 +3352,14 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( * def userauth_publickey(self, username not None, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 175, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_6 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 186, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":153 + /* "ssh2/session.pyx":164 * return auth.split(',') * * def userauth_publickey_fromfile(self, username not None, # <<<<<<<<<<<<<< @@ -3364,7 +3383,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( return __pyx_r; } -/* "ssh2/session.pyx":177 +/* "ssh2/session.pyx":188 * return handle_error_codes(rc) * * def userauth_publickey(self, username not None, # <<<<<<<<<<<<<< @@ -3407,11 +3426,11 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_25userauth_publickey(PyObject case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pubkeydata)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("userauth_publickey", 1, 2, 2, 1); __PYX_ERR(0, 177, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_publickey", 1, 2, 2, 1); __PYX_ERR(0, 188, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_publickey") < 0)) __PYX_ERR(0, 177, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_publickey") < 0)) __PYX_ERR(0, 188, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -3424,16 +3443,16 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_25userauth_publickey(PyObject } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("userauth_publickey", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 177, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_publickey", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 188, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.userauth_publickey", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(((PyObject *)__pyx_v_username) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 177, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 188, __pyx_L1_error) } - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pubkeydata), (&PyBytes_Type), 0, "pubkeydata", 1))) __PYX_ERR(0, 178, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pubkeydata), (&PyBytes_Type), 0, "pubkeydata", 1))) __PYX_ERR(0, 189, __pyx_L1_error) __pyx_r = __pyx_pf_4ssh2_7session_7Session_24userauth_publickey(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_username, __pyx_v_pubkeydata); /* function exit code */ @@ -3463,19 +3482,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_24userauth_publickey(struct __ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_publickey", 0); - /* "ssh2/session.pyx":188 + /* "ssh2/session.pyx":199 * :rtype: int""" * cdef int rc * cdef bytes b_username = to_bytes(username) # <<<<<<<<<<<<<< * cdef char *_username = b_username * cdef unsigned char *_pubkeydata = pubkeydata */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 188, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":189 + /* "ssh2/session.pyx":200 * cdef int rc * cdef bytes b_username = to_bytes(username) * cdef char *_username = b_username # <<<<<<<<<<<<<< @@ -3484,32 +3503,32 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_24userauth_publickey(struct __ */ if (unlikely(__pyx_v_b_username == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 189, __pyx_L1_error) + __PYX_ERR(0, 200, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 200, __pyx_L1_error) __pyx_v__username = __pyx_t_2; - /* "ssh2/session.pyx":190 + /* "ssh2/session.pyx":201 * cdef bytes b_username = to_bytes(username) * cdef char *_username = b_username * cdef unsigned char *_pubkeydata = pubkeydata # <<<<<<<<<<<<<< * cdef size_t pubkeydata_len = len(pubkeydata) * with nogil: */ - __pyx_t_3 = __Pyx_PyBytes_AsWritableUString(__pyx_v_pubkeydata); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 190, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBytes_AsWritableUString(__pyx_v_pubkeydata); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 201, __pyx_L1_error) __pyx_v__pubkeydata = __pyx_t_3; - /* "ssh2/session.pyx":191 + /* "ssh2/session.pyx":202 * cdef char *_username = b_username * cdef unsigned char *_pubkeydata = pubkeydata * cdef size_t pubkeydata_len = len(pubkeydata) # <<<<<<<<<<<<<< * with nogil: * rc = c_ssh2.libssh2_userauth_publickey( */ - __pyx_t_4 = PyBytes_GET_SIZE(__pyx_v_pubkeydata); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 191, __pyx_L1_error) + __pyx_t_4 = PyBytes_GET_SIZE(__pyx_v_pubkeydata); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 202, __pyx_L1_error) __pyx_v_pubkeydata_len = __pyx_t_4; - /* "ssh2/session.pyx":192 + /* "ssh2/session.pyx":203 * cdef unsigned char *_pubkeydata = pubkeydata * cdef size_t pubkeydata_len = len(pubkeydata) * with nogil: # <<<<<<<<<<<<<< @@ -3524,7 +3543,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_24userauth_publickey(struct __ #endif /*try:*/ { - /* "ssh2/session.pyx":193 + /* "ssh2/session.pyx":204 * cdef size_t pubkeydata_len = len(pubkeydata) * with nogil: * rc = c_ssh2.libssh2_userauth_publickey( # <<<<<<<<<<<<<< @@ -3534,7 +3553,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_24userauth_publickey(struct __ __pyx_v_rc = libssh2_userauth_publickey(__pyx_v_self->_session, __pyx_v__username, __pyx_v__pubkeydata, __pyx_v_pubkeydata_len, NULL, NULL); } - /* "ssh2/session.pyx":192 + /* "ssh2/session.pyx":203 * cdef unsigned char *_pubkeydata = pubkeydata * cdef size_t pubkeydata_len = len(pubkeydata) * with nogil: # <<<<<<<<<<<<<< @@ -3553,7 +3572,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_24userauth_publickey(struct __ } } - /* "ssh2/session.pyx":196 + /* "ssh2/session.pyx":207 * self._session, _username, _pubkeydata, * pubkeydata_len, NULL, NULL) * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -3561,14 +3580,14 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_24userauth_publickey(struct __ * def userauth_hostbased_fromfile(self, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 196, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_t_5 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":177 + /* "ssh2/session.pyx":188 * return handle_error_codes(rc) * * def userauth_publickey(self, username not None, # <<<<<<<<<<<<<< @@ -3588,7 +3607,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_24userauth_publickey(struct __ return __pyx_r; } -/* "ssh2/session.pyx":198 +/* "ssh2/session.pyx":209 * return handle_error_codes(rc) * * def userauth_hostbased_fromfile(self, # <<<<<<<<<<<<<< @@ -3615,7 +3634,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_27userauth_hostbased_fromfile( static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_username,&__pyx_n_s_privatekey,&__pyx_n_s_hostname,&__pyx_n_s_publickey,&__pyx_n_s_passphrase,0}; PyObject* values[5] = {0,0,0,0,0}; - /* "ssh2/session.pyx":202 + /* "ssh2/session.pyx":213 * privatekey not None, * hostname not None, * publickey=None, # <<<<<<<<<<<<<< @@ -3650,13 +3669,13 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_27userauth_hostbased_fromfile( case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_privatekey)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("userauth_hostbased_fromfile", 0, 3, 5, 1); __PYX_ERR(0, 198, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_hostbased_fromfile", 0, 3, 5, 1); __PYX_ERR(0, 209, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hostname)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("userauth_hostbased_fromfile", 0, 3, 5, 2); __PYX_ERR(0, 198, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_hostbased_fromfile", 0, 3, 5, 2); __PYX_ERR(0, 209, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: @@ -3672,7 +3691,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_27userauth_hostbased_fromfile( } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_hostbased_fromfile") < 0)) __PYX_ERR(0, 198, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_hostbased_fromfile") < 0)) __PYX_ERR(0, 209, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3695,24 +3714,24 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_27userauth_hostbased_fromfile( } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("userauth_hostbased_fromfile", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 198, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_hostbased_fromfile", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 209, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.userauth_hostbased_fromfile", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(((PyObject *)__pyx_v_username) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 199, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 210, __pyx_L1_error) } if (unlikely(((PyObject *)__pyx_v_privatekey) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "privatekey"); __PYX_ERR(0, 200, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "privatekey"); __PYX_ERR(0, 211, __pyx_L1_error) } if (unlikely(((PyObject *)__pyx_v_hostname) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "hostname"); __PYX_ERR(0, 201, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "hostname"); __PYX_ERR(0, 212, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_username, __pyx_v_privatekey, __pyx_v_hostname, __pyx_v_publickey, __pyx_v_passphrase); - /* "ssh2/session.pyx":198 + /* "ssh2/session.pyx":209 * return handle_error_codes(rc) * * def userauth_hostbased_fromfile(self, # <<<<<<<<<<<<<< @@ -3754,19 +3773,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_hostbased_fromfile", 0); - /* "ssh2/session.pyx":205 + /* "ssh2/session.pyx":216 * passphrase=''): * cdef int rc * cdef bytes b_username = to_bytes(username) # <<<<<<<<<<<<<< * cdef bytes b_publickey = to_bytes(publickey) \ * if publickey is not None else None */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":207 + /* "ssh2/session.pyx":218 * cdef bytes b_username = to_bytes(username) * cdef bytes b_publickey = to_bytes(publickey) \ * if publickey is not None else None # <<<<<<<<<<<<<< @@ -3776,20 +3795,20 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( __pyx_t_2 = (__pyx_v_publickey != Py_None); if ((__pyx_t_2 != 0)) { - /* "ssh2/session.pyx":206 + /* "ssh2/session.pyx":217 * cdef int rc * cdef bytes b_username = to_bytes(username) * cdef bytes b_publickey = to_bytes(publickey) \ # <<<<<<<<<<<<<< * if publickey is not None else None * cdef bytes b_privatekey = to_bytes(privatekey) */ - __pyx_t_3 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_publickey); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 206, __pyx_L1_error) + __pyx_t_3 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_publickey); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; } else { - /* "ssh2/session.pyx":207 + /* "ssh2/session.pyx":218 * cdef bytes b_username = to_bytes(username) * cdef bytes b_publickey = to_bytes(publickey) \ * if publickey is not None else None # <<<<<<<<<<<<<< @@ -3802,43 +3821,43 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( __pyx_v_b_publickey = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":208 + /* "ssh2/session.pyx":219 * cdef bytes b_publickey = to_bytes(publickey) \ * if publickey is not None else None * cdef bytes b_privatekey = to_bytes(privatekey) # <<<<<<<<<<<<<< * cdef bytes b_passphrase = to_bytes(passphrase) * cdef bytes b_hostname = to_bytes(hostname) */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_privatekey); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_privatekey); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_privatekey = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":209 + /* "ssh2/session.pyx":220 * if publickey is not None else None * cdef bytes b_privatekey = to_bytes(privatekey) * cdef bytes b_passphrase = to_bytes(passphrase) # <<<<<<<<<<<<<< * cdef bytes b_hostname = to_bytes(hostname) * cdef char *_username = b_username */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_passphrase); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_passphrase); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_passphrase = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":210 + /* "ssh2/session.pyx":221 * cdef bytes b_privatekey = to_bytes(privatekey) * cdef bytes b_passphrase = to_bytes(passphrase) * cdef bytes b_hostname = to_bytes(hostname) # <<<<<<<<<<<<<< * cdef char *_username = b_username * cdef char *_publickey = NULL */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_hostname); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_hostname); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_hostname = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":211 + /* "ssh2/session.pyx":222 * cdef bytes b_passphrase = to_bytes(passphrase) * cdef bytes b_hostname = to_bytes(hostname) * cdef char *_username = b_username # <<<<<<<<<<<<<< @@ -3847,12 +3866,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( */ if (unlikely(__pyx_v_b_username == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 211, __pyx_L1_error) + __PYX_ERR(0, 222, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 211, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 222, __pyx_L1_error) __pyx_v__username = __pyx_t_4; - /* "ssh2/session.pyx":212 + /* "ssh2/session.pyx":223 * cdef bytes b_hostname = to_bytes(hostname) * cdef char *_username = b_username * cdef char *_publickey = NULL # <<<<<<<<<<<<<< @@ -3861,7 +3880,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( */ __pyx_v__publickey = NULL; - /* "ssh2/session.pyx":213 + /* "ssh2/session.pyx":224 * cdef char *_username = b_username * cdef char *_publickey = NULL * cdef char *_privatekey = b_privatekey # <<<<<<<<<<<<<< @@ -3870,12 +3889,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( */ if (unlikely(__pyx_v_b_privatekey == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 213, __pyx_L1_error) + __PYX_ERR(0, 224, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_privatekey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 213, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_privatekey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 224, __pyx_L1_error) __pyx_v__privatekey = __pyx_t_4; - /* "ssh2/session.pyx":214 + /* "ssh2/session.pyx":225 * cdef char *_publickey = NULL * cdef char *_privatekey = b_privatekey * cdef char *_passphrase = b_passphrase # <<<<<<<<<<<<<< @@ -3884,12 +3903,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( */ if (unlikely(__pyx_v_b_passphrase == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 214, __pyx_L1_error) + __PYX_ERR(0, 225, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_passphrase); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_passphrase); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 225, __pyx_L1_error) __pyx_v__passphrase = __pyx_t_4; - /* "ssh2/session.pyx":215 + /* "ssh2/session.pyx":226 * cdef char *_privatekey = b_privatekey * cdef char *_passphrase = b_passphrase * cdef char *_hostname = b_hostname # <<<<<<<<<<<<<< @@ -3898,12 +3917,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( */ if (unlikely(__pyx_v_b_hostname == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 215, __pyx_L1_error) + __PYX_ERR(0, 226, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_hostname); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_hostname); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L1_error) __pyx_v__hostname = __pyx_t_4; - /* "ssh2/session.pyx":216 + /* "ssh2/session.pyx":227 * cdef char *_passphrase = b_passphrase * cdef char *_hostname = b_hostname * if b_publickey is not None: # <<<<<<<<<<<<<< @@ -3914,7 +3933,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( __pyx_t_5 = (__pyx_t_2 != 0); if (__pyx_t_5) { - /* "ssh2/session.pyx":217 + /* "ssh2/session.pyx":228 * cdef char *_hostname = b_hostname * if b_publickey is not None: * _publickey = b_publickey # <<<<<<<<<<<<<< @@ -3923,12 +3942,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( */ if (unlikely(__pyx_v_b_publickey == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 217, __pyx_L1_error) + __PYX_ERR(0, 228, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_publickey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 217, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_publickey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 228, __pyx_L1_error) __pyx_v__publickey = __pyx_t_4; - /* "ssh2/session.pyx":216 + /* "ssh2/session.pyx":227 * cdef char *_passphrase = b_passphrase * cdef char *_hostname = b_hostname * if b_publickey is not None: # <<<<<<<<<<<<<< @@ -3937,7 +3956,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( */ } - /* "ssh2/session.pyx":218 + /* "ssh2/session.pyx":229 * if b_publickey is not None: * _publickey = b_publickey * with nogil: # <<<<<<<<<<<<<< @@ -3952,7 +3971,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( #endif /*try:*/ { - /* "ssh2/session.pyx":219 + /* "ssh2/session.pyx":230 * _publickey = b_publickey * with nogil: * rc = c_ssh2.libssh2_userauth_hostbased_fromfile( # <<<<<<<<<<<<<< @@ -3962,7 +3981,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( __pyx_v_rc = libssh2_userauth_hostbased_fromfile(__pyx_v_self->_session, __pyx_v__username, __pyx_v__publickey, __pyx_v__privatekey, __pyx_v__passphrase, __pyx_v__hostname); } - /* "ssh2/session.pyx":218 + /* "ssh2/session.pyx":229 * if b_publickey is not None: * _publickey = b_publickey * with nogil: # <<<<<<<<<<<<<< @@ -3981,7 +4000,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( } } - /* "ssh2/session.pyx":222 + /* "ssh2/session.pyx":233 * self._session, _username, _publickey, * _privatekey, _passphrase, _hostname) * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -3989,14 +4008,14 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( * IF EMBEDDED_LIB: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 222, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) + __pyx_t_6 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 233, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":198 + /* "ssh2/session.pyx":209 * return handle_error_codes(rc) * * def userauth_hostbased_fromfile(self, # <<<<<<<<<<<<<< @@ -4021,7 +4040,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( return __pyx_r; } -/* "ssh2/session.pyx":225 +/* "ssh2/session.pyx":236 * * IF EMBEDDED_LIB: * def userauth_publickey_frommemory( # <<<<<<<<<<<<<< @@ -4048,7 +4067,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_29userauth_publickey_frommemor PyObject* values[4] = {0,0,0,0}; values[2] = ((PyObject *)__pyx_kp_s__2); - /* "ssh2/session.pyx":227 + /* "ssh2/session.pyx":238 * def userauth_publickey_frommemory( * self, username, bytes privatekeyfiledata, * passphrase='', bytes publickeyfiledata=None): # <<<<<<<<<<<<<< @@ -4080,7 +4099,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_29userauth_publickey_frommemor case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_privatekeyfiledata)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("userauth_publickey_frommemory", 0, 2, 4, 1); __PYX_ERR(0, 225, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_publickey_frommemory", 0, 2, 4, 1); __PYX_ERR(0, 236, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -4096,7 +4115,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_29userauth_publickey_frommemor } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_publickey_frommemory") < 0)) __PYX_ERR(0, 225, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_publickey_frommemory") < 0)) __PYX_ERR(0, 236, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4117,17 +4136,17 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_29userauth_publickey_frommemor } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("userauth_publickey_frommemory", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 225, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_publickey_frommemory", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 236, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.userauth_publickey_frommemory", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_privatekeyfiledata), (&PyBytes_Type), 1, "privatekeyfiledata", 1))) __PYX_ERR(0, 226, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_publickeyfiledata), (&PyBytes_Type), 1, "publickeyfiledata", 1))) __PYX_ERR(0, 227, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_privatekeyfiledata), (&PyBytes_Type), 1, "privatekeyfiledata", 1))) __PYX_ERR(0, 237, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_publickeyfiledata), (&PyBytes_Type), 1, "publickeyfiledata", 1))) __PYX_ERR(0, 238, __pyx_L1_error) __pyx_r = __pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemory(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_username, __pyx_v_privatekeyfiledata, __pyx_v_passphrase, __pyx_v_publickeyfiledata); - /* "ssh2/session.pyx":225 + /* "ssh2/session.pyx":236 * * IF EMBEDDED_LIB: * def userauth_publickey_frommemory( # <<<<<<<<<<<<<< @@ -4169,31 +4188,31 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_publickey_frommemory", 0); - /* "ssh2/session.pyx":229 + /* "ssh2/session.pyx":240 * passphrase='', bytes publickeyfiledata=None): * cdef int rc * cdef bytes b_username = to_bytes(username) # <<<<<<<<<<<<<< * cdef bytes b_passphrase = to_bytes(passphrase) * cdef char *_username = b_username */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":230 + /* "ssh2/session.pyx":241 * cdef int rc * cdef bytes b_username = to_bytes(username) * cdef bytes b_passphrase = to_bytes(passphrase) # <<<<<<<<<<<<<< * cdef char *_username = b_username * cdef char *_passphrase = b_passphrase */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_passphrase); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_passphrase); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_passphrase = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":231 + /* "ssh2/session.pyx":242 * cdef bytes b_username = to_bytes(username) * cdef bytes b_passphrase = to_bytes(passphrase) * cdef char *_username = b_username # <<<<<<<<<<<<<< @@ -4202,12 +4221,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor */ if (unlikely(__pyx_v_b_username == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 231, __pyx_L1_error) + __PYX_ERR(0, 242, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 231, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L1_error) __pyx_v__username = __pyx_t_2; - /* "ssh2/session.pyx":232 + /* "ssh2/session.pyx":243 * cdef bytes b_passphrase = to_bytes(passphrase) * cdef char *_username = b_username * cdef char *_passphrase = b_passphrase # <<<<<<<<<<<<<< @@ -4216,12 +4235,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor */ if (unlikely(__pyx_v_b_passphrase == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 232, __pyx_L1_error) + __PYX_ERR(0, 243, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_passphrase); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 232, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_passphrase); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 243, __pyx_L1_error) __pyx_v__passphrase = __pyx_t_2; - /* "ssh2/session.pyx":233 + /* "ssh2/session.pyx":244 * cdef char *_username = b_username * cdef char *_passphrase = b_passphrase * cdef char *_publickeyfiledata = NULL # <<<<<<<<<<<<<< @@ -4230,7 +4249,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor */ __pyx_v__publickeyfiledata = NULL; - /* "ssh2/session.pyx":234 + /* "ssh2/session.pyx":245 * cdef char *_passphrase = b_passphrase * cdef char *_publickeyfiledata = NULL * cdef char *_privatekeyfiledata = privatekeyfiledata # <<<<<<<<<<<<<< @@ -4239,12 +4258,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor */ if (unlikely(__pyx_v_privatekeyfiledata == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 234, __pyx_L1_error) + __PYX_ERR(0, 245, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_privatekeyfiledata); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_privatekeyfiledata); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 245, __pyx_L1_error) __pyx_v__privatekeyfiledata = __pyx_t_2; - /* "ssh2/session.pyx":236 + /* "ssh2/session.pyx":247 * cdef char *_privatekeyfiledata = privatekeyfiledata * cdef size_t username_len, privatekeydata_len * cdef size_t pubkeydata_len = 0 # <<<<<<<<<<<<<< @@ -4253,7 +4272,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor */ __pyx_v_pubkeydata_len = 0; - /* "ssh2/session.pyx":238 + /* "ssh2/session.pyx":249 * cdef size_t pubkeydata_len = 0 * username_len, privatekeydata_len = \ * len(b_username), len(privatekeyfiledata) # <<<<<<<<<<<<<< @@ -4262,18 +4281,18 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor */ if (unlikely(__pyx_v_b_username == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 238, __pyx_L1_error) + __PYX_ERR(0, 249, __pyx_L1_error) } - __pyx_t_3 = PyBytes_GET_SIZE(__pyx_v_b_username); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 238, __pyx_L1_error) + __pyx_t_3 = PyBytes_GET_SIZE(__pyx_v_b_username); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 249, __pyx_L1_error) if (unlikely(__pyx_v_privatekeyfiledata == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 238, __pyx_L1_error) + __PYX_ERR(0, 249, __pyx_L1_error) } - __pyx_t_4 = PyBytes_GET_SIZE(__pyx_v_privatekeyfiledata); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 238, __pyx_L1_error) + __pyx_t_4 = PyBytes_GET_SIZE(__pyx_v_privatekeyfiledata); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 249, __pyx_L1_error) __pyx_v_username_len = __pyx_t_3; __pyx_v_privatekeydata_len = __pyx_t_4; - /* "ssh2/session.pyx":239 + /* "ssh2/session.pyx":250 * username_len, privatekeydata_len = \ * len(b_username), len(privatekeyfiledata) * if publickeyfiledata is not None: # <<<<<<<<<<<<<< @@ -4284,7 +4303,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor __pyx_t_6 = (__pyx_t_5 != 0); if (__pyx_t_6) { - /* "ssh2/session.pyx":240 + /* "ssh2/session.pyx":251 * len(b_username), len(privatekeyfiledata) * if publickeyfiledata is not None: * _publickeyfiledata = publickeyfiledata # <<<<<<<<<<<<<< @@ -4293,12 +4312,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor */ if (unlikely(__pyx_v_publickeyfiledata == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 240, __pyx_L1_error) + __PYX_ERR(0, 251, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_publickeyfiledata); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 240, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_publickeyfiledata); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 251, __pyx_L1_error) __pyx_v__publickeyfiledata = __pyx_t_2; - /* "ssh2/session.pyx":241 + /* "ssh2/session.pyx":252 * if publickeyfiledata is not None: * _publickeyfiledata = publickeyfiledata * pubkeydata_len = len(publickeyfiledata) # <<<<<<<<<<<<<< @@ -4307,12 +4326,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor */ if (unlikely(__pyx_v_publickeyfiledata == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 241, __pyx_L1_error) + __PYX_ERR(0, 252, __pyx_L1_error) } - __pyx_t_4 = PyBytes_GET_SIZE(__pyx_v_publickeyfiledata); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_t_4 = PyBytes_GET_SIZE(__pyx_v_publickeyfiledata); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 252, __pyx_L1_error) __pyx_v_pubkeydata_len = __pyx_t_4; - /* "ssh2/session.pyx":239 + /* "ssh2/session.pyx":250 * username_len, privatekeydata_len = \ * len(b_username), len(privatekeyfiledata) * if publickeyfiledata is not None: # <<<<<<<<<<<<<< @@ -4321,7 +4340,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor */ } - /* "ssh2/session.pyx":242 + /* "ssh2/session.pyx":253 * _publickeyfiledata = publickeyfiledata * pubkeydata_len = len(publickeyfiledata) * with nogil: # <<<<<<<<<<<<<< @@ -4336,7 +4355,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor #endif /*try:*/ { - /* "ssh2/session.pyx":243 + /* "ssh2/session.pyx":254 * pubkeydata_len = len(publickeyfiledata) * with nogil: * rc = c_ssh2.libssh2_userauth_publickey_frommemory( # <<<<<<<<<<<<<< @@ -4346,7 +4365,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor __pyx_v_rc = libssh2_userauth_publickey_frommemory(__pyx_v_self->_session, __pyx_v__username, __pyx_v_username_len, __pyx_v__publickeyfiledata, __pyx_v_pubkeydata_len, __pyx_v__privatekeyfiledata, __pyx_v_privatekeydata_len, __pyx_v__passphrase); } - /* "ssh2/session.pyx":242 + /* "ssh2/session.pyx":253 * _publickeyfiledata = publickeyfiledata * pubkeydata_len = len(publickeyfiledata) * with nogil: # <<<<<<<<<<<<<< @@ -4365,7 +4384,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor } } - /* "ssh2/session.pyx":247 + /* "ssh2/session.pyx":258 * pubkeydata_len, _privatekeyfiledata, * privatekeydata_len, _passphrase) * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -4373,14 +4392,14 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor * def userauth_password(self, username not None, password not None): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_7 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 247, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error) + __pyx_t_7 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 258, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":225 + /* "ssh2/session.pyx":236 * * IF EMBEDDED_LIB: * def userauth_publickey_frommemory( # <<<<<<<<<<<<<< @@ -4401,7 +4420,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor return __pyx_r; } -/* "ssh2/session.pyx":249 +/* "ssh2/session.pyx":260 * return handle_error_codes(rc) * * def userauth_password(self, username not None, password not None): # <<<<<<<<<<<<<< @@ -4444,11 +4463,11 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_31userauth_password(PyObject * case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_password)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("userauth_password", 1, 2, 2, 1); __PYX_ERR(0, 249, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_password", 1, 2, 2, 1); __PYX_ERR(0, 260, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_password") < 0)) __PYX_ERR(0, 249, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_password") < 0)) __PYX_ERR(0, 260, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -4461,17 +4480,17 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_31userauth_password(PyObject * } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("userauth_password", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 249, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_password", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 260, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.userauth_password", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(((PyObject *)__pyx_v_username) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 249, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 260, __pyx_L1_error) } if (unlikely(((PyObject *)__pyx_v_password) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "password"); __PYX_ERR(0, 249, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "password"); __PYX_ERR(0, 260, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_30userauth_password(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_username, __pyx_v_password); @@ -4501,31 +4520,31 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_30userauth_password(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_password", 0); - /* "ssh2/session.pyx":257 + /* "ssh2/session.pyx":268 * :type password: str""" * cdef int rc * cdef bytes b_username = to_bytes(username) # <<<<<<<<<<<<<< * cdef bytes b_password = to_bytes(password) * cdef const char *_username = b_username */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":258 + /* "ssh2/session.pyx":269 * cdef int rc * cdef bytes b_username = to_bytes(username) * cdef bytes b_password = to_bytes(password) # <<<<<<<<<<<<<< * cdef const char *_username = b_username * cdef const char *_password = b_password */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_password); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_password); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_password = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":259 + /* "ssh2/session.pyx":270 * cdef bytes b_username = to_bytes(username) * cdef bytes b_password = to_bytes(password) * cdef const char *_username = b_username # <<<<<<<<<<<<<< @@ -4534,12 +4553,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_30userauth_password(struct __p */ if (unlikely(__pyx_v_b_username == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 259, __pyx_L1_error) + __PYX_ERR(0, 270, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 259, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 270, __pyx_L1_error) __pyx_v__username = __pyx_t_2; - /* "ssh2/session.pyx":260 + /* "ssh2/session.pyx":271 * cdef bytes b_password = to_bytes(password) * cdef const char *_username = b_username * cdef const char *_password = b_password # <<<<<<<<<<<<<< @@ -4548,12 +4567,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_30userauth_password(struct __p */ if (unlikely(__pyx_v_b_password == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 260, __pyx_L1_error) + __PYX_ERR(0, 271, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyBytes_AsString(__pyx_v_b_password); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 260, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBytes_AsString(__pyx_v_b_password); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 271, __pyx_L1_error) __pyx_v__password = __pyx_t_3; - /* "ssh2/session.pyx":261 + /* "ssh2/session.pyx":272 * cdef const char *_username = b_username * cdef const char *_password = b_password * with nogil: # <<<<<<<<<<<<<< @@ -4568,7 +4587,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_30userauth_password(struct __p #endif /*try:*/ { - /* "ssh2/session.pyx":262 + /* "ssh2/session.pyx":273 * cdef const char *_password = b_password * with nogil: * rc = c_ssh2.libssh2_userauth_password( # <<<<<<<<<<<<<< @@ -4578,7 +4597,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_30userauth_password(struct __p __pyx_v_rc = libssh2_userauth_password(__pyx_v_self->_session, __pyx_v__username, __pyx_v__password); } - /* "ssh2/session.pyx":261 + /* "ssh2/session.pyx":272 * cdef const char *_username = b_username * cdef const char *_password = b_password * with nogil: # <<<<<<<<<<<<<< @@ -4597,7 +4616,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_30userauth_password(struct __p } } - /* "ssh2/session.pyx":264 + /* "ssh2/session.pyx":275 * rc = c_ssh2.libssh2_userauth_password( * self._session, _username, _password) * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -4605,14 +4624,14 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_30userauth_password(struct __p * def userauth_keyboardinteractive(self, username not None, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 264, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L1_error) + __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 275, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":249 + /* "ssh2/session.pyx":260 * return handle_error_codes(rc) * * def userauth_password(self, username not None, password not None): # <<<<<<<<<<<<<< @@ -4633,7 +4652,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_30userauth_password(struct __p return __pyx_r; } -/* "ssh2/session.pyx":266 +/* "ssh2/session.pyx":277 * return handle_error_codes(rc) * * def userauth_keyboardinteractive(self, username not None, # <<<<<<<<<<<<<< @@ -4676,11 +4695,11 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_33userauth_keyboardinteractive case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_password)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("userauth_keyboardinteractive", 1, 2, 2, 1); __PYX_ERR(0, 266, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_keyboardinteractive", 1, 2, 2, 1); __PYX_ERR(0, 277, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_keyboardinteractive") < 0)) __PYX_ERR(0, 266, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_keyboardinteractive") < 0)) __PYX_ERR(0, 277, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -4693,17 +4712,17 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_33userauth_keyboardinteractive } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("userauth_keyboardinteractive", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 266, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_keyboardinteractive", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 277, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.userauth_keyboardinteractive", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(((PyObject *)__pyx_v_username) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 266, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 277, __pyx_L1_error) } if (unlikely(((PyObject *)__pyx_v_password) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "password"); __PYX_ERR(0, 267, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "password"); __PYX_ERR(0, 278, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_32userauth_keyboardinteractive(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_username, __pyx_v_password); @@ -4733,31 +4752,31 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_32userauth_keyboardinteractive int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_keyboardinteractive", 0); - /* "ssh2/session.pyx":276 + /* "ssh2/session.pyx":287 * """ * cdef int rc * cdef bytes b_username = to_bytes(username) # <<<<<<<<<<<<<< * cdef bytes b_password = to_bytes(password) * cdef const char *_username = b_username */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 276, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":277 + /* "ssh2/session.pyx":288 * cdef int rc * cdef bytes b_username = to_bytes(username) * cdef bytes b_password = to_bytes(password) # <<<<<<<<<<<<<< * cdef const char *_username = b_username * cdef const char *_password = b_password */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_password); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 277, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_password); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 288, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_password = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":278 + /* "ssh2/session.pyx":289 * cdef bytes b_username = to_bytes(username) * cdef bytes b_password = to_bytes(password) * cdef const char *_username = b_username # <<<<<<<<<<<<<< @@ -4766,12 +4785,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_32userauth_keyboardinteractive */ if (unlikely(__pyx_v_b_username == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 278, __pyx_L1_error) + __PYX_ERR(0, 289, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 278, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 289, __pyx_L1_error) __pyx_v__username = __pyx_t_2; - /* "ssh2/session.pyx":279 + /* "ssh2/session.pyx":290 * cdef bytes b_password = to_bytes(password) * cdef const char *_username = b_username * cdef const char *_password = b_password # <<<<<<<<<<<<<< @@ -4780,12 +4799,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_32userauth_keyboardinteractive */ if (unlikely(__pyx_v_b_password == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 279, __pyx_L1_error) + __PYX_ERR(0, 290, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyBytes_AsString(__pyx_v_b_password); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 279, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBytes_AsString(__pyx_v_b_password); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 290, __pyx_L1_error) __pyx_v__password = __pyx_t_3; - /* "ssh2/session.pyx":280 + /* "ssh2/session.pyx":291 * cdef const char *_username = b_username * cdef const char *_password = b_password * with nogil: # <<<<<<<<<<<<<< @@ -4800,7 +4819,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_32userauth_keyboardinteractive #endif /*try:*/ { - /* "ssh2/session.pyx":281 + /* "ssh2/session.pyx":292 * cdef const char *_password = b_password * with nogil: * rc = c_ssh2.libssh2_userauth_keyboard_interactive( # <<<<<<<<<<<<<< @@ -4810,7 +4829,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_32userauth_keyboardinteractive __pyx_v_rc = libssh2_userauth_keyboard_interactive(__pyx_v_self->_session, __pyx_v__username, __pyx_v__password); } - /* "ssh2/session.pyx":280 + /* "ssh2/session.pyx":291 * cdef const char *_username = b_username * cdef const char *_password = b_password * with nogil: # <<<<<<<<<<<<<< @@ -4829,7 +4848,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_32userauth_keyboardinteractive } } - /* "ssh2/session.pyx":283 + /* "ssh2/session.pyx":294 * rc = c_ssh2.libssh2_userauth_keyboard_interactive( * self._session, _username, _password) * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -4837,14 +4856,14 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_32userauth_keyboardinteractive * def agent_init(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 283, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __pyx_L1_error) + __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 294, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 294, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":266 + /* "ssh2/session.pyx":277 * return handle_error_codes(rc) * * def userauth_keyboardinteractive(self, username not None, # <<<<<<<<<<<<<< @@ -4865,7 +4884,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_32userauth_keyboardinteractive return __pyx_r; } -/* "ssh2/session.pyx":285 +/* "ssh2/session.pyx":296 * return handle_error_codes(rc) * * def agent_init(self): # <<<<<<<<<<<<<< @@ -4898,7 +4917,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_34agent_init(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("agent_init", 0); - /* "ssh2/session.pyx":291 + /* "ssh2/session.pyx":302 * """ * cdef c_ssh2.LIBSSH2_AGENT *agent * with nogil: # <<<<<<<<<<<<<< @@ -4913,18 +4932,18 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_34agent_init(struct __pyx_obj_ #endif /*try:*/ { - /* "ssh2/session.pyx":292 + /* "ssh2/session.pyx":303 * cdef c_ssh2.LIBSSH2_AGENT *agent * with nogil: * agent = agent_init(self._session) # <<<<<<<<<<<<<< * return PyAgent(agent, self) * */ - __pyx_t_1 = __pyx_f_4ssh2_5agent_agent_init(__pyx_v_self->_session); if (unlikely(__pyx_t_1 == ((LIBSSH2_AGENT *)NULL))) __PYX_ERR(0, 292, __pyx_L4_error) + __pyx_t_1 = __pyx_f_4ssh2_5agent_agent_init(__pyx_v_self->_session); if (unlikely(__pyx_t_1 == ((LIBSSH2_AGENT *)NULL))) __PYX_ERR(0, 303, __pyx_L4_error) __pyx_v_agent = __pyx_t_1; } - /* "ssh2/session.pyx":291 + /* "ssh2/session.pyx":302 * """ * cdef c_ssh2.LIBSSH2_AGENT *agent * with nogil: # <<<<<<<<<<<<<< @@ -4950,7 +4969,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_34agent_init(struct __pyx_obj_ } } - /* "ssh2/session.pyx":293 + /* "ssh2/session.pyx":304 * with nogil: * agent = agent_init(self._session) * return PyAgent(agent, self) # <<<<<<<<<<<<<< @@ -4958,13 +4977,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_34agent_init(struct __pyx_obj_ * def agent_auth(self, username not None): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_f_4ssh2_5agent_PyAgent(__pyx_v_agent, __pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 293, __pyx_L1_error) + __pyx_t_2 = __pyx_f_4ssh2_5agent_PyAgent(__pyx_v_agent, __pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 304, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":285 + /* "ssh2/session.pyx":296 * return handle_error_codes(rc) * * def agent_init(self): # <<<<<<<<<<<<<< @@ -4983,7 +5002,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_34agent_init(struct __pyx_obj_ return __pyx_r; } -/* "ssh2/session.pyx":295 +/* "ssh2/session.pyx":306 * return PyAgent(agent, self) * * def agent_auth(self, username not None): # <<<<<<<<<<<<<< @@ -5002,7 +5021,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_37agent_auth(PyObject *__pyx_v __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("agent_auth (wrapper)", 0); if (unlikely(((PyObject *)__pyx_v_username) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 295, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 306, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_36agent_auth(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), ((PyObject *)__pyx_v_username)); @@ -5032,19 +5051,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("agent_auth", 0); - /* "ssh2/session.pyx":321 + /* "ssh2/session.pyx":332 * * :rtype: None""" * cdef bytes b_username = to_bytes(username) # <<<<<<<<<<<<<< * cdef char *_username = b_username * cdef c_ssh2.LIBSSH2_AGENT *agent = NULL */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 332, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":322 + /* "ssh2/session.pyx":333 * :rtype: None""" * cdef bytes b_username = to_bytes(username) * cdef char *_username = b_username # <<<<<<<<<<<<<< @@ -5053,12 +5072,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ */ if (unlikely(__pyx_v_b_username == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 322, __pyx_L1_error) + __PYX_ERR(0, 333, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 322, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 333, __pyx_L1_error) __pyx_v__username = __pyx_t_2; - /* "ssh2/session.pyx":323 + /* "ssh2/session.pyx":334 * cdef bytes b_username = to_bytes(username) * cdef char *_username = b_username * cdef c_ssh2.LIBSSH2_AGENT *agent = NULL # <<<<<<<<<<<<<< @@ -5067,7 +5086,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ */ __pyx_v_agent = NULL; - /* "ssh2/session.pyx":324 + /* "ssh2/session.pyx":335 * cdef char *_username = b_username * cdef c_ssh2.LIBSSH2_AGENT *agent = NULL * cdef c_ssh2.libssh2_agent_publickey *identity = NULL # <<<<<<<<<<<<<< @@ -5076,7 +5095,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ */ __pyx_v_identity = NULL; - /* "ssh2/session.pyx":325 + /* "ssh2/session.pyx":336 * cdef c_ssh2.LIBSSH2_AGENT *agent = NULL * cdef c_ssh2.libssh2_agent_publickey *identity = NULL * cdef c_ssh2.libssh2_agent_publickey *prev = NULL # <<<<<<<<<<<<<< @@ -5085,17 +5104,17 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ */ __pyx_v_prev = NULL; - /* "ssh2/session.pyx":326 + /* "ssh2/session.pyx":337 * cdef c_ssh2.libssh2_agent_publickey *identity = NULL * cdef c_ssh2.libssh2_agent_publickey *prev = NULL * agent = init_connect_agent(self._session) # <<<<<<<<<<<<<< * with nogil: * agent_auth(_username, agent) */ - __pyx_t_3 = __pyx_f_4ssh2_5agent_init_connect_agent(__pyx_v_self->_session); if (unlikely(__pyx_t_3 == ((LIBSSH2_AGENT *)NULL))) __PYX_ERR(0, 326, __pyx_L1_error) + __pyx_t_3 = __pyx_f_4ssh2_5agent_init_connect_agent(__pyx_v_self->_session); if (unlikely(__pyx_t_3 == ((LIBSSH2_AGENT *)NULL))) __PYX_ERR(0, 337, __pyx_L1_error) __pyx_v_agent = __pyx_t_3; - /* "ssh2/session.pyx":327 + /* "ssh2/session.pyx":338 * cdef c_ssh2.libssh2_agent_publickey *prev = NULL * agent = init_connect_agent(self._session) * with nogil: # <<<<<<<<<<<<<< @@ -5110,17 +5129,17 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ #endif /*try:*/ { - /* "ssh2/session.pyx":328 + /* "ssh2/session.pyx":339 * agent = init_connect_agent(self._session) * with nogil: * agent_auth(_username, agent) # <<<<<<<<<<<<<< * * def open_session(self): */ - __pyx_t_4 = __pyx_f_4ssh2_5agent_agent_auth(__pyx_v__username, __pyx_v_agent); if (unlikely(__pyx_t_4 == ((int)1))) __PYX_ERR(0, 328, __pyx_L4_error) + __pyx_t_4 = __pyx_f_4ssh2_5agent_agent_auth(__pyx_v__username, __pyx_v_agent); if (unlikely(__pyx_t_4 == ((int)1))) __PYX_ERR(0, 339, __pyx_L4_error) } - /* "ssh2/session.pyx":327 + /* "ssh2/session.pyx":338 * cdef c_ssh2.libssh2_agent_publickey *prev = NULL * agent = init_connect_agent(self._session) * with nogil: # <<<<<<<<<<<<<< @@ -5146,7 +5165,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ } } - /* "ssh2/session.pyx":295 + /* "ssh2/session.pyx":306 * return PyAgent(agent, self) * * def agent_auth(self, username not None): # <<<<<<<<<<<<<< @@ -5168,7 +5187,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ return __pyx_r; } -/* "ssh2/session.pyx":330 +/* "ssh2/session.pyx":341 * agent_auth(_username, agent) * * def open_session(self): # <<<<<<<<<<<<<< @@ -5202,7 +5221,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob int __pyx_clineno = 0; __Pyx_RefNannySetupContext("open_session", 0); - /* "ssh2/session.pyx":336 + /* "ssh2/session.pyx":347 * """ * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -5217,7 +5236,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob #endif /*try:*/ { - /* "ssh2/session.pyx":337 + /* "ssh2/session.pyx":348 * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: * channel = c_ssh2.libssh2_channel_open_session( # <<<<<<<<<<<<<< @@ -5227,7 +5246,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob __pyx_v_channel = libssh2_channel_open_session(__pyx_v_self->_session); } - /* "ssh2/session.pyx":336 + /* "ssh2/session.pyx":347 * """ * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -5246,7 +5265,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob } } - /* "ssh2/session.pyx":339 + /* "ssh2/session.pyx":350 * channel = c_ssh2.libssh2_channel_open_session( * self._session) * if channel is NULL: # <<<<<<<<<<<<<< @@ -5256,7 +5275,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob __pyx_t_1 = ((__pyx_v_channel == NULL) != 0); if (__pyx_t_1) { - /* "ssh2/session.pyx":340 + /* "ssh2/session.pyx":351 * self._session) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -5265,29 +5284,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":341 + /* "ssh2/session.pyx":352 * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) # <<<<<<<<<<<<<< * return PyChannel(channel, self) * */ - __pyx_t_2 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 340, __pyx_L1_error) + __pyx_t_2 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 351, __pyx_L1_error) - /* "ssh2/session.pyx":340 + /* "ssh2/session.pyx":351 * self._session) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< * self._session)) * return PyChannel(channel, self) */ - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 340, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 351, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":339 + /* "ssh2/session.pyx":350 * channel = c_ssh2.libssh2_channel_open_session( * self._session) * if channel is NULL: # <<<<<<<<<<<<<< @@ -5296,7 +5315,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob */ } - /* "ssh2/session.pyx":342 + /* "ssh2/session.pyx":353 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self) # <<<<<<<<<<<<<< @@ -5304,13 +5323,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob * def direct_tcpip_ex(self, host not None, int port, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 342, __pyx_L1_error) + __pyx_t_3 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 353, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":330 + /* "ssh2/session.pyx":341 * agent_auth(_username, agent) * * def open_session(self): # <<<<<<<<<<<<<< @@ -5329,7 +5348,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob return __pyx_r; } -/* "ssh2/session.pyx":344 +/* "ssh2/session.pyx":355 * return PyChannel(channel, self) * * def direct_tcpip_ex(self, host not None, int port, # <<<<<<<<<<<<<< @@ -5378,23 +5397,23 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_41direct_tcpip_ex(PyObject *__ case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_port)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, 1); __PYX_ERR(0, 344, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, 1); __PYX_ERR(0, 355, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shost)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, 2); __PYX_ERR(0, 344, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, 2); __PYX_ERR(0, 355, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sport)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, 3); __PYX_ERR(0, 344, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, 3); __PYX_ERR(0, 355, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "direct_tcpip_ex") < 0)) __PYX_ERR(0, 344, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "direct_tcpip_ex") < 0)) __PYX_ERR(0, 355, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -5405,23 +5424,23 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_41direct_tcpip_ex(PyObject *__ values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_host = values[0]; - __pyx_v_port = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 344, __pyx_L3_error) + __pyx_v_port = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 355, __pyx_L3_error) __pyx_v_shost = values[2]; - __pyx_v_sport = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_sport == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 345, __pyx_L3_error) + __pyx_v_sport = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_sport == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 356, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 344, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 355, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.direct_tcpip_ex", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(((PyObject *)__pyx_v_host) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "host"); __PYX_ERR(0, 344, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "host"); __PYX_ERR(0, 355, __pyx_L1_error) } if (unlikely(((PyObject *)__pyx_v_shost) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "shost"); __PYX_ERR(0, 345, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "shost"); __PYX_ERR(0, 356, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_host, __pyx_v_port, __pyx_v_shost, __pyx_v_sport); @@ -5451,31 +5470,31 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("direct_tcpip_ex", 0); - /* "ssh2/session.pyx":347 + /* "ssh2/session.pyx":358 * shost not None, int sport): * cdef c_ssh2.LIBSSH2_CHANNEL *channel * cdef bytes b_host = to_bytes(host) # <<<<<<<<<<<<<< * cdef bytes b_shost = to_bytes(shost) * cdef char *_host = b_host */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_host); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 347, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_host); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 358, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_host = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":348 + /* "ssh2/session.pyx":359 * cdef c_ssh2.LIBSSH2_CHANNEL *channel * cdef bytes b_host = to_bytes(host) * cdef bytes b_shost = to_bytes(shost) # <<<<<<<<<<<<<< * cdef char *_host = b_host * cdef char *_shost = b_shost */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_shost); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 348, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_shost); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 359, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_shost = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":349 + /* "ssh2/session.pyx":360 * cdef bytes b_host = to_bytes(host) * cdef bytes b_shost = to_bytes(shost) * cdef char *_host = b_host # <<<<<<<<<<<<<< @@ -5484,12 +5503,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx */ if (unlikely(__pyx_v_b_host == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 349, __pyx_L1_error) + __PYX_ERR(0, 360, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_host); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 349, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_host); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 360, __pyx_L1_error) __pyx_v__host = __pyx_t_2; - /* "ssh2/session.pyx":350 + /* "ssh2/session.pyx":361 * cdef bytes b_shost = to_bytes(shost) * cdef char *_host = b_host * cdef char *_shost = b_shost # <<<<<<<<<<<<<< @@ -5498,12 +5517,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx */ if (unlikely(__pyx_v_b_shost == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 350, __pyx_L1_error) + __PYX_ERR(0, 361, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_shost); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 350, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_shost); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 361, __pyx_L1_error) __pyx_v__shost = __pyx_t_2; - /* "ssh2/session.pyx":351 + /* "ssh2/session.pyx":362 * cdef char *_host = b_host * cdef char *_shost = b_shost * with nogil: # <<<<<<<<<<<<<< @@ -5518,7 +5537,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx #endif /*try:*/ { - /* "ssh2/session.pyx":352 + /* "ssh2/session.pyx":363 * cdef char *_shost = b_shost * with nogil: * channel = c_ssh2.libssh2_channel_direct_tcpip_ex( # <<<<<<<<<<<<<< @@ -5528,7 +5547,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx __pyx_v_channel = libssh2_channel_direct_tcpip_ex(__pyx_v_self->_session, __pyx_v__host, __pyx_v_port, __pyx_v__shost, __pyx_v_sport); } - /* "ssh2/session.pyx":351 + /* "ssh2/session.pyx":362 * cdef char *_host = b_host * cdef char *_shost = b_shost * with nogil: # <<<<<<<<<<<<<< @@ -5547,7 +5566,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx } } - /* "ssh2/session.pyx":354 + /* "ssh2/session.pyx":365 * channel = c_ssh2.libssh2_channel_direct_tcpip_ex( * self._session, _host, port, _shost, sport) * if channel is NULL: # <<<<<<<<<<<<<< @@ -5557,7 +5576,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx __pyx_t_3 = ((__pyx_v_channel == NULL) != 0); if (__pyx_t_3) { - /* "ssh2/session.pyx":355 + /* "ssh2/session.pyx":366 * self._session, _host, port, _shost, sport) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -5566,29 +5585,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":356 + /* "ssh2/session.pyx":367 * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) # <<<<<<<<<<<<<< * return PyChannel(channel, self) * */ - __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 355, __pyx_L1_error) + __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 366, __pyx_L1_error) - /* "ssh2/session.pyx":355 + /* "ssh2/session.pyx":366 * self._session, _host, port, _shost, sport) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< * self._session)) * return PyChannel(channel, self) */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":354 + /* "ssh2/session.pyx":365 * channel = c_ssh2.libssh2_channel_direct_tcpip_ex( * self._session, _host, port, _shost, sport) * if channel is NULL: # <<<<<<<<<<<<<< @@ -5597,7 +5616,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx */ } - /* "ssh2/session.pyx":357 + /* "ssh2/session.pyx":368 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self) # <<<<<<<<<<<<<< @@ -5605,13 +5624,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx * def direct_tcpip(self, host not None, int port): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 357, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":344 + /* "ssh2/session.pyx":355 * return PyChannel(channel, self) * * def direct_tcpip_ex(self, host not None, int port, # <<<<<<<<<<<<<< @@ -5632,7 +5651,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx return __pyx_r; } -/* "ssh2/session.pyx":359 +/* "ssh2/session.pyx":370 * return PyChannel(channel, self) * * def direct_tcpip(self, host not None, int port): # <<<<<<<<<<<<<< @@ -5675,11 +5694,11 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_43direct_tcpip(PyObject *__pyx case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_port)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("direct_tcpip", 1, 2, 2, 1); __PYX_ERR(0, 359, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("direct_tcpip", 1, 2, 2, 1); __PYX_ERR(0, 370, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "direct_tcpip") < 0)) __PYX_ERR(0, 359, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "direct_tcpip") < 0)) __PYX_ERR(0, 370, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -5688,18 +5707,18 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_43direct_tcpip(PyObject *__pyx values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_host = values[0]; - __pyx_v_port = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 359, __pyx_L3_error) + __pyx_v_port = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 370, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("direct_tcpip", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 359, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("direct_tcpip", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 370, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.direct_tcpip", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(((PyObject *)__pyx_v_host) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "host"); __PYX_ERR(0, 359, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "host"); __PYX_ERR(0, 370, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_42direct_tcpip(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_host, __pyx_v_port); @@ -5727,19 +5746,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob int __pyx_clineno = 0; __Pyx_RefNannySetupContext("direct_tcpip", 0); - /* "ssh2/session.pyx":366 + /* "ssh2/session.pyx":377 * """ * cdef c_ssh2.LIBSSH2_CHANNEL *channel * cdef bytes b_host = to_bytes(host) # <<<<<<<<<<<<<< * cdef char *_host = b_host * with nogil: */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_host); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_host); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 377, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_host = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":367 + /* "ssh2/session.pyx":378 * cdef c_ssh2.LIBSSH2_CHANNEL *channel * cdef bytes b_host = to_bytes(host) * cdef char *_host = b_host # <<<<<<<<<<<<<< @@ -5748,12 +5767,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob */ if (unlikely(__pyx_v_b_host == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 367, __pyx_L1_error) + __PYX_ERR(0, 378, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_host); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 367, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_host); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 378, __pyx_L1_error) __pyx_v__host = __pyx_t_2; - /* "ssh2/session.pyx":368 + /* "ssh2/session.pyx":379 * cdef bytes b_host = to_bytes(host) * cdef char *_host = b_host * with nogil: # <<<<<<<<<<<<<< @@ -5768,7 +5787,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob #endif /*try:*/ { - /* "ssh2/session.pyx":369 + /* "ssh2/session.pyx":380 * cdef char *_host = b_host * with nogil: * channel = c_ssh2.libssh2_channel_direct_tcpip( # <<<<<<<<<<<<<< @@ -5778,7 +5797,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob __pyx_v_channel = libssh2_channel_direct_tcpip(__pyx_v_self->_session, __pyx_v__host, __pyx_v_port); } - /* "ssh2/session.pyx":368 + /* "ssh2/session.pyx":379 * cdef bytes b_host = to_bytes(host) * cdef char *_host = b_host * with nogil: # <<<<<<<<<<<<<< @@ -5797,7 +5816,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob } } - /* "ssh2/session.pyx":371 + /* "ssh2/session.pyx":382 * channel = c_ssh2.libssh2_channel_direct_tcpip( * self._session, _host, port) * if channel is NULL: # <<<<<<<<<<<<<< @@ -5807,7 +5826,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob __pyx_t_3 = ((__pyx_v_channel == NULL) != 0); if (__pyx_t_3) { - /* "ssh2/session.pyx":372 + /* "ssh2/session.pyx":383 * self._session, _host, port) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -5816,29 +5835,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":373 + /* "ssh2/session.pyx":384 * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) # <<<<<<<<<<<<<< * return PyChannel(channel, self) * */ - __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 372, __pyx_L1_error) + __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 383, __pyx_L1_error) - /* "ssh2/session.pyx":372 + /* "ssh2/session.pyx":383 * self._session, _host, port) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< * self._session)) * return PyChannel(channel, self) */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 372, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":371 + /* "ssh2/session.pyx":382 * channel = c_ssh2.libssh2_channel_direct_tcpip( * self._session, _host, port) * if channel is NULL: # <<<<<<<<<<<<<< @@ -5847,7 +5866,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob */ } - /* "ssh2/session.pyx":374 + /* "ssh2/session.pyx":385 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self) # <<<<<<<<<<<<<< @@ -5855,13 +5874,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob * def block_directions(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 374, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 385, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":359 + /* "ssh2/session.pyx":370 * return PyChannel(channel, self) * * def direct_tcpip(self, host not None, int port): # <<<<<<<<<<<<<< @@ -5881,7 +5900,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob return __pyx_r; } -/* "ssh2/session.pyx":376 +/* "ssh2/session.pyx":387 * return PyChannel(channel, self) * * def block_directions(self): # <<<<<<<<<<<<<< @@ -5913,7 +5932,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_44block_directions(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("block_directions", 0); - /* "ssh2/session.pyx":398 + /* "ssh2/session.pyx":409 * :rtype: int""" * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -5928,7 +5947,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_44block_directions(struct __py #endif /*try:*/ { - /* "ssh2/session.pyx":399 + /* "ssh2/session.pyx":410 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_session_block_directions( # <<<<<<<<<<<<<< @@ -5938,7 +5957,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_44block_directions(struct __py __pyx_v_rc = libssh2_session_block_directions(__pyx_v_self->_session); } - /* "ssh2/session.pyx":398 + /* "ssh2/session.pyx":409 * :rtype: int""" * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -5957,7 +5976,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_44block_directions(struct __py } } - /* "ssh2/session.pyx":401 + /* "ssh2/session.pyx":412 * rc = c_ssh2.libssh2_session_block_directions( * self._session) * return rc # <<<<<<<<<<<<<< @@ -5965,13 +5984,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_44block_directions(struct __py * def forward_listen(self, int port): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 401, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 412, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":376 + /* "ssh2/session.pyx":387 * return PyChannel(channel, self) * * def block_directions(self): # <<<<<<<<<<<<<< @@ -5990,7 +6009,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_44block_directions(struct __py return __pyx_r; } -/* "ssh2/session.pyx":403 +/* "ssh2/session.pyx":414 * return rc * * def forward_listen(self, int port): # <<<<<<<<<<<<<< @@ -6010,7 +6029,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_47forward_listen(PyObject *__p __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("forward_listen (wrapper)", 0); assert(__pyx_arg_port); { - __pyx_v_port = __Pyx_PyInt_As_int(__pyx_arg_port); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 403, __pyx_L3_error) + __pyx_v_port = __Pyx_PyInt_As_int(__pyx_arg_port); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 414, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -6037,7 +6056,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("forward_listen", 0); - /* "ssh2/session.pyx":411 + /* "ssh2/session.pyx":422 * :rtype: :py:class:`ssh2.listener.Listener` or None""" * cdef c_ssh2.LIBSSH2_LISTENER *listener * with nogil: # <<<<<<<<<<<<<< @@ -6052,7 +6071,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ #endif /*try:*/ { - /* "ssh2/session.pyx":412 + /* "ssh2/session.pyx":423 * cdef c_ssh2.LIBSSH2_LISTENER *listener * with nogil: * listener = c_ssh2.libssh2_channel_forward_listen( # <<<<<<<<<<<<<< @@ -6062,7 +6081,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ __pyx_v_listener = libssh2_channel_forward_listen(__pyx_v_self->_session, __pyx_v_port); } - /* "ssh2/session.pyx":411 + /* "ssh2/session.pyx":422 * :rtype: :py:class:`ssh2.listener.Listener` or None""" * cdef c_ssh2.LIBSSH2_LISTENER *listener * with nogil: # <<<<<<<<<<<<<< @@ -6081,7 +6100,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ } } - /* "ssh2/session.pyx":414 + /* "ssh2/session.pyx":425 * listener = c_ssh2.libssh2_channel_forward_listen( * self._session, port) * if listener is NULL: # <<<<<<<<<<<<<< @@ -6091,7 +6110,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ __pyx_t_1 = ((__pyx_v_listener == NULL) != 0); if (__pyx_t_1) { - /* "ssh2/session.pyx":415 + /* "ssh2/session.pyx":426 * self._session, port) * if listener is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -6100,29 +6119,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":416 + /* "ssh2/session.pyx":427 * if listener is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) # <<<<<<<<<<<<<< * return PyListener(listener, self) * */ - __pyx_t_2 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 415, __pyx_L1_error) + __pyx_t_2 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 426, __pyx_L1_error) - /* "ssh2/session.pyx":415 + /* "ssh2/session.pyx":426 * self._session, port) * if listener is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< * self._session)) * return PyListener(listener, self) */ - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 415, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 426, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":414 + /* "ssh2/session.pyx":425 * listener = c_ssh2.libssh2_channel_forward_listen( * self._session, port) * if listener is NULL: # <<<<<<<<<<<<<< @@ -6131,7 +6150,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ */ } - /* "ssh2/session.pyx":417 + /* "ssh2/session.pyx":428 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyListener(listener, self) # <<<<<<<<<<<<<< @@ -6139,13 +6158,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ * def forward_listen_ex(self, host not None, int port, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_f_4ssh2_8listener_PyListener(__pyx_v_listener, __pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 417, __pyx_L1_error) + __pyx_t_3 = __pyx_f_4ssh2_8listener_PyListener(__pyx_v_listener, __pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 428, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":403 + /* "ssh2/session.pyx":414 * return rc * * def forward_listen(self, int port): # <<<<<<<<<<<<<< @@ -6164,7 +6183,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ return __pyx_r; } -/* "ssh2/session.pyx":419 +/* "ssh2/session.pyx":430 * return PyListener(listener, self) * * def forward_listen_ex(self, host not None, int port, # <<<<<<<<<<<<<< @@ -6213,23 +6232,23 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_49forward_listen_ex(PyObject * case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_port)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("forward_listen_ex", 1, 4, 4, 1); __PYX_ERR(0, 419, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("forward_listen_ex", 1, 4, 4, 1); __PYX_ERR(0, 430, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bound_port)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("forward_listen_ex", 1, 4, 4, 2); __PYX_ERR(0, 419, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("forward_listen_ex", 1, 4, 4, 2); __PYX_ERR(0, 430, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_queue_maxsize)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("forward_listen_ex", 1, 4, 4, 3); __PYX_ERR(0, 419, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("forward_listen_ex", 1, 4, 4, 3); __PYX_ERR(0, 430, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "forward_listen_ex") < 0)) __PYX_ERR(0, 419, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "forward_listen_ex") < 0)) __PYX_ERR(0, 430, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -6240,20 +6259,20 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_49forward_listen_ex(PyObject * values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_host = values[0]; - __pyx_v_port = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 419, __pyx_L3_error) - __pyx_v_bound_port = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_bound_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 420, __pyx_L3_error) - __pyx_v_queue_maxsize = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_queue_maxsize == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 420, __pyx_L3_error) + __pyx_v_port = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 430, __pyx_L3_error) + __pyx_v_bound_port = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_bound_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 431, __pyx_L3_error) + __pyx_v_queue_maxsize = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_queue_maxsize == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 431, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("forward_listen_ex", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 419, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("forward_listen_ex", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 430, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.forward_listen_ex", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(((PyObject *)__pyx_v_host) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "host"); __PYX_ERR(0, 419, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "host"); __PYX_ERR(0, 430, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_host, __pyx_v_port, __pyx_v_bound_port, __pyx_v_queue_maxsize); @@ -6281,19 +6300,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("forward_listen_ex", 0); - /* "ssh2/session.pyx":422 + /* "ssh2/session.pyx":433 * int bound_port, int queue_maxsize): * cdef c_ssh2.LIBSSH2_LISTENER *listener * cdef bytes b_host = to_bytes(host) # <<<<<<<<<<<<<< * cdef char *_host = b_host * with nogil: */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_host); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 422, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_host); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 433, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_host = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":423 + /* "ssh2/session.pyx":434 * cdef c_ssh2.LIBSSH2_LISTENER *listener * cdef bytes b_host = to_bytes(host) * cdef char *_host = b_host # <<<<<<<<<<<<<< @@ -6302,12 +6321,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p */ if (unlikely(__pyx_v_b_host == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 423, __pyx_L1_error) + __PYX_ERR(0, 434, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_host); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 423, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_host); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 434, __pyx_L1_error) __pyx_v__host = __pyx_t_2; - /* "ssh2/session.pyx":424 + /* "ssh2/session.pyx":435 * cdef bytes b_host = to_bytes(host) * cdef char *_host = b_host * with nogil: # <<<<<<<<<<<<<< @@ -6322,7 +6341,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p #endif /*try:*/ { - /* "ssh2/session.pyx":425 + /* "ssh2/session.pyx":436 * cdef char *_host = b_host * with nogil: * listener = c_ssh2.libssh2_channel_forward_listen_ex( # <<<<<<<<<<<<<< @@ -6332,7 +6351,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p __pyx_v_listener = libssh2_channel_forward_listen_ex(__pyx_v_self->_session, __pyx_v__host, __pyx_v_port, (&__pyx_v_bound_port), __pyx_v_queue_maxsize); } - /* "ssh2/session.pyx":424 + /* "ssh2/session.pyx":435 * cdef bytes b_host = to_bytes(host) * cdef char *_host = b_host * with nogil: # <<<<<<<<<<<<<< @@ -6351,7 +6370,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p } } - /* "ssh2/session.pyx":427 + /* "ssh2/session.pyx":438 * listener = c_ssh2.libssh2_channel_forward_listen_ex( * self._session, _host, port, &bound_port, queue_maxsize) * if listener is NULL: # <<<<<<<<<<<<<< @@ -6361,7 +6380,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p __pyx_t_3 = ((__pyx_v_listener == NULL) != 0); if (__pyx_t_3) { - /* "ssh2/session.pyx":428 + /* "ssh2/session.pyx":439 * self._session, _host, port, &bound_port, queue_maxsize) * if listener is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -6370,29 +6389,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":429 + /* "ssh2/session.pyx":440 * if listener is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) # <<<<<<<<<<<<<< * return PyListener(listener, self) * */ - __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 439, __pyx_L1_error) - /* "ssh2/session.pyx":428 + /* "ssh2/session.pyx":439 * self._session, _host, port, &bound_port, queue_maxsize) * if listener is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< * self._session)) * return PyListener(listener, self) */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":427 + /* "ssh2/session.pyx":438 * listener = c_ssh2.libssh2_channel_forward_listen_ex( * self._session, _host, port, &bound_port, queue_maxsize) * if listener is NULL: # <<<<<<<<<<<<<< @@ -6401,7 +6420,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p */ } - /* "ssh2/session.pyx":430 + /* "ssh2/session.pyx":441 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyListener(listener, self) # <<<<<<<<<<<<<< @@ -6409,13 +6428,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p * def sftp_init(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4ssh2_8listener_PyListener(__pyx_v_listener, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_8listener_PyListener(__pyx_v_listener, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":419 + /* "ssh2/session.pyx":430 * return PyListener(listener, self) * * def forward_listen_ex(self, host not None, int port, # <<<<<<<<<<<<<< @@ -6435,7 +6454,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p return __pyx_r; } -/* "ssh2/session.pyx":432 +/* "ssh2/session.pyx":443 * return PyListener(listener, self) * * def sftp_init(self): # <<<<<<<<<<<<<< @@ -6469,7 +6488,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("sftp_init", 0); - /* "ssh2/session.pyx":438 + /* "ssh2/session.pyx":449 * """ * cdef c_sftp.LIBSSH2_SFTP *_sftp * with nogil: # <<<<<<<<<<<<<< @@ -6484,7 +6503,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 #endif /*try:*/ { - /* "ssh2/session.pyx":439 + /* "ssh2/session.pyx":450 * cdef c_sftp.LIBSSH2_SFTP *_sftp * with nogil: * _sftp = c_sftp.libssh2_sftp_init(self._session) # <<<<<<<<<<<<<< @@ -6494,7 +6513,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 __pyx_v__sftp = libssh2_sftp_init(__pyx_v_self->_session); } - /* "ssh2/session.pyx":438 + /* "ssh2/session.pyx":449 * """ * cdef c_sftp.LIBSSH2_SFTP *_sftp * with nogil: # <<<<<<<<<<<<<< @@ -6513,7 +6532,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 } } - /* "ssh2/session.pyx":440 + /* "ssh2/session.pyx":451 * with nogil: * _sftp = c_sftp.libssh2_sftp_init(self._session) * if _sftp is NULL: # <<<<<<<<<<<<<< @@ -6523,7 +6542,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 __pyx_t_1 = ((__pyx_v__sftp == NULL) != 0); if (__pyx_t_1) { - /* "ssh2/session.pyx":441 + /* "ssh2/session.pyx":452 * _sftp = c_sftp.libssh2_sftp_init(self._session) * if _sftp is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -6532,29 +6551,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":442 + /* "ssh2/session.pyx":453 * if _sftp is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) # <<<<<<<<<<<<<< * return PySFTP(_sftp, self) * */ - __pyx_t_2 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 441, __pyx_L1_error) + __pyx_t_2 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 452, __pyx_L1_error) - /* "ssh2/session.pyx":441 + /* "ssh2/session.pyx":452 * _sftp = c_sftp.libssh2_sftp_init(self._session) * if _sftp is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< * self._session)) * return PySFTP(_sftp, self) */ - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 441, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":440 + /* "ssh2/session.pyx":451 * with nogil: * _sftp = c_sftp.libssh2_sftp_init(self._session) * if _sftp is NULL: # <<<<<<<<<<<<<< @@ -6563,7 +6582,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 */ } - /* "ssh2/session.pyx":443 + /* "ssh2/session.pyx":454 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PySFTP(_sftp, self) # <<<<<<<<<<<<<< @@ -6571,13 +6590,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 * def last_error(self, size_t msg_size=1024): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_f_4ssh2_4sftp_PySFTP(__pyx_v__sftp, __pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 443, __pyx_L1_error) + __pyx_t_3 = __pyx_f_4ssh2_4sftp_PySFTP(__pyx_v__sftp, __pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 454, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":432 + /* "ssh2/session.pyx":443 * return PyListener(listener, self) * * def sftp_init(self): # <<<<<<<<<<<<<< @@ -6596,7 +6615,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 return __pyx_r; } -/* "ssh2/session.pyx":445 +/* "ssh2/session.pyx":456 * return PySFTP(_sftp, self) * * def last_error(self, size_t msg_size=1024): # <<<<<<<<<<<<<< @@ -6636,7 +6655,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_53last_error(PyObject *__pyx_v } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "last_error") < 0)) __PYX_ERR(0, 445, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "last_error") < 0)) __PYX_ERR(0, 456, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -6647,14 +6666,14 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_53last_error(PyObject *__pyx_v } } if (values[0]) { - __pyx_v_msg_size = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_msg_size == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 445, __pyx_L3_error) + __pyx_v_msg_size = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_msg_size == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 456, __pyx_L3_error) } else { __pyx_v_msg_size = ((size_t)0x400); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("last_error", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 445, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("last_error", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 456, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.last_error", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -6689,7 +6708,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("last_error", 0); - /* "ssh2/session.pyx":452 + /* "ssh2/session.pyx":463 * """ * cdef char *_error_msg * cdef bytes msg = b'' # <<<<<<<<<<<<<< @@ -6699,7 +6718,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ __Pyx_INCREF(__pyx_kp_b__2); __pyx_v_msg = __pyx_kp_b__2; - /* "ssh2/session.pyx":453 + /* "ssh2/session.pyx":464 * cdef char *_error_msg * cdef bytes msg = b'' * cdef int errmsg_len = 0 # <<<<<<<<<<<<<< @@ -6708,7 +6727,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ */ __pyx_v_errmsg_len = 0; - /* "ssh2/session.pyx":454 + /* "ssh2/session.pyx":465 * cdef bytes msg = b'' * cdef int errmsg_len = 0 * with nogil: # <<<<<<<<<<<<<< @@ -6723,7 +6742,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ #endif /*try:*/ { - /* "ssh2/session.pyx":455 + /* "ssh2/session.pyx":466 * cdef int errmsg_len = 0 * with nogil: * _error_msg = malloc(sizeof(char) * msg_size) # <<<<<<<<<<<<<< @@ -6732,7 +6751,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ */ __pyx_v__error_msg = ((char *)malloc(((sizeof(char)) * __pyx_v_msg_size))); - /* "ssh2/session.pyx":456 + /* "ssh2/session.pyx":467 * with nogil: * _error_msg = malloc(sizeof(char) * msg_size) * c_ssh2.libssh2_session_last_error( # <<<<<<<<<<<<<< @@ -6742,7 +6761,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ (void)(libssh2_session_last_error(__pyx_v_self->_session, (&__pyx_v__error_msg), (&__pyx_v_errmsg_len), 1)); } - /* "ssh2/session.pyx":454 + /* "ssh2/session.pyx":465 * cdef bytes msg = b'' * cdef int errmsg_len = 0 * with nogil: # <<<<<<<<<<<<<< @@ -6761,7 +6780,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ } } - /* "ssh2/session.pyx":458 + /* "ssh2/session.pyx":469 * c_ssh2.libssh2_session_last_error( * self._session, &_error_msg, &errmsg_len, 1) * try: # <<<<<<<<<<<<<< @@ -6770,7 +6789,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ */ /*try:*/ { - /* "ssh2/session.pyx":459 + /* "ssh2/session.pyx":470 * self._session, &_error_msg, &errmsg_len, 1) * try: * if errmsg_len > 0: # <<<<<<<<<<<<<< @@ -6780,19 +6799,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ __pyx_t_1 = ((__pyx_v_errmsg_len > 0) != 0); if (__pyx_t_1) { - /* "ssh2/session.pyx":460 + /* "ssh2/session.pyx":471 * try: * if errmsg_len > 0: * msg = _error_msg[:errmsg_len] # <<<<<<<<<<<<<< * return msg * finally: */ - __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(__pyx_v__error_msg + 0, __pyx_v_errmsg_len - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 460, __pyx_L7_error) + __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(__pyx_v__error_msg + 0, __pyx_v_errmsg_len - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 471, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF_SET(__pyx_v_msg, ((PyObject*)__pyx_t_2)); __pyx_t_2 = 0; - /* "ssh2/session.pyx":459 + /* "ssh2/session.pyx":470 * self._session, &_error_msg, &errmsg_len, 1) * try: * if errmsg_len > 0: # <<<<<<<<<<<<<< @@ -6801,7 +6820,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ */ } - /* "ssh2/session.pyx":461 + /* "ssh2/session.pyx":472 * if errmsg_len > 0: * msg = _error_msg[:errmsg_len] * return msg # <<<<<<<<<<<<<< @@ -6814,7 +6833,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ goto __pyx_L6_return; } - /* "ssh2/session.pyx":463 + /* "ssh2/session.pyx":474 * return msg * finally: * free(_error_msg) # <<<<<<<<<<<<<< @@ -6864,7 +6883,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ } } - /* "ssh2/session.pyx":445 + /* "ssh2/session.pyx":456 * return PySFTP(_sftp, self) * * def last_error(self, size_t msg_size=1024): # <<<<<<<<<<<<<< @@ -6884,7 +6903,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ return __pyx_r; } -/* "ssh2/session.pyx":465 +/* "ssh2/session.pyx":476 * free(_error_msg) * * def last_errno(self): # <<<<<<<<<<<<<< @@ -6916,7 +6935,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_54last_errno(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("last_errno", 0); - /* "ssh2/session.pyx":472 + /* "ssh2/session.pyx":483 * """ * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -6931,7 +6950,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_54last_errno(struct __pyx_obj_ #endif /*try:*/ { - /* "ssh2/session.pyx":473 + /* "ssh2/session.pyx":484 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -6941,7 +6960,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_54last_errno(struct __pyx_obj_ __pyx_v_rc = libssh2_session_last_errno(__pyx_v_self->_session); } - /* "ssh2/session.pyx":472 + /* "ssh2/session.pyx":483 * """ * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -6960,7 +6979,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_54last_errno(struct __pyx_obj_ } } - /* "ssh2/session.pyx":475 + /* "ssh2/session.pyx":486 * rc = c_ssh2.libssh2_session_last_errno( * self._session) * return rc # <<<<<<<<<<<<<< @@ -6968,13 +6987,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_54last_errno(struct __pyx_obj_ * IF EMBEDDED_LIB: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 475, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":465 + /* "ssh2/session.pyx":476 * free(_error_msg) * * def last_errno(self): # <<<<<<<<<<<<<< @@ -6993,7 +7012,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_54last_errno(struct __pyx_obj_ return __pyx_r; } -/* "ssh2/session.pyx":478 +/* "ssh2/session.pyx":489 * * IF EMBEDDED_LIB: * def set_last_error(self, int errcode, errmsg not None): # <<<<<<<<<<<<<< @@ -7036,11 +7055,11 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_57set_last_error(PyObject *__p case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_errmsg)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("set_last_error", 1, 2, 2, 1); __PYX_ERR(0, 478, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("set_last_error", 1, 2, 2, 1); __PYX_ERR(0, 489, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_last_error") < 0)) __PYX_ERR(0, 478, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_last_error") < 0)) __PYX_ERR(0, 489, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -7048,19 +7067,19 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_57set_last_error(PyObject *__p values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_errcode = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_errcode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 478, __pyx_L3_error) + __pyx_v_errcode = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_errcode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 489, __pyx_L3_error) __pyx_v_errmsg = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_last_error", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 478, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("set_last_error", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 489, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.set_last_error", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(((PyObject *)__pyx_v_errmsg) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "errmsg"); __PYX_ERR(0, 478, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "errmsg"); __PYX_ERR(0, 489, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_56set_last_error(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_errcode, __pyx_v_errmsg); @@ -7086,19 +7105,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_56set_last_error(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set_last_error", 0); - /* "ssh2/session.pyx":479 + /* "ssh2/session.pyx":490 * IF EMBEDDED_LIB: * def set_last_error(self, int errcode, errmsg not None): * cdef bytes b_errmsg = to_bytes(errmsg) # <<<<<<<<<<<<<< * cdef char *_errmsg = b_errmsg * cdef int rc */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_errmsg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 479, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_errmsg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_errmsg = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":480 + /* "ssh2/session.pyx":491 * def set_last_error(self, int errcode, errmsg not None): * cdef bytes b_errmsg = to_bytes(errmsg) * cdef char *_errmsg = b_errmsg # <<<<<<<<<<<<<< @@ -7107,12 +7126,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_56set_last_error(struct __pyx_ */ if (unlikely(__pyx_v_b_errmsg == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 480, __pyx_L1_error) + __PYX_ERR(0, 491, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_errmsg); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 480, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_errmsg); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 491, __pyx_L1_error) __pyx_v__errmsg = __pyx_t_2; - /* "ssh2/session.pyx":482 + /* "ssh2/session.pyx":493 * cdef char *_errmsg = b_errmsg * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -7127,7 +7146,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_56set_last_error(struct __pyx_ #endif /*try:*/ { - /* "ssh2/session.pyx":483 + /* "ssh2/session.pyx":494 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_session_set_last_error( # <<<<<<<<<<<<<< @@ -7137,7 +7156,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_56set_last_error(struct __pyx_ __pyx_v_rc = libssh2_session_set_last_error(__pyx_v_self->_session, __pyx_v_errcode, __pyx_v__errmsg); } - /* "ssh2/session.pyx":482 + /* "ssh2/session.pyx":493 * cdef char *_errmsg = b_errmsg * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -7156,7 +7175,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_56set_last_error(struct __pyx_ } } - /* "ssh2/session.pyx":485 + /* "ssh2/session.pyx":496 * rc = c_ssh2.libssh2_session_set_last_error( * self._session, errcode, _errmsg) * return rc # <<<<<<<<<<<<<< @@ -7164,13 +7183,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_56set_last_error(struct __pyx_ * def scp_recv(self, path not None): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 485, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 496, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":478 + /* "ssh2/session.pyx":489 * * IF EMBEDDED_LIB: * def set_last_error(self, int errcode, errmsg not None): # <<<<<<<<<<<<<< @@ -7190,7 +7209,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_56set_last_error(struct __pyx_ return __pyx_r; } -/* "ssh2/session.pyx":487 +/* "ssh2/session.pyx":498 * return rc * * def scp_recv(self, path not None): # <<<<<<<<<<<<<< @@ -7209,7 +7228,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_59scp_recv(PyObject *__pyx_v_s __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("scp_recv (wrapper)", 0); if (unlikely(((PyObject *)__pyx_v_path) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "path"); __PYX_ERR(0, 487, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "path"); __PYX_ERR(0, 498, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_58scp_recv(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), ((PyObject *)__pyx_v_path)); @@ -7239,19 +7258,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("scp_recv", 0); - /* "ssh2/session.pyx":497 + /* "ssh2/session.pyx":508 * :rtype: tuple(:py:class:`ssh2.channel.Channel`, * :py:class:`ssh2.statinfo.StatInfo`) or None""" * cdef bytes b_path = to_bytes(path) # <<<<<<<<<<<<<< * cdef char *_path = b_path * cdef StatInfo statinfo = StatInfo() */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 497, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_path = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":498 + /* "ssh2/session.pyx":509 * :py:class:`ssh2.statinfo.StatInfo`) or None""" * cdef bytes b_path = to_bytes(path) * cdef char *_path = b_path # <<<<<<<<<<<<<< @@ -7260,24 +7279,24 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s */ if (unlikely(__pyx_v_b_path == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 498, __pyx_L1_error) + __PYX_ERR(0, 509, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 498, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 509, __pyx_L1_error) __pyx_v__path = __pyx_t_2; - /* "ssh2/session.pyx":499 + /* "ssh2/session.pyx":510 * cdef bytes b_path = to_bytes(path) * cdef char *_path = b_path * cdef StatInfo statinfo = StatInfo() # <<<<<<<<<<<<<< * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: */ - __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4ssh2_8statinfo_StatInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 499, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4ssh2_8statinfo_StatInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 510, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_statinfo = ((struct __pyx_obj_4ssh2_8statinfo_StatInfo *)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":501 + /* "ssh2/session.pyx":512 * cdef StatInfo statinfo = StatInfo() * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -7292,7 +7311,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s #endif /*try:*/ { - /* "ssh2/session.pyx":502 + /* "ssh2/session.pyx":513 * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: * channel = c_ssh2.libssh2_scp_recv( # <<<<<<<<<<<<<< @@ -7302,7 +7321,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s __pyx_v_channel = libssh2_scp_recv(__pyx_v_self->_session, __pyx_v__path, __pyx_v_statinfo->_stat); } - /* "ssh2/session.pyx":501 + /* "ssh2/session.pyx":512 * cdef StatInfo statinfo = StatInfo() * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -7321,7 +7340,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s } } - /* "ssh2/session.pyx":504 + /* "ssh2/session.pyx":515 * channel = c_ssh2.libssh2_scp_recv( * self._session, _path, statinfo._stat) * if channel is NULL: # <<<<<<<<<<<<<< @@ -7331,7 +7350,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s __pyx_t_3 = ((__pyx_v_channel == NULL) != 0); if (__pyx_t_3) { - /* "ssh2/session.pyx":505 + /* "ssh2/session.pyx":516 * self._session, _path, statinfo._stat) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -7340,29 +7359,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":506 + /* "ssh2/session.pyx":517 * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) # <<<<<<<<<<<<<< * return PyChannel(channel, self), statinfo * */ - __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 505, __pyx_L1_error) + __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 516, __pyx_L1_error) - /* "ssh2/session.pyx":505 + /* "ssh2/session.pyx":516 * self._session, _path, statinfo._stat) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< * self._session)) * return PyChannel(channel, self), statinfo */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 505, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":504 + /* "ssh2/session.pyx":515 * channel = c_ssh2.libssh2_scp_recv( * self._session, _path, statinfo._stat) * if channel is NULL: # <<<<<<<<<<<<<< @@ -7371,7 +7390,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s */ } - /* "ssh2/session.pyx":507 + /* "ssh2/session.pyx":518 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self), statinfo # <<<<<<<<<<<<<< @@ -7379,9 +7398,9 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s * IF EMBEDDED_LIB: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 507, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 518, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 507, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 518, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); @@ -7393,7 +7412,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s __pyx_t_5 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":487 + /* "ssh2/session.pyx":498 * return rc * * def scp_recv(self, path not None): # <<<<<<<<<<<<<< @@ -7415,7 +7434,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s return __pyx_r; } -/* "ssh2/session.pyx":510 +/* "ssh2/session.pyx":521 * * IF EMBEDDED_LIB: * def scp_recv2(self, path not None): # <<<<<<<<<<<<<< @@ -7434,7 +7453,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_61scp_recv2(PyObject *__pyx_v_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("scp_recv2 (wrapper)", 0); if (unlikely(((PyObject *)__pyx_v_path) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "path"); __PYX_ERR(0, 510, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "path"); __PYX_ERR(0, 521, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_60scp_recv2(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), ((PyObject *)__pyx_v_path)); @@ -7464,31 +7483,31 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("scp_recv2", 0); - /* "ssh2/session.pyx":520 + /* "ssh2/session.pyx":531 * :rtype: tuple(:py:class:`ssh2.channel.Channel`, * :py:class:`ssh2.fileinfo.FileInfo`) or ``None``""" * cdef FileInfo fileinfo = FileInfo() # <<<<<<<<<<<<<< * cdef bytes b_path = to_bytes(path) * cdef char *_path = b_path */ - __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4ssh2_8fileinfo_FileInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4ssh2_8fileinfo_FileInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 531, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_fileinfo = ((struct __pyx_obj_4ssh2_8fileinfo_FileInfo *)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":521 + /* "ssh2/session.pyx":532 * :py:class:`ssh2.fileinfo.FileInfo`) or ``None``""" * cdef FileInfo fileinfo = FileInfo() * cdef bytes b_path = to_bytes(path) # <<<<<<<<<<<<<< * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_path = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":522 + /* "ssh2/session.pyx":533 * cdef FileInfo fileinfo = FileInfo() * cdef bytes b_path = to_bytes(path) * cdef char *_path = b_path # <<<<<<<<<<<<<< @@ -7497,12 +7516,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 */ if (unlikely(__pyx_v_b_path == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 522, __pyx_L1_error) + __PYX_ERR(0, 533, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 522, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 533, __pyx_L1_error) __pyx_v__path = __pyx_t_2; - /* "ssh2/session.pyx":524 + /* "ssh2/session.pyx":535 * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -7517,7 +7536,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 #endif /*try:*/ { - /* "ssh2/session.pyx":525 + /* "ssh2/session.pyx":536 * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: * channel = c_ssh2.libssh2_scp_recv2( # <<<<<<<<<<<<<< @@ -7527,7 +7546,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 __pyx_v_channel = libssh2_scp_recv2(__pyx_v_self->_session, __pyx_v__path, __pyx_v_fileinfo->_stat); } - /* "ssh2/session.pyx":524 + /* "ssh2/session.pyx":535 * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -7546,7 +7565,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 } } - /* "ssh2/session.pyx":527 + /* "ssh2/session.pyx":538 * channel = c_ssh2.libssh2_scp_recv2( * self._session, _path, fileinfo._stat) * if channel is NULL: # <<<<<<<<<<<<<< @@ -7556,7 +7575,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 __pyx_t_3 = ((__pyx_v_channel == NULL) != 0); if (__pyx_t_3) { - /* "ssh2/session.pyx":528 + /* "ssh2/session.pyx":539 * self._session, _path, fileinfo._stat) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -7565,29 +7584,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":529 + /* "ssh2/session.pyx":540 * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) # <<<<<<<<<<<<<< * return PyChannel(channel, self), fileinfo * */ - __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 528, __pyx_L1_error) + __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 539, __pyx_L1_error) - /* "ssh2/session.pyx":528 + /* "ssh2/session.pyx":539 * self._session, _path, fileinfo._stat) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< * self._session)) * return PyChannel(channel, self), fileinfo */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 528, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":527 + /* "ssh2/session.pyx":538 * channel = c_ssh2.libssh2_scp_recv2( * self._session, _path, fileinfo._stat) * if channel is NULL: # <<<<<<<<<<<<<< @@ -7596,7 +7615,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 */ } - /* "ssh2/session.pyx":530 + /* "ssh2/session.pyx":541 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self), fileinfo # <<<<<<<<<<<<<< @@ -7604,9 +7623,9 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 * def scp_send(self, path not None, int mode, size_t size): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 541, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 530, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 541, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); @@ -7618,7 +7637,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 __pyx_t_5 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":510 + /* "ssh2/session.pyx":521 * * IF EMBEDDED_LIB: * def scp_recv2(self, path not None): # <<<<<<<<<<<<<< @@ -7640,7 +7659,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 return __pyx_r; } -/* "ssh2/session.pyx":532 +/* "ssh2/session.pyx":543 * return PyChannel(channel, self), fileinfo * * def scp_send(self, path not None, int mode, size_t size): # <<<<<<<<<<<<<< @@ -7686,17 +7705,17 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_63scp_send(PyObject *__pyx_v_s case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("scp_send", 1, 3, 3, 1); __PYX_ERR(0, 532, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send", 1, 3, 3, 1); __PYX_ERR(0, 543, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("scp_send", 1, 3, 3, 2); __PYX_ERR(0, 532, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send", 1, 3, 3, 2); __PYX_ERR(0, 543, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scp_send") < 0)) __PYX_ERR(0, 532, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scp_send") < 0)) __PYX_ERR(0, 543, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -7706,19 +7725,19 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_63scp_send(PyObject *__pyx_v_s values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_path = values[0]; - __pyx_v_mode = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 532, __pyx_L3_error) - __pyx_v_size = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_size == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 532, __pyx_L3_error) + __pyx_v_mode = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 543, __pyx_L3_error) + __pyx_v_size = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_size == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 543, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("scp_send", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 532, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 543, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.scp_send", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(((PyObject *)__pyx_v_path) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "path"); __PYX_ERR(0, 532, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "path"); __PYX_ERR(0, 543, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_62scp_send(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_path, __pyx_v_mode, __pyx_v_size); @@ -7746,19 +7765,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("scp_send", 0); - /* "ssh2/session.pyx":543 + /* "ssh2/session.pyx":554 * * :rtype: :py:class:`ssh2.channel.Channel`""" * cdef bytes b_path = to_bytes(path) # <<<<<<<<<<<<<< * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 543, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_path = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":544 + /* "ssh2/session.pyx":555 * :rtype: :py:class:`ssh2.channel.Channel`""" * cdef bytes b_path = to_bytes(path) * cdef char *_path = b_path # <<<<<<<<<<<<<< @@ -7767,12 +7786,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s */ if (unlikely(__pyx_v_b_path == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 544, __pyx_L1_error) + __PYX_ERR(0, 555, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 544, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 555, __pyx_L1_error) __pyx_v__path = __pyx_t_2; - /* "ssh2/session.pyx":546 + /* "ssh2/session.pyx":557 * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -7787,7 +7806,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s #endif /*try:*/ { - /* "ssh2/session.pyx":547 + /* "ssh2/session.pyx":558 * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: * channel = c_ssh2.libssh2_scp_send( # <<<<<<<<<<<<<< @@ -7797,7 +7816,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s __pyx_v_channel = libssh2_scp_send(__pyx_v_self->_session, __pyx_v__path, __pyx_v_mode, __pyx_v_size); } - /* "ssh2/session.pyx":546 + /* "ssh2/session.pyx":557 * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -7816,7 +7835,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s } } - /* "ssh2/session.pyx":549 + /* "ssh2/session.pyx":560 * channel = c_ssh2.libssh2_scp_send( * self._session, _path, mode, size) * if channel is NULL: # <<<<<<<<<<<<<< @@ -7826,7 +7845,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s __pyx_t_3 = ((__pyx_v_channel == NULL) != 0); if (__pyx_t_3) { - /* "ssh2/session.pyx":550 + /* "ssh2/session.pyx":561 * self._session, _path, mode, size) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -7835,29 +7854,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":551 + /* "ssh2/session.pyx":562 * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) # <<<<<<<<<<<<<< * return PyChannel(channel, self) * */ - __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 550, __pyx_L1_error) + __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 561, __pyx_L1_error) - /* "ssh2/session.pyx":550 + /* "ssh2/session.pyx":561 * self._session, _path, mode, size) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< * self._session)) * return PyChannel(channel, self) */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 550, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 561, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":549 + /* "ssh2/session.pyx":560 * channel = c_ssh2.libssh2_scp_send( * self._session, _path, mode, size) * if channel is NULL: # <<<<<<<<<<<<<< @@ -7866,7 +7885,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s */ } - /* "ssh2/session.pyx":552 + /* "ssh2/session.pyx":563 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self) # <<<<<<<<<<<<<< @@ -7874,13 +7893,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s * def scp_send64(self, path not None, int mode, c_ssh2.libssh2_uint64_t size, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 552, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 563, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":532 + /* "ssh2/session.pyx":543 * return PyChannel(channel, self), fileinfo * * def scp_send(self, path not None, int mode, size_t size): # <<<<<<<<<<<<<< @@ -7900,7 +7919,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s return __pyx_r; } -/* "ssh2/session.pyx":554 +/* "ssh2/session.pyx":565 * return PyChannel(channel, self) * * def scp_send64(self, path not None, int mode, c_ssh2.libssh2_uint64_t size, # <<<<<<<<<<<<<< @@ -7952,29 +7971,29 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_65scp_send64(PyObject *__pyx_v case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 1); __PYX_ERR(0, 554, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 1); __PYX_ERR(0, 565, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 2); __PYX_ERR(0, 554, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 2); __PYX_ERR(0, 565, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mtime)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 3); __PYX_ERR(0, 554, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 3); __PYX_ERR(0, 565, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_atime)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 4); __PYX_ERR(0, 554, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 4); __PYX_ERR(0, 565, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scp_send64") < 0)) __PYX_ERR(0, 554, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scp_send64") < 0)) __PYX_ERR(0, 565, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; @@ -7986,21 +8005,21 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_65scp_send64(PyObject *__pyx_v values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } __pyx_v_path = values[0]; - __pyx_v_mode = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 554, __pyx_L3_error) - __pyx_v_size = __Pyx_PyInt_As_libssh2_uint64_t(values[2]); if (unlikely((__pyx_v_size == ((libssh2_uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 554, __pyx_L3_error) - __pyx_v_mtime = __Pyx_PyInt_As_time_t(values[3]); if (unlikely((__pyx_v_mtime == ((time_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 555, __pyx_L3_error) - __pyx_v_atime = __Pyx_PyInt_As_time_t(values[4]); if (unlikely((__pyx_v_atime == ((time_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 555, __pyx_L3_error) + __pyx_v_mode = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 565, __pyx_L3_error) + __pyx_v_size = __Pyx_PyInt_As_libssh2_uint64_t(values[2]); if (unlikely((__pyx_v_size == ((libssh2_uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 565, __pyx_L3_error) + __pyx_v_mtime = __Pyx_PyInt_As_time_t(values[3]); if (unlikely((__pyx_v_mtime == ((time_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 566, __pyx_L3_error) + __pyx_v_atime = __Pyx_PyInt_As_time_t(values[4]); if (unlikely((__pyx_v_atime == ((time_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 566, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 554, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 565, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.scp_send64", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(((PyObject *)__pyx_v_path) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "path"); __PYX_ERR(0, 554, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "path"); __PYX_ERR(0, 565, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_64scp_send64(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_path, __pyx_v_mode, __pyx_v_size, __pyx_v_mtime, __pyx_v_atime); @@ -8028,19 +8047,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("scp_send64", 0); - /* "ssh2/session.pyx":566 + /* "ssh2/session.pyx":577 * * :rtype: :py:class:`ssh2.channel.Channel`""" * cdef bytes b_path = to_bytes(path) # <<<<<<<<<<<<<< * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 566, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 577, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_path = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":567 + /* "ssh2/session.pyx":578 * :rtype: :py:class:`ssh2.channel.Channel`""" * cdef bytes b_path = to_bytes(path) * cdef char *_path = b_path # <<<<<<<<<<<<<< @@ -8049,12 +8068,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ */ if (unlikely(__pyx_v_b_path == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 567, __pyx_L1_error) + __PYX_ERR(0, 578, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 567, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 578, __pyx_L1_error) __pyx_v__path = __pyx_t_2; - /* "ssh2/session.pyx":569 + /* "ssh2/session.pyx":580 * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -8069,7 +8088,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ #endif /*try:*/ { - /* "ssh2/session.pyx":570 + /* "ssh2/session.pyx":581 * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: * channel = c_ssh2.libssh2_scp_send64( # <<<<<<<<<<<<<< @@ -8079,7 +8098,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ __pyx_v_channel = libssh2_scp_send64(__pyx_v_self->_session, __pyx_v__path, __pyx_v_mode, __pyx_v_size, __pyx_v_mtime, __pyx_v_atime); } - /* "ssh2/session.pyx":569 + /* "ssh2/session.pyx":580 * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -8098,7 +8117,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ } } - /* "ssh2/session.pyx":572 + /* "ssh2/session.pyx":583 * channel = c_ssh2.libssh2_scp_send64( * self._session, _path, mode, size, mtime, atime) * if channel is NULL: # <<<<<<<<<<<<<< @@ -8108,7 +8127,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ __pyx_t_3 = ((__pyx_v_channel == NULL) != 0); if (__pyx_t_3) { - /* "ssh2/session.pyx":573 + /* "ssh2/session.pyx":584 * self._session, _path, mode, size, mtime, atime) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -8117,29 +8136,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":574 + /* "ssh2/session.pyx":585 * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) # <<<<<<<<<<<<<< * return PyChannel(channel, self) * */ - __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 573, __pyx_L1_error) + __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 584, __pyx_L1_error) - /* "ssh2/session.pyx":573 + /* "ssh2/session.pyx":584 * self._session, _path, mode, size, mtime, atime) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< * self._session)) * return PyChannel(channel, self) */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 573, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 584, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":572 + /* "ssh2/session.pyx":583 * channel = c_ssh2.libssh2_scp_send64( * self._session, _path, mode, size, mtime, atime) * if channel is NULL: # <<<<<<<<<<<<<< @@ -8148,7 +8167,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ */ } - /* "ssh2/session.pyx":575 + /* "ssh2/session.pyx":586 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self) # <<<<<<<<<<<<<< @@ -8156,13 +8175,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ * def publickey_init(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":554 + /* "ssh2/session.pyx":565 * return PyChannel(channel, self) * * def scp_send64(self, path not None, int mode, c_ssh2.libssh2_uint64_t size, # <<<<<<<<<<<<<< @@ -8182,7 +8201,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ return __pyx_r; } -/* "ssh2/session.pyx":577 +/* "ssh2/session.pyx":588 * return PyChannel(channel, self) * * def publickey_init(self): # <<<<<<<<<<<<<< @@ -8215,7 +8234,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("publickey_init", 0); - /* "ssh2/session.pyx":581 + /* "ssh2/session.pyx":592 * public keys""" * cdef c_pkey.LIBSSH2_PUBLICKEY *_pkey * with nogil: # <<<<<<<<<<<<<< @@ -8230,7 +8249,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ #endif /*try:*/ { - /* "ssh2/session.pyx":582 + /* "ssh2/session.pyx":593 * cdef c_pkey.LIBSSH2_PUBLICKEY *_pkey * with nogil: * _pkey = c_pkey.libssh2_publickey_init(self._session) # <<<<<<<<<<<<<< @@ -8240,7 +8259,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ __pyx_v__pkey = libssh2_publickey_init(__pyx_v_self->_session); } - /* "ssh2/session.pyx":581 + /* "ssh2/session.pyx":592 * public keys""" * cdef c_pkey.LIBSSH2_PUBLICKEY *_pkey * with nogil: # <<<<<<<<<<<<<< @@ -8259,7 +8278,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ } } - /* "ssh2/session.pyx":583 + /* "ssh2/session.pyx":594 * with nogil: * _pkey = c_pkey.libssh2_publickey_init(self._session) * if _pkey is NULL: # <<<<<<<<<<<<<< @@ -8269,20 +8288,20 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ __pyx_t_1 = ((__pyx_v__pkey == NULL) != 0); if (unlikely(__pyx_t_1)) { - /* "ssh2/session.pyx":584 + /* "ssh2/session.pyx":595 * _pkey = c_pkey.libssh2_publickey_init(self._session) * if _pkey is NULL: * raise PublicKeyInitError # <<<<<<<<<<<<<< * return PyPublicKeySystem(_pkey, self) * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PublicKeyInitError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 584, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PublicKeyInitError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 595, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 584, __pyx_L1_error) + __PYX_ERR(0, 595, __pyx_L1_error) - /* "ssh2/session.pyx":583 + /* "ssh2/session.pyx":594 * with nogil: * _pkey = c_pkey.libssh2_publickey_init(self._session) * if _pkey is NULL: # <<<<<<<<<<<<<< @@ -8291,7 +8310,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ */ } - /* "ssh2/session.pyx":585 + /* "ssh2/session.pyx":596 * if _pkey is NULL: * raise PublicKeyInitError * return PyPublicKeySystem(_pkey, self) # <<<<<<<<<<<<<< @@ -8299,13 +8318,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ * def hostkey_hash(self, int hash_type): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_f_4ssh2_9publickey_PyPublicKeySystem(__pyx_v__pkey, __pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 585, __pyx_L1_error) + __pyx_t_2 = __pyx_f_4ssh2_9publickey_PyPublicKeySystem(__pyx_v__pkey, __pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":577 + /* "ssh2/session.pyx":588 * return PyChannel(channel, self) * * def publickey_init(self): # <<<<<<<<<<<<<< @@ -8324,7 +8343,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ return __pyx_r; } -/* "ssh2/session.pyx":587 +/* "ssh2/session.pyx":598 * return PyPublicKeySystem(_pkey, self) * * def hostkey_hash(self, int hash_type): # <<<<<<<<<<<<<< @@ -8344,7 +8363,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_69hostkey_hash(PyObject *__pyx __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("hostkey_hash (wrapper)", 0); assert(__pyx_arg_hash_type); { - __pyx_v_hash_type = __Pyx_PyInt_As_int(__pyx_arg_hash_type); if (unlikely((__pyx_v_hash_type == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 587, __pyx_L3_error) + __pyx_v_hash_type = __Pyx_PyInt_As_int(__pyx_arg_hash_type); if (unlikely((__pyx_v_hash_type == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 598, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -8371,7 +8390,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob int __pyx_clineno = 0; __Pyx_RefNannySetupContext("hostkey_hash", 0); - /* "ssh2/session.pyx":597 + /* "ssh2/session.pyx":608 * cdef const char *_hash * cdef bytes b_hash * with nogil: # <<<<<<<<<<<<<< @@ -8386,7 +8405,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob #endif /*try:*/ { - /* "ssh2/session.pyx":598 + /* "ssh2/session.pyx":609 * cdef bytes b_hash * with nogil: * _hash = c_ssh2.libssh2_hostkey_hash(self._session, hash_type) # <<<<<<<<<<<<<< @@ -8396,7 +8415,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob __pyx_v__hash = libssh2_hostkey_hash(__pyx_v_self->_session, __pyx_v_hash_type); } - /* "ssh2/session.pyx":597 + /* "ssh2/session.pyx":608 * cdef const char *_hash * cdef bytes b_hash * with nogil: # <<<<<<<<<<<<<< @@ -8415,7 +8434,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob } } - /* "ssh2/session.pyx":599 + /* "ssh2/session.pyx":610 * with nogil: * _hash = c_ssh2.libssh2_hostkey_hash(self._session, hash_type) * if _hash is NULL: # <<<<<<<<<<<<<< @@ -8425,7 +8444,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob __pyx_t_1 = ((__pyx_v__hash == NULL) != 0); if (__pyx_t_1) { - /* "ssh2/session.pyx":600 + /* "ssh2/session.pyx":611 * _hash = c_ssh2.libssh2_hostkey_hash(self._session, hash_type) * if _hash is NULL: * return # <<<<<<<<<<<<<< @@ -8436,7 +8455,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "ssh2/session.pyx":599 + /* "ssh2/session.pyx":610 * with nogil: * _hash = c_ssh2.libssh2_hostkey_hash(self._session, hash_type) * if _hash is NULL: # <<<<<<<<<<<<<< @@ -8445,19 +8464,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob */ } - /* "ssh2/session.pyx":601 + /* "ssh2/session.pyx":612 * if _hash is NULL: * return * b_hash = _hash # <<<<<<<<<<<<<< * return b_hash * */ - __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v__hash); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 601, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v__hash); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 612, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_b_hash = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "ssh2/session.pyx":602 + /* "ssh2/session.pyx":613 * return * b_hash = _hash * return b_hash # <<<<<<<<<<<<<< @@ -8469,7 +8488,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob __pyx_r = __pyx_v_b_hash; goto __pyx_L0; - /* "ssh2/session.pyx":587 + /* "ssh2/session.pyx":598 * return PyPublicKeySystem(_pkey, self) * * def hostkey_hash(self, int hash_type): # <<<<<<<<<<<<<< @@ -8489,7 +8508,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob return __pyx_r; } -/* "ssh2/session.pyx":604 +/* "ssh2/session.pyx":615 * return b_hash * * def hostkey(self): # <<<<<<<<<<<<<< @@ -8527,7 +8546,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss int __pyx_clineno = 0; __Pyx_RefNannySetupContext("hostkey", 0); - /* "ssh2/session.pyx":613 + /* "ssh2/session.pyx":624 * * :rtype: tuple(bytes, int)""" * cdef bytes key = b"" # <<<<<<<<<<<<<< @@ -8537,7 +8556,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss __Pyx_INCREF(__pyx_kp_b__2); __pyx_v_key = __pyx_kp_b__2; - /* "ssh2/session.pyx":615 + /* "ssh2/session.pyx":626 * cdef bytes key = b"" * cdef const char *_key * cdef size_t key_len = 0 # <<<<<<<<<<<<<< @@ -8546,7 +8565,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss */ __pyx_v_key_len = 0; - /* "ssh2/session.pyx":616 + /* "ssh2/session.pyx":627 * cdef const char *_key * cdef size_t key_len = 0 * cdef int key_type = 0 # <<<<<<<<<<<<<< @@ -8555,7 +8574,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss */ __pyx_v_key_type = 0; - /* "ssh2/session.pyx":617 + /* "ssh2/session.pyx":628 * cdef size_t key_len = 0 * cdef int key_type = 0 * with nogil: # <<<<<<<<<<<<<< @@ -8570,7 +8589,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss #endif /*try:*/ { - /* "ssh2/session.pyx":618 + /* "ssh2/session.pyx":629 * cdef int key_type = 0 * with nogil: * _key = c_ssh2.libssh2_session_hostkey( # <<<<<<<<<<<<<< @@ -8580,7 +8599,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss __pyx_v__key = libssh2_session_hostkey(__pyx_v_self->_session, (&__pyx_v_key_len), (&__pyx_v_key_type)); } - /* "ssh2/session.pyx":617 + /* "ssh2/session.pyx":628 * cdef size_t key_len = 0 * cdef int key_type = 0 * with nogil: # <<<<<<<<<<<<<< @@ -8599,7 +8618,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss } } - /* "ssh2/session.pyx":620 + /* "ssh2/session.pyx":631 * _key = c_ssh2.libssh2_session_hostkey( * self._session, &key_len, &key_type) * if _key is NULL: # <<<<<<<<<<<<<< @@ -8609,14 +8628,14 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss __pyx_t_1 = ((__pyx_v__key == NULL) != 0); if (unlikely(__pyx_t_1)) { - /* "ssh2/session.pyx":621 + /* "ssh2/session.pyx":632 * self._session, &key_len, &key_type) * if _key is NULL: * raise SessionHostKeyError( # <<<<<<<<<<<<<< * "Error retrieving server host key for session") * key = _key[:key_len] */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_SessionHostKeyError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 621, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_SessionHostKeyError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 632, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -8630,14 +8649,14 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_Error_retrieving_server_host_key) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_Error_retrieving_server_host_key); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 621, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 632, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 621, __pyx_L1_error) + __PYX_ERR(0, 632, __pyx_L1_error) - /* "ssh2/session.pyx":620 + /* "ssh2/session.pyx":631 * _key = c_ssh2.libssh2_session_hostkey( * self._session, &key_len, &key_type) * if _key is NULL: # <<<<<<<<<<<<<< @@ -8646,19 +8665,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss */ } - /* "ssh2/session.pyx":623 + /* "ssh2/session.pyx":634 * raise SessionHostKeyError( * "Error retrieving server host key for session") * key = _key[:key_len] # <<<<<<<<<<<<<< * return key, key_type * */ - __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(__pyx_v__key + 0, __pyx_v_key_len - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 623, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(__pyx_v__key + 0, __pyx_v_key_len - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF_SET(__pyx_v_key, ((PyObject*)__pyx_t_2)); __pyx_t_2 = 0; - /* "ssh2/session.pyx":624 + /* "ssh2/session.pyx":635 * "Error retrieving server host key for session") * key = _key[:key_len] * return key, key_type # <<<<<<<<<<<<<< @@ -8666,9 +8685,9 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss * def knownhost_init(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_key_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 624, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_key_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 635, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 635, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_key); __Pyx_GIVEREF(__pyx_v_key); @@ -8680,7 +8699,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":604 + /* "ssh2/session.pyx":615 * return b_hash * * def hostkey(self): # <<<<<<<<<<<<<< @@ -8702,7 +8721,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss return __pyx_r; } -/* "ssh2/session.pyx":626 +/* "ssh2/session.pyx":637 * return key, key_type * * def knownhost_init(self): # <<<<<<<<<<<<<< @@ -8735,7 +8754,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("knownhost_init", 0); - /* "ssh2/session.pyx":631 + /* "ssh2/session.pyx":642 * :rtype: :py:class:`ssh2.knownhost.KnownHost`""" * cdef c_ssh2.LIBSSH2_KNOWNHOSTS *known_hosts * with nogil: # <<<<<<<<<<<<<< @@ -8750,7 +8769,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ #endif /*try:*/ { - /* "ssh2/session.pyx":632 + /* "ssh2/session.pyx":643 * cdef c_ssh2.LIBSSH2_KNOWNHOSTS *known_hosts * with nogil: * known_hosts = c_ssh2.libssh2_knownhost_init( # <<<<<<<<<<<<<< @@ -8760,7 +8779,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ __pyx_v_known_hosts = libssh2_knownhost_init(__pyx_v_self->_session); } - /* "ssh2/session.pyx":631 + /* "ssh2/session.pyx":642 * :rtype: :py:class:`ssh2.knownhost.KnownHost`""" * cdef c_ssh2.LIBSSH2_KNOWNHOSTS *known_hosts * with nogil: # <<<<<<<<<<<<<< @@ -8779,7 +8798,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ } } - /* "ssh2/session.pyx":634 + /* "ssh2/session.pyx":645 * known_hosts = c_ssh2.libssh2_knownhost_init( * self._session) * if known_hosts is NULL: # <<<<<<<<<<<<<< @@ -8789,20 +8808,20 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ __pyx_t_1 = ((__pyx_v_known_hosts == NULL) != 0); if (unlikely(__pyx_t_1)) { - /* "ssh2/session.pyx":635 + /* "ssh2/session.pyx":646 * self._session) * if known_hosts is NULL: * raise KnownHostError # <<<<<<<<<<<<<< * return PyKnownHost(self, known_hosts) * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_KnownHostError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 635, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_KnownHostError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 646, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 635, __pyx_L1_error) + __PYX_ERR(0, 646, __pyx_L1_error) - /* "ssh2/session.pyx":634 + /* "ssh2/session.pyx":645 * known_hosts = c_ssh2.libssh2_knownhost_init( * self._session) * if known_hosts is NULL: # <<<<<<<<<<<<<< @@ -8811,7 +8830,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ */ } - /* "ssh2/session.pyx":636 + /* "ssh2/session.pyx":647 * if known_hosts is NULL: * raise KnownHostError * return PyKnownHost(self, known_hosts) # <<<<<<<<<<<<<< @@ -8819,13 +8838,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ * def keepalive_config(self, bint want_reply, unsigned interval): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = ((PyObject *)__pyx_f_4ssh2_9knownhost_PyKnownHost(__pyx_v_self, __pyx_v_known_hosts)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 636, __pyx_L1_error) + __pyx_t_2 = ((PyObject *)__pyx_f_4ssh2_9knownhost_PyKnownHost(__pyx_v_self, __pyx_v_known_hosts)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 647, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":626 + /* "ssh2/session.pyx":637 * return key, key_type * * def knownhost_init(self): # <<<<<<<<<<<<<< @@ -8844,7 +8863,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ return __pyx_r; } -/* "ssh2/session.pyx":638 +/* "ssh2/session.pyx":649 * return PyKnownHost(self, known_hosts) * * def keepalive_config(self, bint want_reply, unsigned interval): # <<<<<<<<<<<<<< @@ -8887,11 +8906,11 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_75keepalive_config(PyObject *_ case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_interval)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("keepalive_config", 1, 2, 2, 1); __PYX_ERR(0, 638, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("keepalive_config", 1, 2, 2, 1); __PYX_ERR(0, 649, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "keepalive_config") < 0)) __PYX_ERR(0, 638, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "keepalive_config") < 0)) __PYX_ERR(0, 649, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -8899,12 +8918,12 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_75keepalive_config(PyObject *_ values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_want_reply = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_want_reply == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 638, __pyx_L3_error) - __pyx_v_interval = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_interval == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 638, __pyx_L3_error) + __pyx_v_want_reply = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_want_reply == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 649, __pyx_L3_error) + __pyx_v_interval = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_interval == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 649, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("keepalive_config", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 638, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("keepalive_config", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 649, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.keepalive_config", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -8922,7 +8941,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_74keepalive_config(struct __py __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("keepalive_config", 0); - /* "ssh2/session.pyx":648 + /* "ssh2/session.pyx":659 * keepalives. * :type interval: int""" * with nogil: # <<<<<<<<<<<<<< @@ -8937,7 +8956,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_74keepalive_config(struct __py #endif /*try:*/ { - /* "ssh2/session.pyx":649 + /* "ssh2/session.pyx":660 * :type interval: int""" * with nogil: * c_ssh2.libssh2_keepalive_config(self._session, want_reply, interval) # <<<<<<<<<<<<<< @@ -8947,7 +8966,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_74keepalive_config(struct __py libssh2_keepalive_config(__pyx_v_self->_session, __pyx_v_want_reply, __pyx_v_interval); } - /* "ssh2/session.pyx":648 + /* "ssh2/session.pyx":659 * keepalives. * :type interval: int""" * with nogil: # <<<<<<<<<<<<<< @@ -8966,7 +8985,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_74keepalive_config(struct __py } } - /* "ssh2/session.pyx":638 + /* "ssh2/session.pyx":649 * return PyKnownHost(self, known_hosts) * * def keepalive_config(self, bint want_reply, unsigned interval): # <<<<<<<<<<<<<< @@ -8981,7 +9000,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_74keepalive_config(struct __py return __pyx_r; } -/* "ssh2/session.pyx":651 +/* "ssh2/session.pyx":662 * c_ssh2.libssh2_keepalive_config(self._session, want_reply, interval) * * def keepalive_send(self): # <<<<<<<<<<<<<< @@ -9016,7 +9035,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("keepalive_send", 0); - /* "ssh2/session.pyx":657 + /* "ssh2/session.pyx":668 * * :rtype: int""" * cdef int seconds = 0 # <<<<<<<<<<<<<< @@ -9025,7 +9044,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ */ __pyx_v_seconds = 0; - /* "ssh2/session.pyx":658 + /* "ssh2/session.pyx":669 * :rtype: int""" * cdef int seconds = 0 * cdef int c_seconds = 0 # <<<<<<<<<<<<<< @@ -9034,7 +9053,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ */ __pyx_v_c_seconds = 0; - /* "ssh2/session.pyx":660 + /* "ssh2/session.pyx":671 * cdef int c_seconds = 0 * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -9049,7 +9068,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ #endif /*try:*/ { - /* "ssh2/session.pyx":661 + /* "ssh2/session.pyx":672 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_keepalive_send(self._session, &c_seconds) # <<<<<<<<<<<<<< @@ -9059,7 +9078,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ __pyx_v_rc = libssh2_keepalive_send(__pyx_v_self->_session, (&__pyx_v_c_seconds)); } - /* "ssh2/session.pyx":660 + /* "ssh2/session.pyx":671 * cdef int c_seconds = 0 * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -9078,27 +9097,30 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ } } - /* "ssh2/session.pyx":662 + /* "ssh2/session.pyx":673 * with nogil: * rc = c_ssh2.libssh2_keepalive_send(self._session, &c_seconds) * handle_error_codes(rc) # <<<<<<<<<<<<<< * return c_seconds + * */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 662, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 673, __pyx_L1_error) - /* "ssh2/session.pyx":663 + /* "ssh2/session.pyx":674 * rc = c_ssh2.libssh2_keepalive_send(self._session, &c_seconds) * handle_error_codes(rc) * return c_seconds # <<<<<<<<<<<<<< + * + * def trace(self, int bitmask): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_c_seconds); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 663, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_c_seconds); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 674, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":651 + /* "ssh2/session.pyx":662 * c_ssh2.libssh2_keepalive_config(self._session, want_reply, interval) * * def keepalive_send(self): # <<<<<<<<<<<<<< @@ -9117,6 +9139,68 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ return __pyx_r; } +/* "ssh2/session.pyx":676 + * return c_seconds + * + * def trace(self, int bitmask): # <<<<<<<<<<<<<< + * """Enable trace logging for this session. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_4ssh2_7session_7Session_79trace(PyObject *__pyx_v_self, PyObject *__pyx_arg_bitmask); /*proto*/ +static char __pyx_doc_4ssh2_7session_7Session_78trace[] = "Session.trace(self, int bitmask)\nEnable trace logging for this session.\n\n Bitmask is one or more of `ssh2.session.LIBSSH2_TRACE_*`.\n "; +static PyObject *__pyx_pw_4ssh2_7session_7Session_79trace(PyObject *__pyx_v_self, PyObject *__pyx_arg_bitmask) { + int __pyx_v_bitmask; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("trace (wrapper)", 0); + assert(__pyx_arg_bitmask); { + __pyx_v_bitmask = __Pyx_PyInt_As_int(__pyx_arg_bitmask); if (unlikely((__pyx_v_bitmask == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 676, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("ssh2.session.Session.trace", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4ssh2_7session_7Session_78trace(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), ((int)__pyx_v_bitmask)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_4ssh2_7session_7Session_78trace(struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self, int __pyx_v_bitmask) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("trace", 0); + + /* "ssh2/session.pyx":681 + * Bitmask is one or more of `ssh2.session.LIBSSH2_TRACE_*`. + * """ + * c_ssh2.libssh2_trace(self._session, bitmask) # <<<<<<<<<<<<<< + */ + (void)(libssh2_trace(__pyx_v_self->_session, __pyx_v_bitmask)); + + /* "ssh2/session.pyx":676 + * return c_seconds + * + * def trace(self, int bitmask): # <<<<<<<<<<<<<< + * """Enable trace logging for this session. + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "ssh2/session.pxd":22 * cdef c_ssh2.LIBSSH2_SESSION *_session * cdef int _sock @@ -9159,20 +9243,20 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_4sock___get__(struct __pyx_obj */ /* Python wrapper */ -static PyObject *__pyx_pw_4ssh2_7session_7Session_79__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_4ssh2_7session_7Session_78__reduce_cython__[] = "Session.__reduce_cython__(self)"; -static PyObject *__pyx_pw_4ssh2_7session_7Session_79__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_4ssh2_7session_7Session_81__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_4ssh2_7session_7Session_80__reduce_cython__[] = "Session.__reduce_cython__(self)"; +static PyObject *__pyx_pw_4ssh2_7session_7Session_81__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_4ssh2_7session_7Session_78__reduce_cython__(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self)); + __pyx_r = __pyx_pf_4ssh2_7session_7Session_80__reduce_cython__(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_4ssh2_7session_7Session_78__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self) { +static PyObject *__pyx_pf_4ssh2_7session_7Session_80__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -9217,20 +9301,20 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_78__reduce_cython__(CYTHON_UNU */ /* Python wrapper */ -static PyObject *__pyx_pw_4ssh2_7session_7Session_81__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static char __pyx_doc_4ssh2_7session_7Session_80__setstate_cython__[] = "Session.__setstate_cython__(self, __pyx_state)"; -static PyObject *__pyx_pw_4ssh2_7session_7Session_81__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pw_4ssh2_7session_7Session_83__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static char __pyx_doc_4ssh2_7session_7Session_82__setstate_cython__[] = "Session.__setstate_cython__(self, __pyx_state)"; +static PyObject *__pyx_pw_4ssh2_7session_7Session_83__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_4ssh2_7session_7Session_80__setstate_cython__(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + __pyx_r = __pyx_pf_4ssh2_7session_7Session_82__setstate_cython__(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_4ssh2_7session_7Session_80__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pf_4ssh2_7session_7Session_82__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -9365,8 +9449,9 @@ static PyMethodDef __pyx_methods_4ssh2_7session_Session[] = { {"knownhost_init", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_73knownhost_init, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_72knownhost_init}, {"keepalive_config", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_75keepalive_config, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_74keepalive_config}, {"keepalive_send", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_77keepalive_send, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_76keepalive_send}, - {"__reduce_cython__", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_79__reduce_cython__, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_78__reduce_cython__}, - {"__setstate_cython__", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_81__setstate_cython__, METH_O, __pyx_doc_4ssh2_7session_7Session_80__setstate_cython__}, + {"trace", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_79trace, METH_O, __pyx_doc_4ssh2_7session_7Session_78trace}, + {"__reduce_cython__", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_81__reduce_cython__, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_80__reduce_cython__}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_83__setstate_cython__, METH_O, __pyx_doc_4ssh2_7session_7Session_82__setstate_cython__}, {0, 0, 0, 0} }; @@ -9501,6 +9586,15 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_LIBSSH2_HOSTKEY_TYPE_UNKNOWN, __pyx_k_LIBSSH2_HOSTKEY_TYPE_UNKNOWN, sizeof(__pyx_k_LIBSSH2_HOSTKEY_TYPE_UNKNOWN), 0, 0, 1, 1}, {&__pyx_n_s_LIBSSH2_SESSION_BLOCK_INBOUND, __pyx_k_LIBSSH2_SESSION_BLOCK_INBOUND, sizeof(__pyx_k_LIBSSH2_SESSION_BLOCK_INBOUND), 0, 0, 1, 1}, {&__pyx_n_s_LIBSSH2_SESSION_BLOCK_OUTBOUND, __pyx_k_LIBSSH2_SESSION_BLOCK_OUTBOUND, sizeof(__pyx_k_LIBSSH2_SESSION_BLOCK_OUTBOUND), 0, 0, 1, 1}, + {&__pyx_n_s_LIBSSH2_TRACE_AUTH, __pyx_k_LIBSSH2_TRACE_AUTH, sizeof(__pyx_k_LIBSSH2_TRACE_AUTH), 0, 0, 1, 1}, + {&__pyx_n_s_LIBSSH2_TRACE_CONN, __pyx_k_LIBSSH2_TRACE_CONN, sizeof(__pyx_k_LIBSSH2_TRACE_CONN), 0, 0, 1, 1}, + {&__pyx_n_s_LIBSSH2_TRACE_ERROR, __pyx_k_LIBSSH2_TRACE_ERROR, sizeof(__pyx_k_LIBSSH2_TRACE_ERROR), 0, 0, 1, 1}, + {&__pyx_n_s_LIBSSH2_TRACE_KEX, __pyx_k_LIBSSH2_TRACE_KEX, sizeof(__pyx_k_LIBSSH2_TRACE_KEX), 0, 0, 1, 1}, + {&__pyx_n_s_LIBSSH2_TRACE_PUBLICKEY, __pyx_k_LIBSSH2_TRACE_PUBLICKEY, sizeof(__pyx_k_LIBSSH2_TRACE_PUBLICKEY), 0, 0, 1, 1}, + {&__pyx_n_s_LIBSSH2_TRACE_SCP, __pyx_k_LIBSSH2_TRACE_SCP, sizeof(__pyx_k_LIBSSH2_TRACE_SCP), 0, 0, 1, 1}, + {&__pyx_n_s_LIBSSH2_TRACE_SFTP, __pyx_k_LIBSSH2_TRACE_SFTP, sizeof(__pyx_k_LIBSSH2_TRACE_SFTP), 0, 0, 1, 1}, + {&__pyx_n_s_LIBSSH2_TRACE_SOCKET, __pyx_k_LIBSSH2_TRACE_SOCKET, sizeof(__pyx_k_LIBSSH2_TRACE_SOCKET), 0, 0, 1, 1}, + {&__pyx_n_s_LIBSSH2_TRACE_TRANS, __pyx_k_LIBSSH2_TRACE_TRANS, sizeof(__pyx_k_LIBSSH2_TRACE_TRANS), 0, 0, 1, 1}, {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, {&__pyx_n_s_PublicKeyInitError, __pyx_k_PublicKeyInitError, sizeof(__pyx_k_PublicKeyInitError), 0, 0, 1, 1}, {&__pyx_n_s_Session, __pyx_k_Session, sizeof(__pyx_k_Session), 0, 0, 1, 1}, @@ -9550,7 +9644,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 67, __pyx_L1_error) __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error) return 0; __pyx_L1_error:; @@ -9633,15 +9727,15 @@ static int __Pyx_modinit_type_init_code(void) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); /*--- Type init code ---*/ - if (PyType_Ready(&__pyx_type_4ssh2_7session_Session) < 0) __PYX_ERR(0, 49, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_4ssh2_7session_Session) < 0) __PYX_ERR(0, 61, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_4ssh2_7session_Session.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4ssh2_7session_Session.tp_dictoffset && __pyx_type_4ssh2_7session_Session.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_4ssh2_7session_Session.tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Session, (PyObject *)&__pyx_type_4ssh2_7session_Session) < 0) __PYX_ERR(0, 49, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4ssh2_7session_Session) < 0) __PYX_ERR(0, 49, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Session, (PyObject *)&__pyx_type_4ssh2_7session_Session) < 0) __PYX_ERR(0, 61, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4ssh2_7session_Session) < 0) __PYX_ERR(0, 61, __pyx_L1_error) __pyx_ptype_4ssh2_7session_Session = &__pyx_type_4ssh2_7session_Session; __Pyx_RefNannyFinishContext(); return 0; @@ -10110,6 +10204,114 @@ if (!__Pyx_RefNanny) { if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_TYPE_DSS, __pyx_t_2) < 0) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + /* "ssh2/session.pyx":50 + * + * # Trace masks + * LIBSSH2_TRACE_TRANS = c_ssh2.LIBSSH2_TRACE_TRANS # <<<<<<<<<<<<<< + * LIBSSH2_TRACE_KEX = c_ssh2.LIBSSH2_TRACE_KEX + * LIBSSH2_TRACE_AUTH = c_ssh2.LIBSSH2_TRACE_AUTH + */ + __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_TRACE_TRANS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_TRACE_TRANS, __pyx_t_2) < 0) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "ssh2/session.pyx":51 + * # Trace masks + * LIBSSH2_TRACE_TRANS = c_ssh2.LIBSSH2_TRACE_TRANS + * LIBSSH2_TRACE_KEX = c_ssh2.LIBSSH2_TRACE_KEX # <<<<<<<<<<<<<< + * LIBSSH2_TRACE_AUTH = c_ssh2.LIBSSH2_TRACE_AUTH + * LIBSSH2_TRACE_CONN = c_ssh2.LIBSSH2_TRACE_CONN + */ + __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_TRACE_KEX); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_TRACE_KEX, __pyx_t_2) < 0) __PYX_ERR(0, 51, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "ssh2/session.pyx":52 + * LIBSSH2_TRACE_TRANS = c_ssh2.LIBSSH2_TRACE_TRANS + * LIBSSH2_TRACE_KEX = c_ssh2.LIBSSH2_TRACE_KEX + * LIBSSH2_TRACE_AUTH = c_ssh2.LIBSSH2_TRACE_AUTH # <<<<<<<<<<<<<< + * LIBSSH2_TRACE_CONN = c_ssh2.LIBSSH2_TRACE_CONN + * LIBSSH2_TRACE_SCP = c_ssh2.LIBSSH2_TRACE_SCP + */ + __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_TRACE_AUTH); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_TRACE_AUTH, __pyx_t_2) < 0) __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "ssh2/session.pyx":53 + * LIBSSH2_TRACE_KEX = c_ssh2.LIBSSH2_TRACE_KEX + * LIBSSH2_TRACE_AUTH = c_ssh2.LIBSSH2_TRACE_AUTH + * LIBSSH2_TRACE_CONN = c_ssh2.LIBSSH2_TRACE_CONN # <<<<<<<<<<<<<< + * LIBSSH2_TRACE_SCP = c_ssh2.LIBSSH2_TRACE_SCP + * LIBSSH2_TRACE_SFTP = c_ssh2.LIBSSH2_TRACE_SFTP + */ + __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_TRACE_CONN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_TRACE_CONN, __pyx_t_2) < 0) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "ssh2/session.pyx":54 + * LIBSSH2_TRACE_AUTH = c_ssh2.LIBSSH2_TRACE_AUTH + * LIBSSH2_TRACE_CONN = c_ssh2.LIBSSH2_TRACE_CONN + * LIBSSH2_TRACE_SCP = c_ssh2.LIBSSH2_TRACE_SCP # <<<<<<<<<<<<<< + * LIBSSH2_TRACE_SFTP = c_ssh2.LIBSSH2_TRACE_SFTP + * LIBSSH2_TRACE_ERROR = c_ssh2.LIBSSH2_TRACE_ERROR + */ + __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_TRACE_SCP); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_TRACE_SCP, __pyx_t_2) < 0) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "ssh2/session.pyx":55 + * LIBSSH2_TRACE_CONN = c_ssh2.LIBSSH2_TRACE_CONN + * LIBSSH2_TRACE_SCP = c_ssh2.LIBSSH2_TRACE_SCP + * LIBSSH2_TRACE_SFTP = c_ssh2.LIBSSH2_TRACE_SFTP # <<<<<<<<<<<<<< + * LIBSSH2_TRACE_ERROR = c_ssh2.LIBSSH2_TRACE_ERROR + * LIBSSH2_TRACE_PUBLICKEY = c_ssh2.LIBSSH2_TRACE_PUBLICKEY + */ + __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_TRACE_SFTP); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_TRACE_SFTP, __pyx_t_2) < 0) __PYX_ERR(0, 55, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "ssh2/session.pyx":56 + * LIBSSH2_TRACE_SCP = c_ssh2.LIBSSH2_TRACE_SCP + * LIBSSH2_TRACE_SFTP = c_ssh2.LIBSSH2_TRACE_SFTP + * LIBSSH2_TRACE_ERROR = c_ssh2.LIBSSH2_TRACE_ERROR # <<<<<<<<<<<<<< + * LIBSSH2_TRACE_PUBLICKEY = c_ssh2.LIBSSH2_TRACE_PUBLICKEY + * LIBSSH2_TRACE_SOCKET = c_ssh2.LIBSSH2_TRACE_SOCKET + */ + __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_TRACE_ERROR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_TRACE_ERROR, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "ssh2/session.pyx":57 + * LIBSSH2_TRACE_SFTP = c_ssh2.LIBSSH2_TRACE_SFTP + * LIBSSH2_TRACE_ERROR = c_ssh2.LIBSSH2_TRACE_ERROR + * LIBSSH2_TRACE_PUBLICKEY = c_ssh2.LIBSSH2_TRACE_PUBLICKEY # <<<<<<<<<<<<<< + * LIBSSH2_TRACE_SOCKET = c_ssh2.LIBSSH2_TRACE_SOCKET + * + */ + __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_TRACE_PUBLICKEY); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_TRACE_PUBLICKEY, __pyx_t_2) < 0) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "ssh2/session.pyx":58 + * LIBSSH2_TRACE_ERROR = c_ssh2.LIBSSH2_TRACE_ERROR + * LIBSSH2_TRACE_PUBLICKEY = c_ssh2.LIBSSH2_TRACE_PUBLICKEY + * LIBSSH2_TRACE_SOCKET = c_ssh2.LIBSSH2_TRACE_SOCKET # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_TRACE_SOCKET); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_TRACE_SOCKET, __pyx_t_2) < 0) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + /* "ssh2/session.pyx":1 * # This file is part of ssh2-python. # <<<<<<<<<<<<<< * # Copyright (C) 2017 Panos Kittenis diff --git a/ssh2/session.pyx b/ssh2/session.pyx index 19cd5763..88ab74e9 100644 --- a/ssh2/session.pyx +++ b/ssh2/session.pyx @@ -46,8 +46,19 @@ LIBSSH2_HOSTKEY_TYPE_RSA = c_ssh2.LIBSSH2_HOSTKEY_TYPE_RSA LIBSSH2_HOSTKEY_TYPE_DSS = c_ssh2.LIBSSH2_HOSTKEY_TYPE_DSS -cdef class Session: +# Trace masks +LIBSSH2_TRACE_TRANS = c_ssh2.LIBSSH2_TRACE_TRANS +LIBSSH2_TRACE_KEX = c_ssh2.LIBSSH2_TRACE_KEX +LIBSSH2_TRACE_AUTH = c_ssh2.LIBSSH2_TRACE_AUTH +LIBSSH2_TRACE_CONN = c_ssh2.LIBSSH2_TRACE_CONN +LIBSSH2_TRACE_SCP = c_ssh2.LIBSSH2_TRACE_SCP +LIBSSH2_TRACE_SFTP = c_ssh2.LIBSSH2_TRACE_SFTP +LIBSSH2_TRACE_ERROR = c_ssh2.LIBSSH2_TRACE_ERROR +LIBSSH2_TRACE_PUBLICKEY = c_ssh2.LIBSSH2_TRACE_PUBLICKEY +LIBSSH2_TRACE_SOCKET = c_ssh2.LIBSSH2_TRACE_SOCKET + +cdef class Session: """LibSSH2 Session class providing session functions""" def __cinit__(self): @@ -661,3 +672,10 @@ cdef class Session: rc = c_ssh2.libssh2_keepalive_send(self._session, &c_seconds) handle_error_codes(rc) return c_seconds + + def trace(self, int bitmask): + """Enable trace logging for this session. + + Bitmask is one or more of `ssh2.session.LIBSSH2_TRACE_*`. + """ + c_ssh2.libssh2_trace(self._session, bitmask) diff --git a/tests/test_session.py b/tests/test_session.py index 2adba87e..949fe989 100644 --- a/tests/test_session.py +++ b/tests/test_session.py @@ -4,7 +4,8 @@ from .base_test import SSH2TestCase from ssh2.session import Session, LIBSSH2_HOSTKEY_HASH_MD5, \ - LIBSSH2_HOSTKEY_HASH_SHA1 + LIBSSH2_HOSTKEY_HASH_SHA1, LIBSSH2_TRACE_SOCKET, LIBSSH2_TRACE_ERROR, \ + LIBSSH2_TRACE_CONN from ssh2.sftp import SFTP from ssh2.channel import Channel from ssh2.error_codes import LIBSSH2_ERROR_EAGAIN @@ -280,3 +281,9 @@ def test_publickey_frommemory_passphrase(self): self.user, pkey, passphrase="this still works when passphrase not required") self.assertEqual(ret_val, 0) + + def test_trace_enable(self): + bitmask = LIBSSH2_TRACE_SOCKET | \ + LIBSSH2_TRACE_ERROR | \ + LIBSSH2_TRACE_CONN + self.session.trace(bitmask) From 50407e88fc2fcd48666bf96d72d38ecf66b844fa Mon Sep 17 00:00:00 2001 From: Panos Date: Sun, 29 Nov 2020 15:31:27 +0000 Subject: [PATCH 2/2] Added session params --- examples/example_echo.py | 22 +- setup.py | 2 +- ssh2/session.c | 1855 ++++++++++++++++++++------------------ ssh2/session.pyx | 14 +- 4 files changed, 999 insertions(+), 894 deletions(-) diff --git a/examples/example_echo.py b/examples/example_echo.py index 85898804..0f563765 100644 --- a/examples/example_echo.py +++ b/examples/example_echo.py @@ -1,6 +1,7 @@ from __future__ import print_function import os import socket +from datetime import datetime from ssh2.session import Session from ssh2.utils import version @@ -35,20 +36,31 @@ # Channel initialise, exec and wait for end channel = session.open_session() -channel.execute('echo me') -channel.wait_eof() -channel.close() -channel.wait_closed() +channel.shell() +channel.write("sleep 1; echo this took one second\n") +channel.write("for x in 1 2 3; do sleep 1; echo a line per second for three seconds; done\n") +channel.write("sleep 1; echo this took another second\n") +# channel.execute('echo me') +# channel.send_eof() +# channel.close() +# channel.wait_closed() # Get exit status -print("Exit status: %s" % channel.get_exit_status()) +# print("Exit status: %s" % channel.get_exit_status()) # Print output +start = datetime.now() +channel.send_eof() +channel.wait_eof() size, data = channel.read() while size > 0: print(data) size, data = channel.read() +print("Exit code: %s" % (channel.get_exit_status())) +end = datetime.now() +print("Took %s seconds" % (end - start).total_seconds()) + # SFTP capabilities, uncomment and enter a filename # sftp = session.sftp_init() diff --git a/setup.py b/setup.py index 992b0426..0794bd9e 100644 --- a/setup.py +++ b/setup.py @@ -102,7 +102,7 @@ version=versioneer.get_version(), cmdclass=cmdclass, url='https://github.com/ParallelSSH/ssh2-python', - license='LGPLv2', + license='LGPLv2.1', author='Panos Kittenis', author_email='22e889d8@opayq.com', description=('Super fast SSH library - bindings for libssh2'), diff --git a/ssh2/session.c b/ssh2/session.c index 55f5db50..f8a51e5c 100644 --- a/ssh2/session.c +++ b/ssh2/session.c @@ -1059,12 +1059,26 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject /* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); +/* RaiseDoubleKeywords.proto */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); + +/* ParseKeywords.proto */ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ + const char* function_name); + /* RaiseArgTupleInvalid.proto */ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); -/* KeywordStringCheck.proto */ -static int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); +/* PyObjectSetAttrStr.proto */ +#if CYTHON_USE_TYPE_SLOTS +#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL) +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value); +#else +#define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) +#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) +#endif /* PyObjectCall.proto */ #if CYTHON_COMPILING_IN_CPYTHON @@ -1090,14 +1104,6 @@ static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* #define __Pyx_CallUnboundCMethod1(cfunc, self, arg) __Pyx__CallUnboundCMethod1(cfunc, self, arg) #endif -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ - const char* function_name); - /* ArgTypeTest.proto */ #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ @@ -1552,6 +1558,7 @@ static const char __pyx_k_sport[] = "sport"; static const char __pyx_k_errmsg[] = "errmsg"; static const char __pyx_k_import[] = "__import__"; static const char __pyx_k_reduce[] = "__reduce__"; +static const char __pyx_k_socket[] = "socket"; static const char __pyx_k_Session[] = "Session"; static const char __pyx_k_errcode[] = "errcode"; static const char __pyx_k_getstate[] = "__getstate__"; @@ -1572,6 +1579,7 @@ static const char __pyx_k_pubkeydata[] = "pubkeydata"; static const char __pyx_k_want_reply[] = "want_reply"; static const char __pyx_k_MemoryError[] = "MemoryError"; static const char __pyx_k_ChannelError[] = "ChannelError"; +static const char __pyx_k_kbd_callback[] = "_kbd_callback"; static const char __pyx_k_queue_maxsize[] = "queue_maxsize"; static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; static const char __pyx_k_KnownHostError[] = "KnownHostError"; @@ -1637,6 +1645,7 @@ static PyObject *__pyx_n_s_host; static PyObject *__pyx_n_s_hostname; static PyObject *__pyx_n_s_import; static PyObject *__pyx_n_s_interval; +static PyObject *__pyx_n_s_kbd_callback; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_s_mode; static PyObject *__pyx_n_s_msg_size; @@ -1660,12 +1669,13 @@ static PyObject *__pyx_n_s_setstate; static PyObject *__pyx_n_s_setstate_cython; static PyObject *__pyx_n_s_shost; static PyObject *__pyx_n_s_size; +static PyObject *__pyx_n_s_socket; static PyObject *__pyx_n_s_split; static PyObject *__pyx_n_s_sport; static PyObject *__pyx_n_s_test; static PyObject *__pyx_n_s_username; static PyObject *__pyx_n_s_want_reply; -static int __pyx_pf_4ssh2_7session_7Session___cinit__(struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self); /* proto */ +static int __pyx_pf_4ssh2_7session_7Session___cinit__(struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self, PyObject *__pyx_v_socket); /* proto */ static void __pyx_pf_4ssh2_7session_7Session_2__dealloc__(struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_4ssh2_7session_7Session_4disconnect(struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self, PyObject *__pyx_v_sock); /* proto */ @@ -1717,31 +1727,76 @@ static PyObject *__pyx_tuple__4; /* "ssh2/session.pyx":64 * """LibSSH2 Session class providing session functions""" * - * def __cinit__(self): # <<<<<<<<<<<<<< - * self._session = c_ssh2.libssh2_session_init() - * if self._session is NULL: + * def __cinit__(self, socket=None): # <<<<<<<<<<<<<< + * self._session = c_ssh2.libssh2_session_init_ex( + * NULL, NULL, NULL, self) */ /* Python wrapper */ static int __pyx_pw_4ssh2_7session_7Session_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_4ssh2_7session_7Session_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_socket = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; - __pyx_r = __pyx_pf_4ssh2_7session_7Session___cinit__(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self)); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_socket,0}; + PyObject* values[1] = {0}; + values[0] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_socket); + if (value) { values[0] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 64, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_socket = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 64, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("ssh2.session.Session.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4ssh2_7session_7Session___cinit__(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_socket); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_4ssh2_7session_7Session___cinit__(struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self) { +static int __pyx_pf_4ssh2_7session_7Session___cinit__(struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self, PyObject *__pyx_v_socket) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -1749,69 +1804,125 @@ static int __pyx_pf_4ssh2_7session_7Session___cinit__(struct __pyx_obj_4ssh2_7se /* "ssh2/session.pyx":65 * - * def __cinit__(self): - * self._session = c_ssh2.libssh2_session_init() # <<<<<<<<<<<<<< + * def __cinit__(self, socket=None): + * self._session = c_ssh2.libssh2_session_init_ex( # <<<<<<<<<<<<<< + * NULL, NULL, NULL, self) * if self._session is NULL: - * raise MemoryError */ - __pyx_v_self->_session = libssh2_session_init(); + __pyx_v_self->_session = libssh2_session_init_ex(NULL, NULL, NULL, ((void *)__pyx_v_self)); - /* "ssh2/session.pyx":66 - * def __cinit__(self): - * self._session = c_ssh2.libssh2_session_init() + /* "ssh2/session.pyx":67 + * self._session = c_ssh2.libssh2_session_init_ex( + * NULL, NULL, NULL, self) * if self._session is NULL: # <<<<<<<<<<<<<< * raise MemoryError - * self._sock = 0 + * if socket is not None: */ __pyx_t_1 = ((__pyx_v_self->_session == NULL) != 0); if (unlikely(__pyx_t_1)) { - /* "ssh2/session.pyx":67 - * self._session = c_ssh2.libssh2_session_init() + /* "ssh2/session.pyx":68 + * NULL, NULL, NULL, self) * if self._session is NULL: * raise MemoryError # <<<<<<<<<<<<<< - * self._sock = 0 - * self.sock = None + * if socket is not None: + * self._sock = PyObject_AsFileDescriptor(socket) */ - PyErr_NoMemory(); __PYX_ERR(0, 67, __pyx_L1_error) + PyErr_NoMemory(); __PYX_ERR(0, 68, __pyx_L1_error) - /* "ssh2/session.pyx":66 - * def __cinit__(self): - * self._session = c_ssh2.libssh2_session_init() + /* "ssh2/session.pyx":67 + * self._session = c_ssh2.libssh2_session_init_ex( + * NULL, NULL, NULL, self) * if self._session is NULL: # <<<<<<<<<<<<<< * raise MemoryError - * self._sock = 0 + * if socket is not None: */ } - /* "ssh2/session.pyx":68 + /* "ssh2/session.pyx":69 * if self._session is NULL: * raise MemoryError - * self._sock = 0 # <<<<<<<<<<<<<< - * self.sock = None - * + * if socket is not None: # <<<<<<<<<<<<<< + * self._sock = PyObject_AsFileDescriptor(socket) + * self.sock = socket */ - __pyx_v_self->_sock = 0; + __pyx_t_1 = (__pyx_v_socket != Py_None); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { - /* "ssh2/session.pyx":69 + /* "ssh2/session.pyx":70 + * raise MemoryError + * if socket is not None: + * self._sock = PyObject_AsFileDescriptor(socket) # <<<<<<<<<<<<<< + * self.sock = socket + * else: + */ + __pyx_t_3 = PyObject_AsFileDescriptor(__pyx_v_socket); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_v_self->_sock = __pyx_t_3; + + /* "ssh2/session.pyx":71 + * if socket is not None: + * self._sock = PyObject_AsFileDescriptor(socket) + * self.sock = socket # <<<<<<<<<<<<<< + * else: + * self._sock = 0 + */ + __Pyx_INCREF(__pyx_v_socket); + __Pyx_GIVEREF(__pyx_v_socket); + __Pyx_GOTREF(__pyx_v_self->sock); + __Pyx_DECREF(__pyx_v_self->sock); + __pyx_v_self->sock = __pyx_v_socket; + + /* "ssh2/session.pyx":69 + * if self._session is NULL: * raise MemoryError - * self._sock = 0 - * self.sock = None # <<<<<<<<<<<<<< + * if socket is not None: # <<<<<<<<<<<<<< + * self._sock = PyObject_AsFileDescriptor(socket) + * self.sock = socket + */ + goto __pyx_L4; + } + + /* "ssh2/session.pyx":73 + * self.sock = socket + * else: + * self._sock = 0 # <<<<<<<<<<<<<< + * self.sock = None + * self._kbd_callback = None + */ + /*else*/ { + __pyx_v_self->_sock = 0; + + /* "ssh2/session.pyx":74 + * else: + * self._sock = 0 + * self.sock = None # <<<<<<<<<<<<<< + * self._kbd_callback = None + * + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->sock); + __Pyx_DECREF(__pyx_v_self->sock); + __pyx_v_self->sock = Py_None; + } + __pyx_L4:; + + /* "ssh2/session.pyx":75 + * self._sock = 0 + * self.sock = None + * self._kbd_callback = None # <<<<<<<<<<<<<< * * def __dealloc__(self): */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->sock); - __Pyx_DECREF(__pyx_v_self->sock); - __pyx_v_self->sock = Py_None; + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_kbd_callback, Py_None) < 0) __PYX_ERR(0, 75, __pyx_L1_error) /* "ssh2/session.pyx":64 * """LibSSH2 Session class providing session functions""" * - * def __cinit__(self): # <<<<<<<<<<<<<< - * self._session = c_ssh2.libssh2_session_init() - * if self._session is NULL: + * def __cinit__(self, socket=None): # <<<<<<<<<<<<<< + * self._session = c_ssh2.libssh2_session_init_ex( + * NULL, NULL, NULL, self) */ /* function exit code */ @@ -1825,8 +1936,8 @@ static int __pyx_pf_4ssh2_7session_7Session___cinit__(struct __pyx_obj_4ssh2_7se return __pyx_r; } -/* "ssh2/session.pyx":71 - * self.sock = None +/* "ssh2/session.pyx":77 + * self._kbd_callback = None * * def __dealloc__(self): # <<<<<<<<<<<<<< * if self._session is not NULL: @@ -1849,7 +1960,7 @@ static void __pyx_pf_4ssh2_7session_7Session_2__dealloc__(struct __pyx_obj_4ssh2 int __pyx_t_1; __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "ssh2/session.pyx":72 + /* "ssh2/session.pyx":78 * * def __dealloc__(self): * if self._session is not NULL: # <<<<<<<<<<<<<< @@ -1859,7 +1970,7 @@ static void __pyx_pf_4ssh2_7session_7Session_2__dealloc__(struct __pyx_obj_4ssh2 __pyx_t_1 = ((__pyx_v_self->_session != NULL) != 0); if (__pyx_t_1) { - /* "ssh2/session.pyx":73 + /* "ssh2/session.pyx":79 * def __dealloc__(self): * if self._session is not NULL: * c_ssh2.libssh2_session_free(self._session) # <<<<<<<<<<<<<< @@ -1868,7 +1979,7 @@ static void __pyx_pf_4ssh2_7session_7Session_2__dealloc__(struct __pyx_obj_4ssh2 */ (void)(libssh2_session_free(__pyx_v_self->_session)); - /* "ssh2/session.pyx":72 + /* "ssh2/session.pyx":78 * * def __dealloc__(self): * if self._session is not NULL: # <<<<<<<<<<<<<< @@ -1877,7 +1988,7 @@ static void __pyx_pf_4ssh2_7session_7Session_2__dealloc__(struct __pyx_obj_4ssh2 */ } - /* "ssh2/session.pyx":74 + /* "ssh2/session.pyx":80 * if self._session is not NULL: * c_ssh2.libssh2_session_free(self._session) * self._session = NULL # <<<<<<<<<<<<<< @@ -1886,8 +1997,8 @@ static void __pyx_pf_4ssh2_7session_7Session_2__dealloc__(struct __pyx_obj_4ssh2 */ __pyx_v_self->_session = NULL; - /* "ssh2/session.pyx":71 - * self.sock = None + /* "ssh2/session.pyx":77 + * self._kbd_callback = None * * def __dealloc__(self): # <<<<<<<<<<<<<< * if self._session is not NULL: @@ -1898,7 +2009,7 @@ static void __pyx_pf_4ssh2_7session_7Session_2__dealloc__(struct __pyx_obj_4ssh2 __Pyx_RefNannyFinishContext(); } -/* "ssh2/session.pyx":76 +/* "ssh2/session.pyx":82 * self._session = NULL * * def disconnect(self): # <<<<<<<<<<<<<< @@ -1931,7 +2042,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_4disconnect(struct __pyx_obj_4 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("disconnect", 0); - /* "ssh2/session.pyx":78 + /* "ssh2/session.pyx":84 * def disconnect(self): * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -1946,7 +2057,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_4disconnect(struct __pyx_obj_4 #endif /*try:*/ { - /* "ssh2/session.pyx":79 + /* "ssh2/session.pyx":85 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_session_disconnect(self._session, b"end") # <<<<<<<<<<<<<< @@ -1956,7 +2067,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_4disconnect(struct __pyx_obj_4 __pyx_v_rc = libssh2_session_disconnect(__pyx_v_self->_session, ((char const *)"end")); } - /* "ssh2/session.pyx":78 + /* "ssh2/session.pyx":84 * def disconnect(self): * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -1975,7 +2086,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_4disconnect(struct __pyx_obj_4 } } - /* "ssh2/session.pyx":80 + /* "ssh2/session.pyx":86 * with nogil: * rc = c_ssh2.libssh2_session_disconnect(self._session, b"end") * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -1983,14 +2094,14 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_4disconnect(struct __pyx_obj_4 * def handshake(self, sock not None): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 80, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":76 + /* "ssh2/session.pyx":82 * self._session = NULL * * def disconnect(self): # <<<<<<<<<<<<<< @@ -2009,7 +2120,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_4disconnect(struct __pyx_obj_4 return __pyx_r; } -/* "ssh2/session.pyx":82 +/* "ssh2/session.pyx":88 * return handle_error_codes(rc) * * def handshake(self, sock not None): # <<<<<<<<<<<<<< @@ -2028,7 +2139,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_7handshake(PyObject *__pyx_v_s __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("handshake (wrapper)", 0); if (unlikely(((PyObject *)__pyx_v_sock) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sock"); __PYX_ERR(0, 82, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sock"); __PYX_ERR(0, 88, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_6handshake(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), ((PyObject *)__pyx_v_sock)); @@ -2053,17 +2164,17 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("handshake", 0); - /* "ssh2/session.pyx":86 + /* "ssh2/session.pyx":92 * * Must be called after Session initialisation.""" * cdef int _sock = PyObject_AsFileDescriptor(sock) # <<<<<<<<<<<<<< * cdef int rc * with nogil: */ - __pyx_t_1 = PyObject_AsFileDescriptor(__pyx_v_sock); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_1 = PyObject_AsFileDescriptor(__pyx_v_sock); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 92, __pyx_L1_error) __pyx_v__sock = __pyx_t_1; - /* "ssh2/session.pyx":88 + /* "ssh2/session.pyx":94 * cdef int _sock = PyObject_AsFileDescriptor(sock) * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -2078,7 +2189,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4s #endif /*try:*/ { - /* "ssh2/session.pyx":89 + /* "ssh2/session.pyx":95 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_session_handshake(self._session, _sock) # <<<<<<<<<<<<<< @@ -2087,7 +2198,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4s */ __pyx_v_rc = libssh2_session_handshake(__pyx_v_self->_session, __pyx_v__sock); - /* "ssh2/session.pyx":90 + /* "ssh2/session.pyx":96 * with nogil: * rc = c_ssh2.libssh2_session_handshake(self._session, _sock) * self._sock = _sock # <<<<<<<<<<<<<< @@ -2097,7 +2208,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4s __pyx_v_self->_sock = __pyx_v__sock; } - /* "ssh2/session.pyx":88 + /* "ssh2/session.pyx":94 * cdef int _sock = PyObject_AsFileDescriptor(sock) * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -2116,7 +2227,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4s } } - /* "ssh2/session.pyx":91 + /* "ssh2/session.pyx":97 * rc = c_ssh2.libssh2_session_handshake(self._session, _sock) * self._sock = _sock * self.sock = sock # <<<<<<<<<<<<<< @@ -2129,7 +2240,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4s __Pyx_DECREF(__pyx_v_self->sock); __pyx_v_self->sock = __pyx_v_sock; - /* "ssh2/session.pyx":92 + /* "ssh2/session.pyx":98 * self._sock = _sock * self.sock = sock * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -2137,14 +2248,14 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4s * def startup(self, sock): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 92, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":82 + /* "ssh2/session.pyx":88 * return handle_error_codes(rc) * * def handshake(self, sock not None): # <<<<<<<<<<<<<< @@ -2163,7 +2274,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4s return __pyx_r; } -/* "ssh2/session.pyx":94 +/* "ssh2/session.pyx":100 * return handle_error_codes(rc) * * def startup(self, sock): # <<<<<<<<<<<<<< @@ -2197,17 +2308,17 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_8startup(struct __pyx_obj_4ssh int __pyx_clineno = 0; __Pyx_RefNannySetupContext("startup", 0); - /* "ssh2/session.pyx":96 + /* "ssh2/session.pyx":102 * def startup(self, sock): * """Deprecated - use self.handshake""" * cdef int _sock = PyObject_AsFileDescriptor(sock) # <<<<<<<<<<<<<< * cdef int rc * rc = c_ssh2.libssh2_session_startup(self._session, _sock) */ - __pyx_t_1 = PyObject_AsFileDescriptor(__pyx_v_sock); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 96, __pyx_L1_error) + __pyx_t_1 = PyObject_AsFileDescriptor(__pyx_v_sock); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 102, __pyx_L1_error) __pyx_v__sock = __pyx_t_1; - /* "ssh2/session.pyx":98 + /* "ssh2/session.pyx":104 * cdef int _sock = PyObject_AsFileDescriptor(sock) * cdef int rc * rc = c_ssh2.libssh2_session_startup(self._session, _sock) # <<<<<<<<<<<<<< @@ -2216,7 +2327,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_8startup(struct __pyx_obj_4ssh */ __pyx_v_rc = libssh2_session_startup(__pyx_v_self->_session, __pyx_v__sock); - /* "ssh2/session.pyx":99 + /* "ssh2/session.pyx":105 * cdef int rc * rc = c_ssh2.libssh2_session_startup(self._session, _sock) * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -2224,14 +2335,14 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_8startup(struct __pyx_obj_4ssh * def set_blocking(self, bint blocking): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 99, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 105, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":94 + /* "ssh2/session.pyx":100 * return handle_error_codes(rc) * * def startup(self, sock): # <<<<<<<<<<<<<< @@ -2250,7 +2361,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_8startup(struct __pyx_obj_4ssh return __pyx_r; } -/* "ssh2/session.pyx":101 +/* "ssh2/session.pyx":107 * return handle_error_codes(rc) * * def set_blocking(self, bint blocking): # <<<<<<<<<<<<<< @@ -2270,7 +2381,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_11set_blocking(PyObject *__pyx __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_blocking (wrapper)", 0); assert(__pyx_arg_blocking); { - __pyx_v_blocking = __Pyx_PyObject_IsTrue(__pyx_arg_blocking); if (unlikely((__pyx_v_blocking == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L3_error) + __pyx_v_blocking = __Pyx_PyObject_IsTrue(__pyx_arg_blocking); if (unlikely((__pyx_v_blocking == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -2290,7 +2401,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_10set_blocking(struct __pyx_ob __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_blocking", 0); - /* "ssh2/session.pyx":107 + /* "ssh2/session.pyx":113 * Session default is blocking unless set otherwise. * :type blocking: bool""" * with nogil: # <<<<<<<<<<<<<< @@ -2305,7 +2416,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_10set_blocking(struct __pyx_ob #endif /*try:*/ { - /* "ssh2/session.pyx":108 + /* "ssh2/session.pyx":114 * :type blocking: bool""" * with nogil: * c_ssh2.libssh2_session_set_blocking( # <<<<<<<<<<<<<< @@ -2315,7 +2426,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_10set_blocking(struct __pyx_ob libssh2_session_set_blocking(__pyx_v_self->_session, __pyx_v_blocking); } - /* "ssh2/session.pyx":107 + /* "ssh2/session.pyx":113 * Session default is blocking unless set otherwise. * :type blocking: bool""" * with nogil: # <<<<<<<<<<<<<< @@ -2334,7 +2445,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_10set_blocking(struct __pyx_ob } } - /* "ssh2/session.pyx":101 + /* "ssh2/session.pyx":107 * return handle_error_codes(rc) * * def set_blocking(self, bint blocking): # <<<<<<<<<<<<<< @@ -2349,7 +2460,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_10set_blocking(struct __pyx_ob return __pyx_r; } -/* "ssh2/session.pyx":111 +/* "ssh2/session.pyx":117 * self._session, blocking) * * def get_blocking(self): # <<<<<<<<<<<<<< @@ -2382,7 +2493,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_12get_blocking(struct __pyx_ob int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_blocking", 0); - /* "ssh2/session.pyx":116 + /* "ssh2/session.pyx":122 * :rtype: bool""" * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -2397,7 +2508,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_12get_blocking(struct __pyx_ob #endif /*try:*/ { - /* "ssh2/session.pyx":117 + /* "ssh2/session.pyx":123 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_session_get_blocking(self._session) # <<<<<<<<<<<<<< @@ -2407,7 +2518,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_12get_blocking(struct __pyx_ob __pyx_v_rc = libssh2_session_get_blocking(__pyx_v_self->_session); } - /* "ssh2/session.pyx":116 + /* "ssh2/session.pyx":122 * :rtype: bool""" * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -2426,7 +2537,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_12get_blocking(struct __pyx_ob } } - /* "ssh2/session.pyx":118 + /* "ssh2/session.pyx":124 * with nogil: * rc = c_ssh2.libssh2_session_get_blocking(self._session) * return bool(rc) # <<<<<<<<<<<<<< @@ -2434,17 +2545,17 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_12get_blocking(struct __pyx_ob * def set_timeout(self, long timeout): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 124, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyBool_FromLong((!(!__pyx_t_2))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBool_FromLong((!(!__pyx_t_2))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":111 + /* "ssh2/session.pyx":117 * self._session, blocking) * * def get_blocking(self): # <<<<<<<<<<<<<< @@ -2463,7 +2574,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_12get_blocking(struct __pyx_ob return __pyx_r; } -/* "ssh2/session.pyx":120 +/* "ssh2/session.pyx":126 * return bool(rc) * * def set_timeout(self, long timeout): # <<<<<<<<<<<<<< @@ -2483,7 +2594,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_15set_timeout(PyObject *__pyx_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_timeout (wrapper)", 0); assert(__pyx_arg_timeout); { - __pyx_v_timeout = __Pyx_PyInt_As_long(__pyx_arg_timeout); if (unlikely((__pyx_v_timeout == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L3_error) + __pyx_v_timeout = __Pyx_PyInt_As_long(__pyx_arg_timeout); if (unlikely((__pyx_v_timeout == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 126, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -2503,7 +2614,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_14set_timeout(struct __pyx_obj __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_timeout", 0); - /* "ssh2/session.pyx":128 + /* "ssh2/session.pyx":134 * time out. * :param timeout: Milliseconds to wait before timeout.""" * with nogil: # <<<<<<<<<<<<<< @@ -2518,7 +2629,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_14set_timeout(struct __pyx_obj #endif /*try:*/ { - /* "ssh2/session.pyx":129 + /* "ssh2/session.pyx":135 * :param timeout: Milliseconds to wait before timeout.""" * with nogil: * c_ssh2.libssh2_session_set_timeout(self._session, timeout) # <<<<<<<<<<<<<< @@ -2528,7 +2639,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_14set_timeout(struct __pyx_obj libssh2_session_set_timeout(__pyx_v_self->_session, __pyx_v_timeout); } - /* "ssh2/session.pyx":128 + /* "ssh2/session.pyx":134 * time out. * :param timeout: Milliseconds to wait before timeout.""" * with nogil: # <<<<<<<<<<<<<< @@ -2547,7 +2658,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_14set_timeout(struct __pyx_obj } } - /* "ssh2/session.pyx":120 + /* "ssh2/session.pyx":126 * return bool(rc) * * def set_timeout(self, long timeout): # <<<<<<<<<<<<<< @@ -2562,7 +2673,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_14set_timeout(struct __pyx_obj return __pyx_r; } -/* "ssh2/session.pyx":131 +/* "ssh2/session.pyx":137 * c_ssh2.libssh2_session_set_timeout(self._session, timeout) * * def get_timeout(self): # <<<<<<<<<<<<<< @@ -2594,7 +2705,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_16get_timeout(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_timeout", 0); - /* "ssh2/session.pyx":134 + /* "ssh2/session.pyx":140 * """Get current session timeout setting""" * cdef long timeout * with nogil: # <<<<<<<<<<<<<< @@ -2609,7 +2720,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_16get_timeout(struct __pyx_obj #endif /*try:*/ { - /* "ssh2/session.pyx":135 + /* "ssh2/session.pyx":141 * cdef long timeout * with nogil: * timeout = c_ssh2.libssh2_session_get_timeout(self._session) # <<<<<<<<<<<<<< @@ -2619,7 +2730,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_16get_timeout(struct __pyx_obj __pyx_v_timeout = libssh2_session_get_timeout(__pyx_v_self->_session); } - /* "ssh2/session.pyx":134 + /* "ssh2/session.pyx":140 * """Get current session timeout setting""" * cdef long timeout * with nogil: # <<<<<<<<<<<<<< @@ -2638,7 +2749,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_16get_timeout(struct __pyx_obj } } - /* "ssh2/session.pyx":136 + /* "ssh2/session.pyx":142 * with nogil: * timeout = c_ssh2.libssh2_session_get_timeout(self._session) * return timeout # <<<<<<<<<<<<<< @@ -2646,13 +2757,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_16get_timeout(struct __pyx_obj * def userauth_authenticated(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_timeout); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_timeout); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":131 + /* "ssh2/session.pyx":137 * c_ssh2.libssh2_session_set_timeout(self._session, timeout) * * def get_timeout(self): # <<<<<<<<<<<<<< @@ -2671,7 +2782,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_16get_timeout(struct __pyx_obj return __pyx_r; } -/* "ssh2/session.pyx":138 +/* "ssh2/session.pyx":144 * return timeout * * def userauth_authenticated(self): # <<<<<<<<<<<<<< @@ -2704,7 +2815,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_18userauth_authenticated(struc int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_authenticated", 0); - /* "ssh2/session.pyx":143 + /* "ssh2/session.pyx":149 * :rtype: bool""" * cdef bint rc * with nogil: # <<<<<<<<<<<<<< @@ -2719,7 +2830,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_18userauth_authenticated(struc #endif /*try:*/ { - /* "ssh2/session.pyx":144 + /* "ssh2/session.pyx":150 * cdef bint rc * with nogil: * rc = c_ssh2.libssh2_userauth_authenticated(self._session) # <<<<<<<<<<<<<< @@ -2729,7 +2840,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_18userauth_authenticated(struc __pyx_v_rc = libssh2_userauth_authenticated(__pyx_v_self->_session); } - /* "ssh2/session.pyx":143 + /* "ssh2/session.pyx":149 * :rtype: bool""" * cdef bint rc * with nogil: # <<<<<<<<<<<<<< @@ -2748,7 +2859,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_18userauth_authenticated(struc } } - /* "ssh2/session.pyx":145 + /* "ssh2/session.pyx":151 * with nogil: * rc = c_ssh2.libssh2_userauth_authenticated(self._session) * return bool(rc) # <<<<<<<<<<<<<< @@ -2757,13 +2868,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_18userauth_authenticated(struc */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_v_rc; - __pyx_t_2 = __Pyx_PyBool_FromLong((!(!__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBool_FromLong((!(!__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 151, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":138 + /* "ssh2/session.pyx":144 * return timeout * * def userauth_authenticated(self): # <<<<<<<<<<<<<< @@ -2782,7 +2893,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_18userauth_authenticated(struc return __pyx_r; } -/* "ssh2/session.pyx":147 +/* "ssh2/session.pyx":153 * return bool(rc) * * def userauth_list(self, username not None): # <<<<<<<<<<<<<< @@ -2801,7 +2912,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_21userauth_list(PyObject *__py __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("userauth_list (wrapper)", 0); if (unlikely(((PyObject *)__pyx_v_username) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 147, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 153, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_20userauth_list(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), ((PyObject *)__pyx_v_username)); @@ -2831,19 +2942,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_list", 0); - /* "ssh2/session.pyx":151 + /* "ssh2/session.pyx":157 * * :rtype: list""" * cdef bytes b_username = to_bytes(username) # <<<<<<<<<<<<<< * cdef char *_username = b_username * cdef size_t username_len = len(b_username) */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":152 + /* "ssh2/session.pyx":158 * :rtype: list""" * cdef bytes b_username = to_bytes(username) * cdef char *_username = b_username # <<<<<<<<<<<<<< @@ -2852,12 +2963,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o */ if (unlikely(__pyx_v_b_username == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 152, __pyx_L1_error) + __PYX_ERR(0, 158, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 152, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 158, __pyx_L1_error) __pyx_v__username = __pyx_t_2; - /* "ssh2/session.pyx":153 + /* "ssh2/session.pyx":159 * cdef bytes b_username = to_bytes(username) * cdef char *_username = b_username * cdef size_t username_len = len(b_username) # <<<<<<<<<<<<<< @@ -2866,12 +2977,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o */ if (unlikely(__pyx_v_b_username == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 153, __pyx_L1_error) + __PYX_ERR(0, 159, __pyx_L1_error) } - __pyx_t_3 = PyBytes_GET_SIZE(__pyx_v_b_username); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 153, __pyx_L1_error) + __pyx_t_3 = PyBytes_GET_SIZE(__pyx_v_b_username); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 159, __pyx_L1_error) __pyx_v_username_len = __pyx_t_3; - /* "ssh2/session.pyx":156 + /* "ssh2/session.pyx":162 * cdef char *_auth * cdef str auth * with nogil: # <<<<<<<<<<<<<< @@ -2886,7 +2997,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o #endif /*try:*/ { - /* "ssh2/session.pyx":157 + /* "ssh2/session.pyx":163 * cdef str auth * with nogil: * _auth = c_ssh2.libssh2_userauth_list( # <<<<<<<<<<<<<< @@ -2896,7 +3007,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o __pyx_v__auth = libssh2_userauth_list(__pyx_v_self->_session, __pyx_v__username, __pyx_v_username_len); } - /* "ssh2/session.pyx":156 + /* "ssh2/session.pyx":162 * cdef char *_auth * cdef str auth * with nogil: # <<<<<<<<<<<<<< @@ -2915,7 +3026,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o } } - /* "ssh2/session.pyx":159 + /* "ssh2/session.pyx":165 * _auth = c_ssh2.libssh2_userauth_list( * self._session, _username, username_len) * if _auth is NULL: # <<<<<<<<<<<<<< @@ -2925,7 +3036,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o __pyx_t_4 = ((__pyx_v__auth == NULL) != 0); if (__pyx_t_4) { - /* "ssh2/session.pyx":160 + /* "ssh2/session.pyx":166 * self._session, _username, username_len) * if _auth is NULL: * return # <<<<<<<<<<<<<< @@ -2936,7 +3047,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "ssh2/session.pyx":159 + /* "ssh2/session.pyx":165 * _auth = c_ssh2.libssh2_userauth_list( * self._session, _username, username_len) * if _auth is NULL: # <<<<<<<<<<<<<< @@ -2945,20 +3056,20 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o */ } - /* "ssh2/session.pyx":161 + /* "ssh2/session.pyx":167 * if _auth is NULL: * return * auth = to_str(_auth) # <<<<<<<<<<<<<< * return auth.split(',') * */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_str(__pyx_v__auth); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_str(__pyx_v__auth); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 161, __pyx_L1_error) + if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 167, __pyx_L1_error) __pyx_v_auth = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":162 + /* "ssh2/session.pyx":168 * return * auth = to_str(_auth) * return auth.split(',') # <<<<<<<<<<<<<< @@ -2966,13 +3077,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o * def userauth_publickey_fromfile(self, username not None, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_split, __pyx_v_auth, __pyx_kp_s_); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_split, __pyx_v_auth, __pyx_kp_s_); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":147 + /* "ssh2/session.pyx":153 * return bool(rc) * * def userauth_list(self, username not None): # <<<<<<<<<<<<<< @@ -2993,7 +3104,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o return __pyx_r; } -/* "ssh2/session.pyx":164 +/* "ssh2/session.pyx":170 * return auth.split(',') * * def userauth_publickey_fromfile(self, username not None, # <<<<<<<<<<<<<< @@ -3020,7 +3131,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_23userauth_publickey_fromfile( PyObject* values[4] = {0,0,0,0}; values[2] = ((PyObject *)__pyx_kp_s__2); - /* "ssh2/session.pyx":167 + /* "ssh2/session.pyx":173 * privatekey not None, * passphrase='', * publickey=None): # <<<<<<<<<<<<<< @@ -3052,7 +3163,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_23userauth_publickey_fromfile( case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_privatekey)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("userauth_publickey_fromfile", 0, 2, 4, 1); __PYX_ERR(0, 164, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_publickey_fromfile", 0, 2, 4, 1); __PYX_ERR(0, 170, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -3068,7 +3179,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_23userauth_publickey_fromfile( } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_publickey_fromfile") < 0)) __PYX_ERR(0, 164, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_publickey_fromfile") < 0)) __PYX_ERR(0, 170, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3089,21 +3200,21 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_23userauth_publickey_fromfile( } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("userauth_publickey_fromfile", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 164, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_publickey_fromfile", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 170, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.userauth_publickey_fromfile", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(((PyObject *)__pyx_v_username) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 164, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 170, __pyx_L1_error) } if (unlikely(((PyObject *)__pyx_v_privatekey) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "privatekey"); __PYX_ERR(0, 165, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "privatekey"); __PYX_ERR(0, 171, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_username, __pyx_v_privatekey, __pyx_v_passphrase, __pyx_v_publickey); - /* "ssh2/session.pyx":164 + /* "ssh2/session.pyx":170 * return auth.split(',') * * def userauth_publickey_fromfile(self, username not None, # <<<<<<<<<<<<<< @@ -3143,19 +3254,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_publickey_fromfile", 0); - /* "ssh2/session.pyx":172 + /* "ssh2/session.pyx":178 * :rtype: int""" * cdef int rc * cdef bytes b_username = to_bytes(username) # <<<<<<<<<<<<<< * cdef bytes b_publickey = to_bytes(publickey) \ * if publickey is not None else None */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":174 + /* "ssh2/session.pyx":180 * cdef bytes b_username = to_bytes(username) * cdef bytes b_publickey = to_bytes(publickey) \ * if publickey is not None else None # <<<<<<<<<<<<<< @@ -3165,20 +3276,20 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( __pyx_t_2 = (__pyx_v_publickey != Py_None); if ((__pyx_t_2 != 0)) { - /* "ssh2/session.pyx":173 + /* "ssh2/session.pyx":179 * cdef int rc * cdef bytes b_username = to_bytes(username) * cdef bytes b_publickey = to_bytes(publickey) \ # <<<<<<<<<<<<<< * if publickey is not None else None * cdef bytes b_privatekey = to_bytes(privatekey) */ - __pyx_t_3 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_publickey); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error) + __pyx_t_3 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_publickey); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; } else { - /* "ssh2/session.pyx":174 + /* "ssh2/session.pyx":180 * cdef bytes b_username = to_bytes(username) * cdef bytes b_publickey = to_bytes(publickey) \ * if publickey is not None else None # <<<<<<<<<<<<<< @@ -3191,31 +3302,31 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( __pyx_v_b_publickey = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":175 + /* "ssh2/session.pyx":181 * cdef bytes b_publickey = to_bytes(publickey) \ * if publickey is not None else None * cdef bytes b_privatekey = to_bytes(privatekey) # <<<<<<<<<<<<<< * cdef bytes b_passphrase = to_bytes(passphrase) * cdef char *_username = b_username */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_privatekey); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_privatekey); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_privatekey = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":176 + /* "ssh2/session.pyx":182 * if publickey is not None else None * cdef bytes b_privatekey = to_bytes(privatekey) * cdef bytes b_passphrase = to_bytes(passphrase) # <<<<<<<<<<<<<< * cdef char *_username = b_username * cdef char *_publickey = NULL */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_passphrase); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_passphrase); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_passphrase = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":177 + /* "ssh2/session.pyx":183 * cdef bytes b_privatekey = to_bytes(privatekey) * cdef bytes b_passphrase = to_bytes(passphrase) * cdef char *_username = b_username # <<<<<<<<<<<<<< @@ -3224,12 +3335,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( */ if (unlikely(__pyx_v_b_username == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 177, __pyx_L1_error) + __PYX_ERR(0, 183, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 177, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L1_error) __pyx_v__username = __pyx_t_4; - /* "ssh2/session.pyx":178 + /* "ssh2/session.pyx":184 * cdef bytes b_passphrase = to_bytes(passphrase) * cdef char *_username = b_username * cdef char *_publickey = NULL # <<<<<<<<<<<<<< @@ -3238,7 +3349,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( */ __pyx_v__publickey = NULL; - /* "ssh2/session.pyx":179 + /* "ssh2/session.pyx":185 * cdef char *_username = b_username * cdef char *_publickey = NULL * cdef char *_privatekey = b_privatekey # <<<<<<<<<<<<<< @@ -3247,12 +3358,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( */ if (unlikely(__pyx_v_b_privatekey == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 179, __pyx_L1_error) + __PYX_ERR(0, 185, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_privatekey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_privatekey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L1_error) __pyx_v__privatekey = __pyx_t_4; - /* "ssh2/session.pyx":180 + /* "ssh2/session.pyx":186 * cdef char *_publickey = NULL * cdef char *_privatekey = b_privatekey * cdef char *_passphrase = b_passphrase # <<<<<<<<<<<<<< @@ -3261,12 +3372,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( */ if (unlikely(__pyx_v_b_passphrase == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 180, __pyx_L1_error) + __PYX_ERR(0, 186, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_passphrase); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_passphrase); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 186, __pyx_L1_error) __pyx_v__passphrase = __pyx_t_4; - /* "ssh2/session.pyx":181 + /* "ssh2/session.pyx":187 * cdef char *_privatekey = b_privatekey * cdef char *_passphrase = b_passphrase * if b_publickey is not None: # <<<<<<<<<<<<<< @@ -3277,7 +3388,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( __pyx_t_5 = (__pyx_t_2 != 0); if (__pyx_t_5) { - /* "ssh2/session.pyx":182 + /* "ssh2/session.pyx":188 * cdef char *_passphrase = b_passphrase * if b_publickey is not None: * _publickey = b_publickey # <<<<<<<<<<<<<< @@ -3286,12 +3397,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( */ if (unlikely(__pyx_v_b_publickey == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 182, __pyx_L1_error) + __PYX_ERR(0, 188, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_publickey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_publickey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 188, __pyx_L1_error) __pyx_v__publickey = __pyx_t_4; - /* "ssh2/session.pyx":181 + /* "ssh2/session.pyx":187 * cdef char *_privatekey = b_privatekey * cdef char *_passphrase = b_passphrase * if b_publickey is not None: # <<<<<<<<<<<<<< @@ -3300,7 +3411,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( */ } - /* "ssh2/session.pyx":183 + /* "ssh2/session.pyx":189 * if b_publickey is not None: * _publickey = b_publickey * with nogil: # <<<<<<<<<<<<<< @@ -3315,7 +3426,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( #endif /*try:*/ { - /* "ssh2/session.pyx":184 + /* "ssh2/session.pyx":190 * _publickey = b_publickey * with nogil: * rc = c_ssh2.libssh2_userauth_publickey_fromfile( # <<<<<<<<<<<<<< @@ -3325,7 +3436,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( __pyx_v_rc = libssh2_userauth_publickey_fromfile(__pyx_v_self->_session, __pyx_v__username, __pyx_v__publickey, __pyx_v__privatekey, __pyx_v__passphrase); } - /* "ssh2/session.pyx":183 + /* "ssh2/session.pyx":189 * if b_publickey is not None: * _publickey = b_publickey * with nogil: # <<<<<<<<<<<<<< @@ -3344,7 +3455,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( } } - /* "ssh2/session.pyx":186 + /* "ssh2/session.pyx":192 * rc = c_ssh2.libssh2_userauth_publickey_fromfile( * self._session, _username, _publickey, _privatekey, _passphrase) * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -3352,14 +3463,14 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( * def userauth_publickey(self, username not None, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 186, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error) + __pyx_t_6 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 192, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":164 + /* "ssh2/session.pyx":170 * return auth.split(',') * * def userauth_publickey_fromfile(self, username not None, # <<<<<<<<<<<<<< @@ -3383,7 +3494,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( return __pyx_r; } -/* "ssh2/session.pyx":188 +/* "ssh2/session.pyx":194 * return handle_error_codes(rc) * * def userauth_publickey(self, username not None, # <<<<<<<<<<<<<< @@ -3426,11 +3537,11 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_25userauth_publickey(PyObject case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pubkeydata)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("userauth_publickey", 1, 2, 2, 1); __PYX_ERR(0, 188, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_publickey", 1, 2, 2, 1); __PYX_ERR(0, 194, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_publickey") < 0)) __PYX_ERR(0, 188, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_publickey") < 0)) __PYX_ERR(0, 194, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -3443,16 +3554,16 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_25userauth_publickey(PyObject } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("userauth_publickey", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 188, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_publickey", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 194, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.userauth_publickey", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(((PyObject *)__pyx_v_username) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 188, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 194, __pyx_L1_error) } - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pubkeydata), (&PyBytes_Type), 0, "pubkeydata", 1))) __PYX_ERR(0, 189, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pubkeydata), (&PyBytes_Type), 0, "pubkeydata", 1))) __PYX_ERR(0, 195, __pyx_L1_error) __pyx_r = __pyx_pf_4ssh2_7session_7Session_24userauth_publickey(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_username, __pyx_v_pubkeydata); /* function exit code */ @@ -3482,19 +3593,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_24userauth_publickey(struct __ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_publickey", 0); - /* "ssh2/session.pyx":199 + /* "ssh2/session.pyx":205 * :rtype: int""" * cdef int rc * cdef bytes b_username = to_bytes(username) # <<<<<<<<<<<<<< * cdef char *_username = b_username * cdef unsigned char *_pubkeydata = pubkeydata */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":200 + /* "ssh2/session.pyx":206 * cdef int rc * cdef bytes b_username = to_bytes(username) * cdef char *_username = b_username # <<<<<<<<<<<<<< @@ -3503,32 +3614,32 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_24userauth_publickey(struct __ */ if (unlikely(__pyx_v_b_username == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 200, __pyx_L1_error) + __PYX_ERR(0, 206, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 200, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 206, __pyx_L1_error) __pyx_v__username = __pyx_t_2; - /* "ssh2/session.pyx":201 + /* "ssh2/session.pyx":207 * cdef bytes b_username = to_bytes(username) * cdef char *_username = b_username * cdef unsigned char *_pubkeydata = pubkeydata # <<<<<<<<<<<<<< * cdef size_t pubkeydata_len = len(pubkeydata) * with nogil: */ - __pyx_t_3 = __Pyx_PyBytes_AsWritableUString(__pyx_v_pubkeydata); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 201, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBytes_AsWritableUString(__pyx_v_pubkeydata); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 207, __pyx_L1_error) __pyx_v__pubkeydata = __pyx_t_3; - /* "ssh2/session.pyx":202 + /* "ssh2/session.pyx":208 * cdef char *_username = b_username * cdef unsigned char *_pubkeydata = pubkeydata * cdef size_t pubkeydata_len = len(pubkeydata) # <<<<<<<<<<<<<< * with nogil: * rc = c_ssh2.libssh2_userauth_publickey( */ - __pyx_t_4 = PyBytes_GET_SIZE(__pyx_v_pubkeydata); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_t_4 = PyBytes_GET_SIZE(__pyx_v_pubkeydata); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 208, __pyx_L1_error) __pyx_v_pubkeydata_len = __pyx_t_4; - /* "ssh2/session.pyx":203 + /* "ssh2/session.pyx":209 * cdef unsigned char *_pubkeydata = pubkeydata * cdef size_t pubkeydata_len = len(pubkeydata) * with nogil: # <<<<<<<<<<<<<< @@ -3543,7 +3654,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_24userauth_publickey(struct __ #endif /*try:*/ { - /* "ssh2/session.pyx":204 + /* "ssh2/session.pyx":210 * cdef size_t pubkeydata_len = len(pubkeydata) * with nogil: * rc = c_ssh2.libssh2_userauth_publickey( # <<<<<<<<<<<<<< @@ -3553,7 +3664,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_24userauth_publickey(struct __ __pyx_v_rc = libssh2_userauth_publickey(__pyx_v_self->_session, __pyx_v__username, __pyx_v__pubkeydata, __pyx_v_pubkeydata_len, NULL, NULL); } - /* "ssh2/session.pyx":203 + /* "ssh2/session.pyx":209 * cdef unsigned char *_pubkeydata = pubkeydata * cdef size_t pubkeydata_len = len(pubkeydata) * with nogil: # <<<<<<<<<<<<<< @@ -3572,7 +3683,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_24userauth_publickey(struct __ } } - /* "ssh2/session.pyx":207 + /* "ssh2/session.pyx":213 * self._session, _username, _pubkeydata, * pubkeydata_len, NULL, NULL) * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -3580,14 +3691,14 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_24userauth_publickey(struct __ * def userauth_hostbased_fromfile(self, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 207, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_t_5 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 213, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":188 + /* "ssh2/session.pyx":194 * return handle_error_codes(rc) * * def userauth_publickey(self, username not None, # <<<<<<<<<<<<<< @@ -3607,7 +3718,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_24userauth_publickey(struct __ return __pyx_r; } -/* "ssh2/session.pyx":209 +/* "ssh2/session.pyx":215 * return handle_error_codes(rc) * * def userauth_hostbased_fromfile(self, # <<<<<<<<<<<<<< @@ -3634,7 +3745,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_27userauth_hostbased_fromfile( static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_username,&__pyx_n_s_privatekey,&__pyx_n_s_hostname,&__pyx_n_s_publickey,&__pyx_n_s_passphrase,0}; PyObject* values[5] = {0,0,0,0,0}; - /* "ssh2/session.pyx":213 + /* "ssh2/session.pyx":219 * privatekey not None, * hostname not None, * publickey=None, # <<<<<<<<<<<<<< @@ -3669,13 +3780,13 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_27userauth_hostbased_fromfile( case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_privatekey)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("userauth_hostbased_fromfile", 0, 3, 5, 1); __PYX_ERR(0, 209, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_hostbased_fromfile", 0, 3, 5, 1); __PYX_ERR(0, 215, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hostname)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("userauth_hostbased_fromfile", 0, 3, 5, 2); __PYX_ERR(0, 209, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_hostbased_fromfile", 0, 3, 5, 2); __PYX_ERR(0, 215, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: @@ -3691,7 +3802,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_27userauth_hostbased_fromfile( } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_hostbased_fromfile") < 0)) __PYX_ERR(0, 209, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_hostbased_fromfile") < 0)) __PYX_ERR(0, 215, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3714,24 +3825,24 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_27userauth_hostbased_fromfile( } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("userauth_hostbased_fromfile", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 209, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_hostbased_fromfile", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 215, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.userauth_hostbased_fromfile", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(((PyObject *)__pyx_v_username) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 210, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 216, __pyx_L1_error) } if (unlikely(((PyObject *)__pyx_v_privatekey) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "privatekey"); __PYX_ERR(0, 211, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "privatekey"); __PYX_ERR(0, 217, __pyx_L1_error) } if (unlikely(((PyObject *)__pyx_v_hostname) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "hostname"); __PYX_ERR(0, 212, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "hostname"); __PYX_ERR(0, 218, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_username, __pyx_v_privatekey, __pyx_v_hostname, __pyx_v_publickey, __pyx_v_passphrase); - /* "ssh2/session.pyx":209 + /* "ssh2/session.pyx":215 * return handle_error_codes(rc) * * def userauth_hostbased_fromfile(self, # <<<<<<<<<<<<<< @@ -3773,19 +3884,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_hostbased_fromfile", 0); - /* "ssh2/session.pyx":216 + /* "ssh2/session.pyx":222 * passphrase=''): * cdef int rc * cdef bytes b_username = to_bytes(username) # <<<<<<<<<<<<<< * cdef bytes b_publickey = to_bytes(publickey) \ * if publickey is not None else None */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":218 + /* "ssh2/session.pyx":224 * cdef bytes b_username = to_bytes(username) * cdef bytes b_publickey = to_bytes(publickey) \ * if publickey is not None else None # <<<<<<<<<<<<<< @@ -3795,20 +3906,20 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( __pyx_t_2 = (__pyx_v_publickey != Py_None); if ((__pyx_t_2 != 0)) { - /* "ssh2/session.pyx":217 + /* "ssh2/session.pyx":223 * cdef int rc * cdef bytes b_username = to_bytes(username) * cdef bytes b_publickey = to_bytes(publickey) \ # <<<<<<<<<<<<<< * if publickey is not None else None * cdef bytes b_privatekey = to_bytes(privatekey) */ - __pyx_t_3 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_publickey); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 217, __pyx_L1_error) + __pyx_t_3 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_publickey); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; } else { - /* "ssh2/session.pyx":218 + /* "ssh2/session.pyx":224 * cdef bytes b_username = to_bytes(username) * cdef bytes b_publickey = to_bytes(publickey) \ * if publickey is not None else None # <<<<<<<<<<<<<< @@ -3821,43 +3932,43 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( __pyx_v_b_publickey = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":219 + /* "ssh2/session.pyx":225 * cdef bytes b_publickey = to_bytes(publickey) \ * if publickey is not None else None * cdef bytes b_privatekey = to_bytes(privatekey) # <<<<<<<<<<<<<< * cdef bytes b_passphrase = to_bytes(passphrase) * cdef bytes b_hostname = to_bytes(hostname) */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_privatekey); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_privatekey); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_privatekey = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":220 + /* "ssh2/session.pyx":226 * if publickey is not None else None * cdef bytes b_privatekey = to_bytes(privatekey) * cdef bytes b_passphrase = to_bytes(passphrase) # <<<<<<<<<<<<<< * cdef bytes b_hostname = to_bytes(hostname) * cdef char *_username = b_username */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_passphrase); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_passphrase); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_passphrase = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":221 + /* "ssh2/session.pyx":227 * cdef bytes b_privatekey = to_bytes(privatekey) * cdef bytes b_passphrase = to_bytes(passphrase) * cdef bytes b_hostname = to_bytes(hostname) # <<<<<<<<<<<<<< * cdef char *_username = b_username * cdef char *_publickey = NULL */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_hostname); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_hostname); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_hostname = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":222 + /* "ssh2/session.pyx":228 * cdef bytes b_passphrase = to_bytes(passphrase) * cdef bytes b_hostname = to_bytes(hostname) * cdef char *_username = b_username # <<<<<<<<<<<<<< @@ -3866,12 +3977,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( */ if (unlikely(__pyx_v_b_username == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 222, __pyx_L1_error) + __PYX_ERR(0, 228, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 222, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 228, __pyx_L1_error) __pyx_v__username = __pyx_t_4; - /* "ssh2/session.pyx":223 + /* "ssh2/session.pyx":229 * cdef bytes b_hostname = to_bytes(hostname) * cdef char *_username = b_username * cdef char *_publickey = NULL # <<<<<<<<<<<<<< @@ -3880,7 +3991,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( */ __pyx_v__publickey = NULL; - /* "ssh2/session.pyx":224 + /* "ssh2/session.pyx":230 * cdef char *_username = b_username * cdef char *_publickey = NULL * cdef char *_privatekey = b_privatekey # <<<<<<<<<<<<<< @@ -3889,12 +4000,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( */ if (unlikely(__pyx_v_b_privatekey == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 224, __pyx_L1_error) + __PYX_ERR(0, 230, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_privatekey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 224, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_privatekey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 230, __pyx_L1_error) __pyx_v__privatekey = __pyx_t_4; - /* "ssh2/session.pyx":225 + /* "ssh2/session.pyx":231 * cdef char *_publickey = NULL * cdef char *_privatekey = b_privatekey * cdef char *_passphrase = b_passphrase # <<<<<<<<<<<<<< @@ -3903,12 +4014,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( */ if (unlikely(__pyx_v_b_passphrase == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 225, __pyx_L1_error) + __PYX_ERR(0, 231, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_passphrase); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 225, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_passphrase); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 231, __pyx_L1_error) __pyx_v__passphrase = __pyx_t_4; - /* "ssh2/session.pyx":226 + /* "ssh2/session.pyx":232 * cdef char *_privatekey = b_privatekey * cdef char *_passphrase = b_passphrase * cdef char *_hostname = b_hostname # <<<<<<<<<<<<<< @@ -3917,12 +4028,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( */ if (unlikely(__pyx_v_b_hostname == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 226, __pyx_L1_error) + __PYX_ERR(0, 232, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_hostname); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_hostname); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 232, __pyx_L1_error) __pyx_v__hostname = __pyx_t_4; - /* "ssh2/session.pyx":227 + /* "ssh2/session.pyx":233 * cdef char *_passphrase = b_passphrase * cdef char *_hostname = b_hostname * if b_publickey is not None: # <<<<<<<<<<<<<< @@ -3933,7 +4044,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( __pyx_t_5 = (__pyx_t_2 != 0); if (__pyx_t_5) { - /* "ssh2/session.pyx":228 + /* "ssh2/session.pyx":234 * cdef char *_hostname = b_hostname * if b_publickey is not None: * _publickey = b_publickey # <<<<<<<<<<<<<< @@ -3942,12 +4053,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( */ if (unlikely(__pyx_v_b_publickey == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 228, __pyx_L1_error) + __PYX_ERR(0, 234, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_publickey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 228, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_publickey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L1_error) __pyx_v__publickey = __pyx_t_4; - /* "ssh2/session.pyx":227 + /* "ssh2/session.pyx":233 * cdef char *_passphrase = b_passphrase * cdef char *_hostname = b_hostname * if b_publickey is not None: # <<<<<<<<<<<<<< @@ -3956,7 +4067,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( */ } - /* "ssh2/session.pyx":229 + /* "ssh2/session.pyx":235 * if b_publickey is not None: * _publickey = b_publickey * with nogil: # <<<<<<<<<<<<<< @@ -3971,7 +4082,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( #endif /*try:*/ { - /* "ssh2/session.pyx":230 + /* "ssh2/session.pyx":236 * _publickey = b_publickey * with nogil: * rc = c_ssh2.libssh2_userauth_hostbased_fromfile( # <<<<<<<<<<<<<< @@ -3981,7 +4092,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( __pyx_v_rc = libssh2_userauth_hostbased_fromfile(__pyx_v_self->_session, __pyx_v__username, __pyx_v__publickey, __pyx_v__privatekey, __pyx_v__passphrase, __pyx_v__hostname); } - /* "ssh2/session.pyx":229 + /* "ssh2/session.pyx":235 * if b_publickey is not None: * _publickey = b_publickey * with nogil: # <<<<<<<<<<<<<< @@ -4000,7 +4111,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( } } - /* "ssh2/session.pyx":233 + /* "ssh2/session.pyx":239 * self._session, _username, _publickey, * _privatekey, _passphrase, _hostname) * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -4008,14 +4119,14 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( * IF EMBEDDED_LIB: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 233, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error) + __pyx_t_6 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":209 + /* "ssh2/session.pyx":215 * return handle_error_codes(rc) * * def userauth_hostbased_fromfile(self, # <<<<<<<<<<<<<< @@ -4040,7 +4151,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( return __pyx_r; } -/* "ssh2/session.pyx":236 +/* "ssh2/session.pyx":242 * * IF EMBEDDED_LIB: * def userauth_publickey_frommemory( # <<<<<<<<<<<<<< @@ -4067,7 +4178,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_29userauth_publickey_frommemor PyObject* values[4] = {0,0,0,0}; values[2] = ((PyObject *)__pyx_kp_s__2); - /* "ssh2/session.pyx":238 + /* "ssh2/session.pyx":244 * def userauth_publickey_frommemory( * self, username, bytes privatekeyfiledata, * passphrase='', bytes publickeyfiledata=None): # <<<<<<<<<<<<<< @@ -4099,7 +4210,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_29userauth_publickey_frommemor case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_privatekeyfiledata)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("userauth_publickey_frommemory", 0, 2, 4, 1); __PYX_ERR(0, 236, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_publickey_frommemory", 0, 2, 4, 1); __PYX_ERR(0, 242, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -4115,7 +4226,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_29userauth_publickey_frommemor } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_publickey_frommemory") < 0)) __PYX_ERR(0, 236, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_publickey_frommemory") < 0)) __PYX_ERR(0, 242, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4136,17 +4247,17 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_29userauth_publickey_frommemor } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("userauth_publickey_frommemory", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 236, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_publickey_frommemory", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 242, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.userauth_publickey_frommemory", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_privatekeyfiledata), (&PyBytes_Type), 1, "privatekeyfiledata", 1))) __PYX_ERR(0, 237, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_publickeyfiledata), (&PyBytes_Type), 1, "publickeyfiledata", 1))) __PYX_ERR(0, 238, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_privatekeyfiledata), (&PyBytes_Type), 1, "privatekeyfiledata", 1))) __PYX_ERR(0, 243, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_publickeyfiledata), (&PyBytes_Type), 1, "publickeyfiledata", 1))) __PYX_ERR(0, 244, __pyx_L1_error) __pyx_r = __pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemory(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_username, __pyx_v_privatekeyfiledata, __pyx_v_passphrase, __pyx_v_publickeyfiledata); - /* "ssh2/session.pyx":236 + /* "ssh2/session.pyx":242 * * IF EMBEDDED_LIB: * def userauth_publickey_frommemory( # <<<<<<<<<<<<<< @@ -4188,31 +4299,31 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_publickey_frommemory", 0); - /* "ssh2/session.pyx":240 + /* "ssh2/session.pyx":246 * passphrase='', bytes publickeyfiledata=None): * cdef int rc * cdef bytes b_username = to_bytes(username) # <<<<<<<<<<<<<< * cdef bytes b_passphrase = to_bytes(passphrase) * cdef char *_username = b_username */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":241 + /* "ssh2/session.pyx":247 * cdef int rc * cdef bytes b_username = to_bytes(username) * cdef bytes b_passphrase = to_bytes(passphrase) # <<<<<<<<<<<<<< * cdef char *_username = b_username * cdef char *_passphrase = b_passphrase */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_passphrase); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_passphrase); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_passphrase = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":242 + /* "ssh2/session.pyx":248 * cdef bytes b_username = to_bytes(username) * cdef bytes b_passphrase = to_bytes(passphrase) * cdef char *_username = b_username # <<<<<<<<<<<<<< @@ -4221,12 +4332,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor */ if (unlikely(__pyx_v_b_username == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 242, __pyx_L1_error) + __PYX_ERR(0, 248, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 248, __pyx_L1_error) __pyx_v__username = __pyx_t_2; - /* "ssh2/session.pyx":243 + /* "ssh2/session.pyx":249 * cdef bytes b_passphrase = to_bytes(passphrase) * cdef char *_username = b_username * cdef char *_passphrase = b_passphrase # <<<<<<<<<<<<<< @@ -4235,12 +4346,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor */ if (unlikely(__pyx_v_b_passphrase == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 243, __pyx_L1_error) + __PYX_ERR(0, 249, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_passphrase); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 243, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_passphrase); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 249, __pyx_L1_error) __pyx_v__passphrase = __pyx_t_2; - /* "ssh2/session.pyx":244 + /* "ssh2/session.pyx":250 * cdef char *_username = b_username * cdef char *_passphrase = b_passphrase * cdef char *_publickeyfiledata = NULL # <<<<<<<<<<<<<< @@ -4249,7 +4360,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor */ __pyx_v__publickeyfiledata = NULL; - /* "ssh2/session.pyx":245 + /* "ssh2/session.pyx":251 * cdef char *_passphrase = b_passphrase * cdef char *_publickeyfiledata = NULL * cdef char *_privatekeyfiledata = privatekeyfiledata # <<<<<<<<<<<<<< @@ -4258,12 +4369,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor */ if (unlikely(__pyx_v_privatekeyfiledata == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 245, __pyx_L1_error) + __PYX_ERR(0, 251, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_privatekeyfiledata); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 245, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_privatekeyfiledata); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 251, __pyx_L1_error) __pyx_v__privatekeyfiledata = __pyx_t_2; - /* "ssh2/session.pyx":247 + /* "ssh2/session.pyx":253 * cdef char *_privatekeyfiledata = privatekeyfiledata * cdef size_t username_len, privatekeydata_len * cdef size_t pubkeydata_len = 0 # <<<<<<<<<<<<<< @@ -4272,7 +4383,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor */ __pyx_v_pubkeydata_len = 0; - /* "ssh2/session.pyx":249 + /* "ssh2/session.pyx":255 * cdef size_t pubkeydata_len = 0 * username_len, privatekeydata_len = \ * len(b_username), len(privatekeyfiledata) # <<<<<<<<<<<<<< @@ -4281,18 +4392,18 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor */ if (unlikely(__pyx_v_b_username == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 249, __pyx_L1_error) + __PYX_ERR(0, 255, __pyx_L1_error) } - __pyx_t_3 = PyBytes_GET_SIZE(__pyx_v_b_username); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 249, __pyx_L1_error) + __pyx_t_3 = PyBytes_GET_SIZE(__pyx_v_b_username); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 255, __pyx_L1_error) if (unlikely(__pyx_v_privatekeyfiledata == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 249, __pyx_L1_error) + __PYX_ERR(0, 255, __pyx_L1_error) } - __pyx_t_4 = PyBytes_GET_SIZE(__pyx_v_privatekeyfiledata); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 249, __pyx_L1_error) + __pyx_t_4 = PyBytes_GET_SIZE(__pyx_v_privatekeyfiledata); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 255, __pyx_L1_error) __pyx_v_username_len = __pyx_t_3; __pyx_v_privatekeydata_len = __pyx_t_4; - /* "ssh2/session.pyx":250 + /* "ssh2/session.pyx":256 * username_len, privatekeydata_len = \ * len(b_username), len(privatekeyfiledata) * if publickeyfiledata is not None: # <<<<<<<<<<<<<< @@ -4303,7 +4414,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor __pyx_t_6 = (__pyx_t_5 != 0); if (__pyx_t_6) { - /* "ssh2/session.pyx":251 + /* "ssh2/session.pyx":257 * len(b_username), len(privatekeyfiledata) * if publickeyfiledata is not None: * _publickeyfiledata = publickeyfiledata # <<<<<<<<<<<<<< @@ -4312,12 +4423,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor */ if (unlikely(__pyx_v_publickeyfiledata == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 251, __pyx_L1_error) + __PYX_ERR(0, 257, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_publickeyfiledata); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 251, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_publickeyfiledata); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L1_error) __pyx_v__publickeyfiledata = __pyx_t_2; - /* "ssh2/session.pyx":252 + /* "ssh2/session.pyx":258 * if publickeyfiledata is not None: * _publickeyfiledata = publickeyfiledata * pubkeydata_len = len(publickeyfiledata) # <<<<<<<<<<<<<< @@ -4326,12 +4437,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor */ if (unlikely(__pyx_v_publickeyfiledata == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 252, __pyx_L1_error) + __PYX_ERR(0, 258, __pyx_L1_error) } - __pyx_t_4 = PyBytes_GET_SIZE(__pyx_v_publickeyfiledata); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 252, __pyx_L1_error) + __pyx_t_4 = PyBytes_GET_SIZE(__pyx_v_publickeyfiledata); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 258, __pyx_L1_error) __pyx_v_pubkeydata_len = __pyx_t_4; - /* "ssh2/session.pyx":250 + /* "ssh2/session.pyx":256 * username_len, privatekeydata_len = \ * len(b_username), len(privatekeyfiledata) * if publickeyfiledata is not None: # <<<<<<<<<<<<<< @@ -4340,7 +4451,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor */ } - /* "ssh2/session.pyx":253 + /* "ssh2/session.pyx":259 * _publickeyfiledata = publickeyfiledata * pubkeydata_len = len(publickeyfiledata) * with nogil: # <<<<<<<<<<<<<< @@ -4355,7 +4466,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor #endif /*try:*/ { - /* "ssh2/session.pyx":254 + /* "ssh2/session.pyx":260 * pubkeydata_len = len(publickeyfiledata) * with nogil: * rc = c_ssh2.libssh2_userauth_publickey_frommemory( # <<<<<<<<<<<<<< @@ -4365,7 +4476,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor __pyx_v_rc = libssh2_userauth_publickey_frommemory(__pyx_v_self->_session, __pyx_v__username, __pyx_v_username_len, __pyx_v__publickeyfiledata, __pyx_v_pubkeydata_len, __pyx_v__privatekeyfiledata, __pyx_v_privatekeydata_len, __pyx_v__passphrase); } - /* "ssh2/session.pyx":253 + /* "ssh2/session.pyx":259 * _publickeyfiledata = publickeyfiledata * pubkeydata_len = len(publickeyfiledata) * with nogil: # <<<<<<<<<<<<<< @@ -4384,7 +4495,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor } } - /* "ssh2/session.pyx":258 + /* "ssh2/session.pyx":264 * pubkeydata_len, _privatekeyfiledata, * privatekeydata_len, _passphrase) * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -4392,14 +4503,14 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor * def userauth_password(self, username not None, password not None): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_7 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 258, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) + __pyx_t_7 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 264, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":236 + /* "ssh2/session.pyx":242 * * IF EMBEDDED_LIB: * def userauth_publickey_frommemory( # <<<<<<<<<<<<<< @@ -4420,7 +4531,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor return __pyx_r; } -/* "ssh2/session.pyx":260 +/* "ssh2/session.pyx":266 * return handle_error_codes(rc) * * def userauth_password(self, username not None, password not None): # <<<<<<<<<<<<<< @@ -4463,11 +4574,11 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_31userauth_password(PyObject * case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_password)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("userauth_password", 1, 2, 2, 1); __PYX_ERR(0, 260, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_password", 1, 2, 2, 1); __PYX_ERR(0, 266, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_password") < 0)) __PYX_ERR(0, 260, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_password") < 0)) __PYX_ERR(0, 266, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -4480,17 +4591,17 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_31userauth_password(PyObject * } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("userauth_password", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 260, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_password", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 266, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.userauth_password", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(((PyObject *)__pyx_v_username) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 260, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 266, __pyx_L1_error) } if (unlikely(((PyObject *)__pyx_v_password) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "password"); __PYX_ERR(0, 260, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "password"); __PYX_ERR(0, 266, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_30userauth_password(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_username, __pyx_v_password); @@ -4520,31 +4631,31 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_30userauth_password(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_password", 0); - /* "ssh2/session.pyx":268 + /* "ssh2/session.pyx":274 * :type password: str""" * cdef int rc * cdef bytes b_username = to_bytes(username) # <<<<<<<<<<<<<< * cdef bytes b_password = to_bytes(password) * cdef const char *_username = b_username */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":269 + /* "ssh2/session.pyx":275 * cdef int rc * cdef bytes b_username = to_bytes(username) * cdef bytes b_password = to_bytes(password) # <<<<<<<<<<<<<< * cdef const char *_username = b_username * cdef const char *_password = b_password */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_password); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_password); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_password = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":270 + /* "ssh2/session.pyx":276 * cdef bytes b_username = to_bytes(username) * cdef bytes b_password = to_bytes(password) * cdef const char *_username = b_username # <<<<<<<<<<<<<< @@ -4553,12 +4664,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_30userauth_password(struct __p */ if (unlikely(__pyx_v_b_username == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 270, __pyx_L1_error) + __PYX_ERR(0, 276, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 270, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 276, __pyx_L1_error) __pyx_v__username = __pyx_t_2; - /* "ssh2/session.pyx":271 + /* "ssh2/session.pyx":277 * cdef bytes b_password = to_bytes(password) * cdef const char *_username = b_username * cdef const char *_password = b_password # <<<<<<<<<<<<<< @@ -4567,12 +4678,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_30userauth_password(struct __p */ if (unlikely(__pyx_v_b_password == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 271, __pyx_L1_error) + __PYX_ERR(0, 277, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyBytes_AsString(__pyx_v_b_password); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 271, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBytes_AsString(__pyx_v_b_password); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 277, __pyx_L1_error) __pyx_v__password = __pyx_t_3; - /* "ssh2/session.pyx":272 + /* "ssh2/session.pyx":278 * cdef const char *_username = b_username * cdef const char *_password = b_password * with nogil: # <<<<<<<<<<<<<< @@ -4587,7 +4698,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_30userauth_password(struct __p #endif /*try:*/ { - /* "ssh2/session.pyx":273 + /* "ssh2/session.pyx":279 * cdef const char *_password = b_password * with nogil: * rc = c_ssh2.libssh2_userauth_password( # <<<<<<<<<<<<<< @@ -4597,7 +4708,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_30userauth_password(struct __p __pyx_v_rc = libssh2_userauth_password(__pyx_v_self->_session, __pyx_v__username, __pyx_v__password); } - /* "ssh2/session.pyx":272 + /* "ssh2/session.pyx":278 * cdef const char *_username = b_username * cdef const char *_password = b_password * with nogil: # <<<<<<<<<<<<<< @@ -4616,7 +4727,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_30userauth_password(struct __p } } - /* "ssh2/session.pyx":275 + /* "ssh2/session.pyx":281 * rc = c_ssh2.libssh2_userauth_password( * self._session, _username, _password) * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -4624,14 +4735,14 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_30userauth_password(struct __p * def userauth_keyboardinteractive(self, username not None, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 275, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error) + __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 281, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 281, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":260 + /* "ssh2/session.pyx":266 * return handle_error_codes(rc) * * def userauth_password(self, username not None, password not None): # <<<<<<<<<<<<<< @@ -4652,7 +4763,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_30userauth_password(struct __p return __pyx_r; } -/* "ssh2/session.pyx":277 +/* "ssh2/session.pyx":283 * return handle_error_codes(rc) * * def userauth_keyboardinteractive(self, username not None, # <<<<<<<<<<<<<< @@ -4695,11 +4806,11 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_33userauth_keyboardinteractive case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_password)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("userauth_keyboardinteractive", 1, 2, 2, 1); __PYX_ERR(0, 277, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_keyboardinteractive", 1, 2, 2, 1); __PYX_ERR(0, 283, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_keyboardinteractive") < 0)) __PYX_ERR(0, 277, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_keyboardinteractive") < 0)) __PYX_ERR(0, 283, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -4712,17 +4823,17 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_33userauth_keyboardinteractive } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("userauth_keyboardinteractive", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 277, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_keyboardinteractive", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 283, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.userauth_keyboardinteractive", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(((PyObject *)__pyx_v_username) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 277, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 283, __pyx_L1_error) } if (unlikely(((PyObject *)__pyx_v_password) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "password"); __PYX_ERR(0, 278, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "password"); __PYX_ERR(0, 284, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_32userauth_keyboardinteractive(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_username, __pyx_v_password); @@ -4752,31 +4863,31 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_32userauth_keyboardinteractive int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_keyboardinteractive", 0); - /* "ssh2/session.pyx":287 + /* "ssh2/session.pyx":293 * """ * cdef int rc * cdef bytes b_username = to_bytes(username) # <<<<<<<<<<<<<< * cdef bytes b_password = to_bytes(password) * cdef const char *_username = b_username */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":288 + /* "ssh2/session.pyx":294 * cdef int rc * cdef bytes b_username = to_bytes(username) * cdef bytes b_password = to_bytes(password) # <<<<<<<<<<<<<< * cdef const char *_username = b_username * cdef const char *_password = b_password */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_password); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 288, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_password); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 294, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_password = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":289 + /* "ssh2/session.pyx":295 * cdef bytes b_username = to_bytes(username) * cdef bytes b_password = to_bytes(password) * cdef const char *_username = b_username # <<<<<<<<<<<<<< @@ -4785,12 +4896,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_32userauth_keyboardinteractive */ if (unlikely(__pyx_v_b_username == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 289, __pyx_L1_error) + __PYX_ERR(0, 295, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 289, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 295, __pyx_L1_error) __pyx_v__username = __pyx_t_2; - /* "ssh2/session.pyx":290 + /* "ssh2/session.pyx":296 * cdef bytes b_password = to_bytes(password) * cdef const char *_username = b_username * cdef const char *_password = b_password # <<<<<<<<<<<<<< @@ -4799,12 +4910,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_32userauth_keyboardinteractive */ if (unlikely(__pyx_v_b_password == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 290, __pyx_L1_error) + __PYX_ERR(0, 296, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyBytes_AsString(__pyx_v_b_password); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 290, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBytes_AsString(__pyx_v_b_password); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 296, __pyx_L1_error) __pyx_v__password = __pyx_t_3; - /* "ssh2/session.pyx":291 + /* "ssh2/session.pyx":297 * cdef const char *_username = b_username * cdef const char *_password = b_password * with nogil: # <<<<<<<<<<<<<< @@ -4819,7 +4930,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_32userauth_keyboardinteractive #endif /*try:*/ { - /* "ssh2/session.pyx":292 + /* "ssh2/session.pyx":298 * cdef const char *_password = b_password * with nogil: * rc = c_ssh2.libssh2_userauth_keyboard_interactive( # <<<<<<<<<<<<<< @@ -4829,7 +4940,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_32userauth_keyboardinteractive __pyx_v_rc = libssh2_userauth_keyboard_interactive(__pyx_v_self->_session, __pyx_v__username, __pyx_v__password); } - /* "ssh2/session.pyx":291 + /* "ssh2/session.pyx":297 * cdef const char *_username = b_username * cdef const char *_password = b_password * with nogil: # <<<<<<<<<<<<<< @@ -4848,7 +4959,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_32userauth_keyboardinteractive } } - /* "ssh2/session.pyx":294 + /* "ssh2/session.pyx":300 * rc = c_ssh2.libssh2_userauth_keyboard_interactive( * self._session, _username, _password) * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -4856,14 +4967,14 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_32userauth_keyboardinteractive * def agent_init(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 294, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 294, __pyx_L1_error) + __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 300, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":277 + /* "ssh2/session.pyx":283 * return handle_error_codes(rc) * * def userauth_keyboardinteractive(self, username not None, # <<<<<<<<<<<<<< @@ -4884,7 +4995,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_32userauth_keyboardinteractive return __pyx_r; } -/* "ssh2/session.pyx":296 +/* "ssh2/session.pyx":302 * return handle_error_codes(rc) * * def agent_init(self): # <<<<<<<<<<<<<< @@ -4917,7 +5028,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_34agent_init(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("agent_init", 0); - /* "ssh2/session.pyx":302 + /* "ssh2/session.pyx":308 * """ * cdef c_ssh2.LIBSSH2_AGENT *agent * with nogil: # <<<<<<<<<<<<<< @@ -4932,18 +5043,18 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_34agent_init(struct __pyx_obj_ #endif /*try:*/ { - /* "ssh2/session.pyx":303 + /* "ssh2/session.pyx":309 * cdef c_ssh2.LIBSSH2_AGENT *agent * with nogil: * agent = agent_init(self._session) # <<<<<<<<<<<<<< * return PyAgent(agent, self) * */ - __pyx_t_1 = __pyx_f_4ssh2_5agent_agent_init(__pyx_v_self->_session); if (unlikely(__pyx_t_1 == ((LIBSSH2_AGENT *)NULL))) __PYX_ERR(0, 303, __pyx_L4_error) + __pyx_t_1 = __pyx_f_4ssh2_5agent_agent_init(__pyx_v_self->_session); if (unlikely(__pyx_t_1 == ((LIBSSH2_AGENT *)NULL))) __PYX_ERR(0, 309, __pyx_L4_error) __pyx_v_agent = __pyx_t_1; } - /* "ssh2/session.pyx":302 + /* "ssh2/session.pyx":308 * """ * cdef c_ssh2.LIBSSH2_AGENT *agent * with nogil: # <<<<<<<<<<<<<< @@ -4969,7 +5080,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_34agent_init(struct __pyx_obj_ } } - /* "ssh2/session.pyx":304 + /* "ssh2/session.pyx":310 * with nogil: * agent = agent_init(self._session) * return PyAgent(agent, self) # <<<<<<<<<<<<<< @@ -4977,13 +5088,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_34agent_init(struct __pyx_obj_ * def agent_auth(self, username not None): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_f_4ssh2_5agent_PyAgent(__pyx_v_agent, __pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 304, __pyx_L1_error) + __pyx_t_2 = __pyx_f_4ssh2_5agent_PyAgent(__pyx_v_agent, __pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 310, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":296 + /* "ssh2/session.pyx":302 * return handle_error_codes(rc) * * def agent_init(self): # <<<<<<<<<<<<<< @@ -5002,7 +5113,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_34agent_init(struct __pyx_obj_ return __pyx_r; } -/* "ssh2/session.pyx":306 +/* "ssh2/session.pyx":312 * return PyAgent(agent, self) * * def agent_auth(self, username not None): # <<<<<<<<<<<<<< @@ -5021,7 +5132,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_37agent_auth(PyObject *__pyx_v __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("agent_auth (wrapper)", 0); if (unlikely(((PyObject *)__pyx_v_username) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 306, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(0, 312, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_36agent_auth(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), ((PyObject *)__pyx_v_username)); @@ -5051,19 +5162,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("agent_auth", 0); - /* "ssh2/session.pyx":332 + /* "ssh2/session.pyx":338 * * :rtype: None""" * cdef bytes b_username = to_bytes(username) # <<<<<<<<<<<<<< * cdef char *_username = b_username * cdef c_ssh2.LIBSSH2_AGENT *agent = NULL */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 332, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":333 + /* "ssh2/session.pyx":339 * :rtype: None""" * cdef bytes b_username = to_bytes(username) * cdef char *_username = b_username # <<<<<<<<<<<<<< @@ -5072,12 +5183,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ */ if (unlikely(__pyx_v_b_username == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 333, __pyx_L1_error) + __PYX_ERR(0, 339, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 333, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 339, __pyx_L1_error) __pyx_v__username = __pyx_t_2; - /* "ssh2/session.pyx":334 + /* "ssh2/session.pyx":340 * cdef bytes b_username = to_bytes(username) * cdef char *_username = b_username * cdef c_ssh2.LIBSSH2_AGENT *agent = NULL # <<<<<<<<<<<<<< @@ -5086,7 +5197,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ */ __pyx_v_agent = NULL; - /* "ssh2/session.pyx":335 + /* "ssh2/session.pyx":341 * cdef char *_username = b_username * cdef c_ssh2.LIBSSH2_AGENT *agent = NULL * cdef c_ssh2.libssh2_agent_publickey *identity = NULL # <<<<<<<<<<<<<< @@ -5095,7 +5206,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ */ __pyx_v_identity = NULL; - /* "ssh2/session.pyx":336 + /* "ssh2/session.pyx":342 * cdef c_ssh2.LIBSSH2_AGENT *agent = NULL * cdef c_ssh2.libssh2_agent_publickey *identity = NULL * cdef c_ssh2.libssh2_agent_publickey *prev = NULL # <<<<<<<<<<<<<< @@ -5104,17 +5215,17 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ */ __pyx_v_prev = NULL; - /* "ssh2/session.pyx":337 + /* "ssh2/session.pyx":343 * cdef c_ssh2.libssh2_agent_publickey *identity = NULL * cdef c_ssh2.libssh2_agent_publickey *prev = NULL * agent = init_connect_agent(self._session) # <<<<<<<<<<<<<< * with nogil: * agent_auth(_username, agent) */ - __pyx_t_3 = __pyx_f_4ssh2_5agent_init_connect_agent(__pyx_v_self->_session); if (unlikely(__pyx_t_3 == ((LIBSSH2_AGENT *)NULL))) __PYX_ERR(0, 337, __pyx_L1_error) + __pyx_t_3 = __pyx_f_4ssh2_5agent_init_connect_agent(__pyx_v_self->_session); if (unlikely(__pyx_t_3 == ((LIBSSH2_AGENT *)NULL))) __PYX_ERR(0, 343, __pyx_L1_error) __pyx_v_agent = __pyx_t_3; - /* "ssh2/session.pyx":338 + /* "ssh2/session.pyx":344 * cdef c_ssh2.libssh2_agent_publickey *prev = NULL * agent = init_connect_agent(self._session) * with nogil: # <<<<<<<<<<<<<< @@ -5129,17 +5240,17 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ #endif /*try:*/ { - /* "ssh2/session.pyx":339 + /* "ssh2/session.pyx":345 * agent = init_connect_agent(self._session) * with nogil: * agent_auth(_username, agent) # <<<<<<<<<<<<<< * * def open_session(self): */ - __pyx_t_4 = __pyx_f_4ssh2_5agent_agent_auth(__pyx_v__username, __pyx_v_agent); if (unlikely(__pyx_t_4 == ((int)1))) __PYX_ERR(0, 339, __pyx_L4_error) + __pyx_t_4 = __pyx_f_4ssh2_5agent_agent_auth(__pyx_v__username, __pyx_v_agent); if (unlikely(__pyx_t_4 == ((int)1))) __PYX_ERR(0, 345, __pyx_L4_error) } - /* "ssh2/session.pyx":338 + /* "ssh2/session.pyx":344 * cdef c_ssh2.libssh2_agent_publickey *prev = NULL * agent = init_connect_agent(self._session) * with nogil: # <<<<<<<<<<<<<< @@ -5165,7 +5276,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ } } - /* "ssh2/session.pyx":306 + /* "ssh2/session.pyx":312 * return PyAgent(agent, self) * * def agent_auth(self, username not None): # <<<<<<<<<<<<<< @@ -5187,7 +5298,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ return __pyx_r; } -/* "ssh2/session.pyx":341 +/* "ssh2/session.pyx":347 * agent_auth(_username, agent) * * def open_session(self): # <<<<<<<<<<<<<< @@ -5221,7 +5332,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob int __pyx_clineno = 0; __Pyx_RefNannySetupContext("open_session", 0); - /* "ssh2/session.pyx":347 + /* "ssh2/session.pyx":353 * """ * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -5236,7 +5347,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob #endif /*try:*/ { - /* "ssh2/session.pyx":348 + /* "ssh2/session.pyx":354 * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: * channel = c_ssh2.libssh2_channel_open_session( # <<<<<<<<<<<<<< @@ -5246,7 +5357,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob __pyx_v_channel = libssh2_channel_open_session(__pyx_v_self->_session); } - /* "ssh2/session.pyx":347 + /* "ssh2/session.pyx":353 * """ * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -5265,7 +5376,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob } } - /* "ssh2/session.pyx":350 + /* "ssh2/session.pyx":356 * channel = c_ssh2.libssh2_channel_open_session( * self._session) * if channel is NULL: # <<<<<<<<<<<<<< @@ -5275,7 +5386,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob __pyx_t_1 = ((__pyx_v_channel == NULL) != 0); if (__pyx_t_1) { - /* "ssh2/session.pyx":351 + /* "ssh2/session.pyx":357 * self._session) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -5284,29 +5395,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":352 + /* "ssh2/session.pyx":358 * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) # <<<<<<<<<<<<<< * return PyChannel(channel, self) * */ - __pyx_t_2 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 351, __pyx_L1_error) + __pyx_t_2 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 357, __pyx_L1_error) - /* "ssh2/session.pyx":351 + /* "ssh2/session.pyx":357 * self._session) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< * self._session)) * return PyChannel(channel, self) */ - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 351, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 357, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":350 + /* "ssh2/session.pyx":356 * channel = c_ssh2.libssh2_channel_open_session( * self._session) * if channel is NULL: # <<<<<<<<<<<<<< @@ -5315,7 +5426,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob */ } - /* "ssh2/session.pyx":353 + /* "ssh2/session.pyx":359 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self) # <<<<<<<<<<<<<< @@ -5323,13 +5434,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob * def direct_tcpip_ex(self, host not None, int port, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 353, __pyx_L1_error) + __pyx_t_3 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 359, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":341 + /* "ssh2/session.pyx":347 * agent_auth(_username, agent) * * def open_session(self): # <<<<<<<<<<<<<< @@ -5348,7 +5459,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob return __pyx_r; } -/* "ssh2/session.pyx":355 +/* "ssh2/session.pyx":361 * return PyChannel(channel, self) * * def direct_tcpip_ex(self, host not None, int port, # <<<<<<<<<<<<<< @@ -5397,23 +5508,23 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_41direct_tcpip_ex(PyObject *__ case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_port)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, 1); __PYX_ERR(0, 355, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, 1); __PYX_ERR(0, 361, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shost)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, 2); __PYX_ERR(0, 355, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, 2); __PYX_ERR(0, 361, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sport)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, 3); __PYX_ERR(0, 355, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, 3); __PYX_ERR(0, 361, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "direct_tcpip_ex") < 0)) __PYX_ERR(0, 355, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "direct_tcpip_ex") < 0)) __PYX_ERR(0, 361, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -5424,23 +5535,23 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_41direct_tcpip_ex(PyObject *__ values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_host = values[0]; - __pyx_v_port = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 355, __pyx_L3_error) + __pyx_v_port = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 361, __pyx_L3_error) __pyx_v_shost = values[2]; - __pyx_v_sport = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_sport == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 356, __pyx_L3_error) + __pyx_v_sport = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_sport == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 362, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 355, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 361, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.direct_tcpip_ex", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(((PyObject *)__pyx_v_host) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "host"); __PYX_ERR(0, 355, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "host"); __PYX_ERR(0, 361, __pyx_L1_error) } if (unlikely(((PyObject *)__pyx_v_shost) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "shost"); __PYX_ERR(0, 356, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "shost"); __PYX_ERR(0, 362, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_host, __pyx_v_port, __pyx_v_shost, __pyx_v_sport); @@ -5470,31 +5581,31 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("direct_tcpip_ex", 0); - /* "ssh2/session.pyx":358 + /* "ssh2/session.pyx":364 * shost not None, int sport): * cdef c_ssh2.LIBSSH2_CHANNEL *channel * cdef bytes b_host = to_bytes(host) # <<<<<<<<<<<<<< * cdef bytes b_shost = to_bytes(shost) * cdef char *_host = b_host */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_host); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 358, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_host); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_host = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":359 + /* "ssh2/session.pyx":365 * cdef c_ssh2.LIBSSH2_CHANNEL *channel * cdef bytes b_host = to_bytes(host) * cdef bytes b_shost = to_bytes(shost) # <<<<<<<<<<<<<< * cdef char *_host = b_host * cdef char *_shost = b_shost */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_shost); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 359, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_shost); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 365, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_shost = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":360 + /* "ssh2/session.pyx":366 * cdef bytes b_host = to_bytes(host) * cdef bytes b_shost = to_bytes(shost) * cdef char *_host = b_host # <<<<<<<<<<<<<< @@ -5503,12 +5614,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx */ if (unlikely(__pyx_v_b_host == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 360, __pyx_L1_error) + __PYX_ERR(0, 366, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_host); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 360, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_host); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 366, __pyx_L1_error) __pyx_v__host = __pyx_t_2; - /* "ssh2/session.pyx":361 + /* "ssh2/session.pyx":367 * cdef bytes b_shost = to_bytes(shost) * cdef char *_host = b_host * cdef char *_shost = b_shost # <<<<<<<<<<<<<< @@ -5517,12 +5628,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx */ if (unlikely(__pyx_v_b_shost == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 361, __pyx_L1_error) + __PYX_ERR(0, 367, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_shost); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 361, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_shost); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 367, __pyx_L1_error) __pyx_v__shost = __pyx_t_2; - /* "ssh2/session.pyx":362 + /* "ssh2/session.pyx":368 * cdef char *_host = b_host * cdef char *_shost = b_shost * with nogil: # <<<<<<<<<<<<<< @@ -5537,7 +5648,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx #endif /*try:*/ { - /* "ssh2/session.pyx":363 + /* "ssh2/session.pyx":369 * cdef char *_shost = b_shost * with nogil: * channel = c_ssh2.libssh2_channel_direct_tcpip_ex( # <<<<<<<<<<<<<< @@ -5547,7 +5658,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx __pyx_v_channel = libssh2_channel_direct_tcpip_ex(__pyx_v_self->_session, __pyx_v__host, __pyx_v_port, __pyx_v__shost, __pyx_v_sport); } - /* "ssh2/session.pyx":362 + /* "ssh2/session.pyx":368 * cdef char *_host = b_host * cdef char *_shost = b_shost * with nogil: # <<<<<<<<<<<<<< @@ -5566,7 +5677,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx } } - /* "ssh2/session.pyx":365 + /* "ssh2/session.pyx":371 * channel = c_ssh2.libssh2_channel_direct_tcpip_ex( * self._session, _host, port, _shost, sport) * if channel is NULL: # <<<<<<<<<<<<<< @@ -5576,7 +5687,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx __pyx_t_3 = ((__pyx_v_channel == NULL) != 0); if (__pyx_t_3) { - /* "ssh2/session.pyx":366 + /* "ssh2/session.pyx":372 * self._session, _host, port, _shost, sport) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -5585,29 +5696,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":367 + /* "ssh2/session.pyx":373 * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) # <<<<<<<<<<<<<< * return PyChannel(channel, self) * */ - __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 366, __pyx_L1_error) + __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 372, __pyx_L1_error) - /* "ssh2/session.pyx":366 + /* "ssh2/session.pyx":372 * self._session, _host, port, _shost, sport) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< * self._session)) * return PyChannel(channel, self) */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":365 + /* "ssh2/session.pyx":371 * channel = c_ssh2.libssh2_channel_direct_tcpip_ex( * self._session, _host, port, _shost, sport) * if channel is NULL: # <<<<<<<<<<<<<< @@ -5616,7 +5727,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx */ } - /* "ssh2/session.pyx":368 + /* "ssh2/session.pyx":374 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self) # <<<<<<<<<<<<<< @@ -5624,13 +5735,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx * def direct_tcpip(self, host not None, int port): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 374, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":355 + /* "ssh2/session.pyx":361 * return PyChannel(channel, self) * * def direct_tcpip_ex(self, host not None, int port, # <<<<<<<<<<<<<< @@ -5651,7 +5762,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx return __pyx_r; } -/* "ssh2/session.pyx":370 +/* "ssh2/session.pyx":376 * return PyChannel(channel, self) * * def direct_tcpip(self, host not None, int port): # <<<<<<<<<<<<<< @@ -5694,11 +5805,11 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_43direct_tcpip(PyObject *__pyx case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_port)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("direct_tcpip", 1, 2, 2, 1); __PYX_ERR(0, 370, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("direct_tcpip", 1, 2, 2, 1); __PYX_ERR(0, 376, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "direct_tcpip") < 0)) __PYX_ERR(0, 370, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "direct_tcpip") < 0)) __PYX_ERR(0, 376, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -5707,18 +5818,18 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_43direct_tcpip(PyObject *__pyx values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_host = values[0]; - __pyx_v_port = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 370, __pyx_L3_error) + __pyx_v_port = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 376, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("direct_tcpip", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 370, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("direct_tcpip", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 376, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.direct_tcpip", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(((PyObject *)__pyx_v_host) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "host"); __PYX_ERR(0, 370, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "host"); __PYX_ERR(0, 376, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_42direct_tcpip(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_host, __pyx_v_port); @@ -5746,19 +5857,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob int __pyx_clineno = 0; __Pyx_RefNannySetupContext("direct_tcpip", 0); - /* "ssh2/session.pyx":377 + /* "ssh2/session.pyx":383 * """ * cdef c_ssh2.LIBSSH2_CHANNEL *channel * cdef bytes b_host = to_bytes(host) # <<<<<<<<<<<<<< * cdef char *_host = b_host * with nogil: */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_host); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 377, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_host); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_host = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":378 + /* "ssh2/session.pyx":384 * cdef c_ssh2.LIBSSH2_CHANNEL *channel * cdef bytes b_host = to_bytes(host) * cdef char *_host = b_host # <<<<<<<<<<<<<< @@ -5767,12 +5878,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob */ if (unlikely(__pyx_v_b_host == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 378, __pyx_L1_error) + __PYX_ERR(0, 384, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_host); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 378, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_host); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 384, __pyx_L1_error) __pyx_v__host = __pyx_t_2; - /* "ssh2/session.pyx":379 + /* "ssh2/session.pyx":385 * cdef bytes b_host = to_bytes(host) * cdef char *_host = b_host * with nogil: # <<<<<<<<<<<<<< @@ -5787,7 +5898,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob #endif /*try:*/ { - /* "ssh2/session.pyx":380 + /* "ssh2/session.pyx":386 * cdef char *_host = b_host * with nogil: * channel = c_ssh2.libssh2_channel_direct_tcpip( # <<<<<<<<<<<<<< @@ -5797,7 +5908,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob __pyx_v_channel = libssh2_channel_direct_tcpip(__pyx_v_self->_session, __pyx_v__host, __pyx_v_port); } - /* "ssh2/session.pyx":379 + /* "ssh2/session.pyx":385 * cdef bytes b_host = to_bytes(host) * cdef char *_host = b_host * with nogil: # <<<<<<<<<<<<<< @@ -5816,7 +5927,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob } } - /* "ssh2/session.pyx":382 + /* "ssh2/session.pyx":388 * channel = c_ssh2.libssh2_channel_direct_tcpip( * self._session, _host, port) * if channel is NULL: # <<<<<<<<<<<<<< @@ -5826,7 +5937,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob __pyx_t_3 = ((__pyx_v_channel == NULL) != 0); if (__pyx_t_3) { - /* "ssh2/session.pyx":383 + /* "ssh2/session.pyx":389 * self._session, _host, port) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -5835,29 +5946,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":384 + /* "ssh2/session.pyx":390 * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) # <<<<<<<<<<<<<< * return PyChannel(channel, self) * */ - __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 383, __pyx_L1_error) + __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 389, __pyx_L1_error) - /* "ssh2/session.pyx":383 + /* "ssh2/session.pyx":389 * self._session, _host, port) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< * self._session)) * return PyChannel(channel, self) */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 389, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":382 + /* "ssh2/session.pyx":388 * channel = c_ssh2.libssh2_channel_direct_tcpip( * self._session, _host, port) * if channel is NULL: # <<<<<<<<<<<<<< @@ -5866,7 +5977,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob */ } - /* "ssh2/session.pyx":385 + /* "ssh2/session.pyx":391 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self) # <<<<<<<<<<<<<< @@ -5874,13 +5985,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob * def block_directions(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 385, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 391, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":370 + /* "ssh2/session.pyx":376 * return PyChannel(channel, self) * * def direct_tcpip(self, host not None, int port): # <<<<<<<<<<<<<< @@ -5900,7 +6011,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob return __pyx_r; } -/* "ssh2/session.pyx":387 +/* "ssh2/session.pyx":393 * return PyChannel(channel, self) * * def block_directions(self): # <<<<<<<<<<<<<< @@ -5932,7 +6043,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_44block_directions(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("block_directions", 0); - /* "ssh2/session.pyx":409 + /* "ssh2/session.pyx":415 * :rtype: int""" * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -5947,7 +6058,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_44block_directions(struct __py #endif /*try:*/ { - /* "ssh2/session.pyx":410 + /* "ssh2/session.pyx":416 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_session_block_directions( # <<<<<<<<<<<<<< @@ -5957,7 +6068,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_44block_directions(struct __py __pyx_v_rc = libssh2_session_block_directions(__pyx_v_self->_session); } - /* "ssh2/session.pyx":409 + /* "ssh2/session.pyx":415 * :rtype: int""" * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -5976,7 +6087,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_44block_directions(struct __py } } - /* "ssh2/session.pyx":412 + /* "ssh2/session.pyx":418 * rc = c_ssh2.libssh2_session_block_directions( * self._session) * return rc # <<<<<<<<<<<<<< @@ -5984,13 +6095,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_44block_directions(struct __py * def forward_listen(self, int port): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 412, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 418, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":387 + /* "ssh2/session.pyx":393 * return PyChannel(channel, self) * * def block_directions(self): # <<<<<<<<<<<<<< @@ -6009,7 +6120,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_44block_directions(struct __py return __pyx_r; } -/* "ssh2/session.pyx":414 +/* "ssh2/session.pyx":420 * return rc * * def forward_listen(self, int port): # <<<<<<<<<<<<<< @@ -6029,7 +6140,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_47forward_listen(PyObject *__p __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("forward_listen (wrapper)", 0); assert(__pyx_arg_port); { - __pyx_v_port = __Pyx_PyInt_As_int(__pyx_arg_port); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 414, __pyx_L3_error) + __pyx_v_port = __Pyx_PyInt_As_int(__pyx_arg_port); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 420, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -6056,7 +6167,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("forward_listen", 0); - /* "ssh2/session.pyx":422 + /* "ssh2/session.pyx":428 * :rtype: :py:class:`ssh2.listener.Listener` or None""" * cdef c_ssh2.LIBSSH2_LISTENER *listener * with nogil: # <<<<<<<<<<<<<< @@ -6071,7 +6182,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ #endif /*try:*/ { - /* "ssh2/session.pyx":423 + /* "ssh2/session.pyx":429 * cdef c_ssh2.LIBSSH2_LISTENER *listener * with nogil: * listener = c_ssh2.libssh2_channel_forward_listen( # <<<<<<<<<<<<<< @@ -6081,7 +6192,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ __pyx_v_listener = libssh2_channel_forward_listen(__pyx_v_self->_session, __pyx_v_port); } - /* "ssh2/session.pyx":422 + /* "ssh2/session.pyx":428 * :rtype: :py:class:`ssh2.listener.Listener` or None""" * cdef c_ssh2.LIBSSH2_LISTENER *listener * with nogil: # <<<<<<<<<<<<<< @@ -6100,7 +6211,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ } } - /* "ssh2/session.pyx":425 + /* "ssh2/session.pyx":431 * listener = c_ssh2.libssh2_channel_forward_listen( * self._session, port) * if listener is NULL: # <<<<<<<<<<<<<< @@ -6110,7 +6221,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ __pyx_t_1 = ((__pyx_v_listener == NULL) != 0); if (__pyx_t_1) { - /* "ssh2/session.pyx":426 + /* "ssh2/session.pyx":432 * self._session, port) * if listener is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -6119,29 +6230,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":427 + /* "ssh2/session.pyx":433 * if listener is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) # <<<<<<<<<<<<<< * return PyListener(listener, self) * */ - __pyx_t_2 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 426, __pyx_L1_error) + __pyx_t_2 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 432, __pyx_L1_error) - /* "ssh2/session.pyx":426 + /* "ssh2/session.pyx":432 * self._session, port) * if listener is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< * self._session)) * return PyListener(listener, self) */ - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 426, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 432, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":425 + /* "ssh2/session.pyx":431 * listener = c_ssh2.libssh2_channel_forward_listen( * self._session, port) * if listener is NULL: # <<<<<<<<<<<<<< @@ -6150,7 +6261,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ */ } - /* "ssh2/session.pyx":428 + /* "ssh2/session.pyx":434 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyListener(listener, self) # <<<<<<<<<<<<<< @@ -6158,13 +6269,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ * def forward_listen_ex(self, host not None, int port, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_f_4ssh2_8listener_PyListener(__pyx_v_listener, __pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_3 = __pyx_f_4ssh2_8listener_PyListener(__pyx_v_listener, __pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 434, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":414 + /* "ssh2/session.pyx":420 * return rc * * def forward_listen(self, int port): # <<<<<<<<<<<<<< @@ -6183,7 +6294,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ return __pyx_r; } -/* "ssh2/session.pyx":430 +/* "ssh2/session.pyx":436 * return PyListener(listener, self) * * def forward_listen_ex(self, host not None, int port, # <<<<<<<<<<<<<< @@ -6232,23 +6343,23 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_49forward_listen_ex(PyObject * case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_port)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("forward_listen_ex", 1, 4, 4, 1); __PYX_ERR(0, 430, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("forward_listen_ex", 1, 4, 4, 1); __PYX_ERR(0, 436, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bound_port)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("forward_listen_ex", 1, 4, 4, 2); __PYX_ERR(0, 430, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("forward_listen_ex", 1, 4, 4, 2); __PYX_ERR(0, 436, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_queue_maxsize)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("forward_listen_ex", 1, 4, 4, 3); __PYX_ERR(0, 430, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("forward_listen_ex", 1, 4, 4, 3); __PYX_ERR(0, 436, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "forward_listen_ex") < 0)) __PYX_ERR(0, 430, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "forward_listen_ex") < 0)) __PYX_ERR(0, 436, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -6259,20 +6370,20 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_49forward_listen_ex(PyObject * values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_host = values[0]; - __pyx_v_port = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 430, __pyx_L3_error) - __pyx_v_bound_port = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_bound_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 431, __pyx_L3_error) - __pyx_v_queue_maxsize = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_queue_maxsize == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 431, __pyx_L3_error) + __pyx_v_port = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 436, __pyx_L3_error) + __pyx_v_bound_port = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_bound_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 437, __pyx_L3_error) + __pyx_v_queue_maxsize = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_queue_maxsize == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 437, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("forward_listen_ex", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 430, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("forward_listen_ex", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 436, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.forward_listen_ex", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(((PyObject *)__pyx_v_host) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "host"); __PYX_ERR(0, 430, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "host"); __PYX_ERR(0, 436, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_host, __pyx_v_port, __pyx_v_bound_port, __pyx_v_queue_maxsize); @@ -6300,19 +6411,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("forward_listen_ex", 0); - /* "ssh2/session.pyx":433 + /* "ssh2/session.pyx":439 * int bound_port, int queue_maxsize): * cdef c_ssh2.LIBSSH2_LISTENER *listener * cdef bytes b_host = to_bytes(host) # <<<<<<<<<<<<<< * cdef char *_host = b_host * with nogil: */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_host); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 433, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_host); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_host = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":434 + /* "ssh2/session.pyx":440 * cdef c_ssh2.LIBSSH2_LISTENER *listener * cdef bytes b_host = to_bytes(host) * cdef char *_host = b_host # <<<<<<<<<<<<<< @@ -6321,12 +6432,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p */ if (unlikely(__pyx_v_b_host == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 434, __pyx_L1_error) + __PYX_ERR(0, 440, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_host); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 434, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_host); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 440, __pyx_L1_error) __pyx_v__host = __pyx_t_2; - /* "ssh2/session.pyx":435 + /* "ssh2/session.pyx":441 * cdef bytes b_host = to_bytes(host) * cdef char *_host = b_host * with nogil: # <<<<<<<<<<<<<< @@ -6341,7 +6452,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p #endif /*try:*/ { - /* "ssh2/session.pyx":436 + /* "ssh2/session.pyx":442 * cdef char *_host = b_host * with nogil: * listener = c_ssh2.libssh2_channel_forward_listen_ex( # <<<<<<<<<<<<<< @@ -6351,7 +6462,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p __pyx_v_listener = libssh2_channel_forward_listen_ex(__pyx_v_self->_session, __pyx_v__host, __pyx_v_port, (&__pyx_v_bound_port), __pyx_v_queue_maxsize); } - /* "ssh2/session.pyx":435 + /* "ssh2/session.pyx":441 * cdef bytes b_host = to_bytes(host) * cdef char *_host = b_host * with nogil: # <<<<<<<<<<<<<< @@ -6370,7 +6481,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p } } - /* "ssh2/session.pyx":438 + /* "ssh2/session.pyx":444 * listener = c_ssh2.libssh2_channel_forward_listen_ex( * self._session, _host, port, &bound_port, queue_maxsize) * if listener is NULL: # <<<<<<<<<<<<<< @@ -6380,7 +6491,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p __pyx_t_3 = ((__pyx_v_listener == NULL) != 0); if (__pyx_t_3) { - /* "ssh2/session.pyx":439 + /* "ssh2/session.pyx":445 * self._session, _host, port, &bound_port, queue_maxsize) * if listener is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -6389,29 +6500,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":440 + /* "ssh2/session.pyx":446 * if listener is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) # <<<<<<<<<<<<<< * return PyListener(listener, self) * */ - __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 439, __pyx_L1_error) + __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 445, __pyx_L1_error) - /* "ssh2/session.pyx":439 + /* "ssh2/session.pyx":445 * self._session, _host, port, &bound_port, queue_maxsize) * if listener is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< * self._session)) * return PyListener(listener, self) */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 445, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":438 + /* "ssh2/session.pyx":444 * listener = c_ssh2.libssh2_channel_forward_listen_ex( * self._session, _host, port, &bound_port, queue_maxsize) * if listener is NULL: # <<<<<<<<<<<<<< @@ -6420,7 +6531,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p */ } - /* "ssh2/session.pyx":441 + /* "ssh2/session.pyx":447 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyListener(listener, self) # <<<<<<<<<<<<<< @@ -6428,13 +6539,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p * def sftp_init(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4ssh2_8listener_PyListener(__pyx_v_listener, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_8listener_PyListener(__pyx_v_listener, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":430 + /* "ssh2/session.pyx":436 * return PyListener(listener, self) * * def forward_listen_ex(self, host not None, int port, # <<<<<<<<<<<<<< @@ -6454,7 +6565,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p return __pyx_r; } -/* "ssh2/session.pyx":443 +/* "ssh2/session.pyx":449 * return PyListener(listener, self) * * def sftp_init(self): # <<<<<<<<<<<<<< @@ -6488,7 +6599,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("sftp_init", 0); - /* "ssh2/session.pyx":449 + /* "ssh2/session.pyx":455 * """ * cdef c_sftp.LIBSSH2_SFTP *_sftp * with nogil: # <<<<<<<<<<<<<< @@ -6503,7 +6614,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 #endif /*try:*/ { - /* "ssh2/session.pyx":450 + /* "ssh2/session.pyx":456 * cdef c_sftp.LIBSSH2_SFTP *_sftp * with nogil: * _sftp = c_sftp.libssh2_sftp_init(self._session) # <<<<<<<<<<<<<< @@ -6513,7 +6624,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 __pyx_v__sftp = libssh2_sftp_init(__pyx_v_self->_session); } - /* "ssh2/session.pyx":449 + /* "ssh2/session.pyx":455 * """ * cdef c_sftp.LIBSSH2_SFTP *_sftp * with nogil: # <<<<<<<<<<<<<< @@ -6532,7 +6643,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 } } - /* "ssh2/session.pyx":451 + /* "ssh2/session.pyx":457 * with nogil: * _sftp = c_sftp.libssh2_sftp_init(self._session) * if _sftp is NULL: # <<<<<<<<<<<<<< @@ -6542,7 +6653,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 __pyx_t_1 = ((__pyx_v__sftp == NULL) != 0); if (__pyx_t_1) { - /* "ssh2/session.pyx":452 + /* "ssh2/session.pyx":458 * _sftp = c_sftp.libssh2_sftp_init(self._session) * if _sftp is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -6551,29 +6662,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":453 + /* "ssh2/session.pyx":459 * if _sftp is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) # <<<<<<<<<<<<<< * return PySFTP(_sftp, self) * */ - __pyx_t_2 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 452, __pyx_L1_error) + __pyx_t_2 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 458, __pyx_L1_error) - /* "ssh2/session.pyx":452 + /* "ssh2/session.pyx":458 * _sftp = c_sftp.libssh2_sftp_init(self._session) * if _sftp is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< * self._session)) * return PySFTP(_sftp, self) */ - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 452, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 458, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":451 + /* "ssh2/session.pyx":457 * with nogil: * _sftp = c_sftp.libssh2_sftp_init(self._session) * if _sftp is NULL: # <<<<<<<<<<<<<< @@ -6582,7 +6693,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 */ } - /* "ssh2/session.pyx":454 + /* "ssh2/session.pyx":460 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PySFTP(_sftp, self) # <<<<<<<<<<<<<< @@ -6590,13 +6701,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 * def last_error(self, size_t msg_size=1024): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_f_4ssh2_4sftp_PySFTP(__pyx_v__sftp, __pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 454, __pyx_L1_error) + __pyx_t_3 = __pyx_f_4ssh2_4sftp_PySFTP(__pyx_v__sftp, __pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 460, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":443 + /* "ssh2/session.pyx":449 * return PyListener(listener, self) * * def sftp_init(self): # <<<<<<<<<<<<<< @@ -6615,7 +6726,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 return __pyx_r; } -/* "ssh2/session.pyx":456 +/* "ssh2/session.pyx":462 * return PySFTP(_sftp, self) * * def last_error(self, size_t msg_size=1024): # <<<<<<<<<<<<<< @@ -6655,7 +6766,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_53last_error(PyObject *__pyx_v } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "last_error") < 0)) __PYX_ERR(0, 456, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "last_error") < 0)) __PYX_ERR(0, 462, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -6666,14 +6777,14 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_53last_error(PyObject *__pyx_v } } if (values[0]) { - __pyx_v_msg_size = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_msg_size == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 456, __pyx_L3_error) + __pyx_v_msg_size = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_msg_size == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 462, __pyx_L3_error) } else { __pyx_v_msg_size = ((size_t)0x400); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("last_error", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 456, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("last_error", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 462, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.last_error", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -6708,7 +6819,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("last_error", 0); - /* "ssh2/session.pyx":463 + /* "ssh2/session.pyx":469 * """ * cdef char *_error_msg * cdef bytes msg = b'' # <<<<<<<<<<<<<< @@ -6718,7 +6829,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ __Pyx_INCREF(__pyx_kp_b__2); __pyx_v_msg = __pyx_kp_b__2; - /* "ssh2/session.pyx":464 + /* "ssh2/session.pyx":470 * cdef char *_error_msg * cdef bytes msg = b'' * cdef int errmsg_len = 0 # <<<<<<<<<<<<<< @@ -6727,7 +6838,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ */ __pyx_v_errmsg_len = 0; - /* "ssh2/session.pyx":465 + /* "ssh2/session.pyx":471 * cdef bytes msg = b'' * cdef int errmsg_len = 0 * with nogil: # <<<<<<<<<<<<<< @@ -6742,7 +6853,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ #endif /*try:*/ { - /* "ssh2/session.pyx":466 + /* "ssh2/session.pyx":472 * cdef int errmsg_len = 0 * with nogil: * _error_msg = malloc(sizeof(char) * msg_size) # <<<<<<<<<<<<<< @@ -6751,7 +6862,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ */ __pyx_v__error_msg = ((char *)malloc(((sizeof(char)) * __pyx_v_msg_size))); - /* "ssh2/session.pyx":467 + /* "ssh2/session.pyx":473 * with nogil: * _error_msg = malloc(sizeof(char) * msg_size) * c_ssh2.libssh2_session_last_error( # <<<<<<<<<<<<<< @@ -6761,7 +6872,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ (void)(libssh2_session_last_error(__pyx_v_self->_session, (&__pyx_v__error_msg), (&__pyx_v_errmsg_len), 1)); } - /* "ssh2/session.pyx":465 + /* "ssh2/session.pyx":471 * cdef bytes msg = b'' * cdef int errmsg_len = 0 * with nogil: # <<<<<<<<<<<<<< @@ -6780,7 +6891,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ } } - /* "ssh2/session.pyx":469 + /* "ssh2/session.pyx":475 * c_ssh2.libssh2_session_last_error( * self._session, &_error_msg, &errmsg_len, 1) * try: # <<<<<<<<<<<<<< @@ -6789,7 +6900,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ */ /*try:*/ { - /* "ssh2/session.pyx":470 + /* "ssh2/session.pyx":476 * self._session, &_error_msg, &errmsg_len, 1) * try: * if errmsg_len > 0: # <<<<<<<<<<<<<< @@ -6799,19 +6910,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ __pyx_t_1 = ((__pyx_v_errmsg_len > 0) != 0); if (__pyx_t_1) { - /* "ssh2/session.pyx":471 + /* "ssh2/session.pyx":477 * try: * if errmsg_len > 0: * msg = _error_msg[:errmsg_len] # <<<<<<<<<<<<<< * return msg * finally: */ - __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(__pyx_v__error_msg + 0, __pyx_v_errmsg_len - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 471, __pyx_L7_error) + __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(__pyx_v__error_msg + 0, __pyx_v_errmsg_len - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF_SET(__pyx_v_msg, ((PyObject*)__pyx_t_2)); __pyx_t_2 = 0; - /* "ssh2/session.pyx":470 + /* "ssh2/session.pyx":476 * self._session, &_error_msg, &errmsg_len, 1) * try: * if errmsg_len > 0: # <<<<<<<<<<<<<< @@ -6820,7 +6931,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ */ } - /* "ssh2/session.pyx":472 + /* "ssh2/session.pyx":478 * if errmsg_len > 0: * msg = _error_msg[:errmsg_len] * return msg # <<<<<<<<<<<<<< @@ -6833,7 +6944,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ goto __pyx_L6_return; } - /* "ssh2/session.pyx":474 + /* "ssh2/session.pyx":480 * return msg * finally: * free(_error_msg) # <<<<<<<<<<<<<< @@ -6883,7 +6994,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ } } - /* "ssh2/session.pyx":456 + /* "ssh2/session.pyx":462 * return PySFTP(_sftp, self) * * def last_error(self, size_t msg_size=1024): # <<<<<<<<<<<<<< @@ -6903,7 +7014,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ return __pyx_r; } -/* "ssh2/session.pyx":476 +/* "ssh2/session.pyx":482 * free(_error_msg) * * def last_errno(self): # <<<<<<<<<<<<<< @@ -6935,7 +7046,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_54last_errno(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("last_errno", 0); - /* "ssh2/session.pyx":483 + /* "ssh2/session.pyx":489 * """ * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -6950,7 +7061,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_54last_errno(struct __pyx_obj_ #endif /*try:*/ { - /* "ssh2/session.pyx":484 + /* "ssh2/session.pyx":490 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -6960,7 +7071,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_54last_errno(struct __pyx_obj_ __pyx_v_rc = libssh2_session_last_errno(__pyx_v_self->_session); } - /* "ssh2/session.pyx":483 + /* "ssh2/session.pyx":489 * """ * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -6979,7 +7090,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_54last_errno(struct __pyx_obj_ } } - /* "ssh2/session.pyx":486 + /* "ssh2/session.pyx":492 * rc = c_ssh2.libssh2_session_last_errno( * self._session) * return rc # <<<<<<<<<<<<<< @@ -6987,13 +7098,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_54last_errno(struct __pyx_obj_ * IF EMBEDDED_LIB: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":476 + /* "ssh2/session.pyx":482 * free(_error_msg) * * def last_errno(self): # <<<<<<<<<<<<<< @@ -7012,7 +7123,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_54last_errno(struct __pyx_obj_ return __pyx_r; } -/* "ssh2/session.pyx":489 +/* "ssh2/session.pyx":495 * * IF EMBEDDED_LIB: * def set_last_error(self, int errcode, errmsg not None): # <<<<<<<<<<<<<< @@ -7055,11 +7166,11 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_57set_last_error(PyObject *__p case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_errmsg)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("set_last_error", 1, 2, 2, 1); __PYX_ERR(0, 489, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("set_last_error", 1, 2, 2, 1); __PYX_ERR(0, 495, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_last_error") < 0)) __PYX_ERR(0, 489, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_last_error") < 0)) __PYX_ERR(0, 495, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -7067,19 +7178,19 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_57set_last_error(PyObject *__p values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_errcode = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_errcode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 489, __pyx_L3_error) + __pyx_v_errcode = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_errcode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 495, __pyx_L3_error) __pyx_v_errmsg = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_last_error", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 489, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("set_last_error", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 495, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.set_last_error", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(((PyObject *)__pyx_v_errmsg) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "errmsg"); __PYX_ERR(0, 489, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "errmsg"); __PYX_ERR(0, 495, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_56set_last_error(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_errcode, __pyx_v_errmsg); @@ -7105,19 +7216,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_56set_last_error(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set_last_error", 0); - /* "ssh2/session.pyx":490 + /* "ssh2/session.pyx":496 * IF EMBEDDED_LIB: * def set_last_error(self, int errcode, errmsg not None): * cdef bytes b_errmsg = to_bytes(errmsg) # <<<<<<<<<<<<<< * cdef char *_errmsg = b_errmsg * cdef int rc */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_errmsg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_errmsg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 496, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_errmsg = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":491 + /* "ssh2/session.pyx":497 * def set_last_error(self, int errcode, errmsg not None): * cdef bytes b_errmsg = to_bytes(errmsg) * cdef char *_errmsg = b_errmsg # <<<<<<<<<<<<<< @@ -7126,12 +7237,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_56set_last_error(struct __pyx_ */ if (unlikely(__pyx_v_b_errmsg == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 491, __pyx_L1_error) + __PYX_ERR(0, 497, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_errmsg); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 491, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_errmsg); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 497, __pyx_L1_error) __pyx_v__errmsg = __pyx_t_2; - /* "ssh2/session.pyx":493 + /* "ssh2/session.pyx":499 * cdef char *_errmsg = b_errmsg * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -7146,7 +7257,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_56set_last_error(struct __pyx_ #endif /*try:*/ { - /* "ssh2/session.pyx":494 + /* "ssh2/session.pyx":500 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_session_set_last_error( # <<<<<<<<<<<<<< @@ -7156,7 +7267,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_56set_last_error(struct __pyx_ __pyx_v_rc = libssh2_session_set_last_error(__pyx_v_self->_session, __pyx_v_errcode, __pyx_v__errmsg); } - /* "ssh2/session.pyx":493 + /* "ssh2/session.pyx":499 * cdef char *_errmsg = b_errmsg * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -7175,7 +7286,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_56set_last_error(struct __pyx_ } } - /* "ssh2/session.pyx":496 + /* "ssh2/session.pyx":502 * rc = c_ssh2.libssh2_session_set_last_error( * self._session, errcode, _errmsg) * return rc # <<<<<<<<<<<<<< @@ -7183,13 +7294,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_56set_last_error(struct __pyx_ * def scp_recv(self, path not None): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 496, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":489 + /* "ssh2/session.pyx":495 * * IF EMBEDDED_LIB: * def set_last_error(self, int errcode, errmsg not None): # <<<<<<<<<<<<<< @@ -7209,7 +7320,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_56set_last_error(struct __pyx_ return __pyx_r; } -/* "ssh2/session.pyx":498 +/* "ssh2/session.pyx":504 * return rc * * def scp_recv(self, path not None): # <<<<<<<<<<<<<< @@ -7228,7 +7339,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_59scp_recv(PyObject *__pyx_v_s __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("scp_recv (wrapper)", 0); if (unlikely(((PyObject *)__pyx_v_path) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "path"); __PYX_ERR(0, 498, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "path"); __PYX_ERR(0, 504, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_58scp_recv(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), ((PyObject *)__pyx_v_path)); @@ -7258,19 +7369,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("scp_recv", 0); - /* "ssh2/session.pyx":508 + /* "ssh2/session.pyx":514 * :rtype: tuple(:py:class:`ssh2.channel.Channel`, * :py:class:`ssh2.statinfo.StatInfo`) or None""" * cdef bytes b_path = to_bytes(path) # <<<<<<<<<<<<<< * cdef char *_path = b_path * cdef StatInfo statinfo = StatInfo() */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 514, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_path = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":509 + /* "ssh2/session.pyx":515 * :py:class:`ssh2.statinfo.StatInfo`) or None""" * cdef bytes b_path = to_bytes(path) * cdef char *_path = b_path # <<<<<<<<<<<<<< @@ -7279,24 +7390,24 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s */ if (unlikely(__pyx_v_b_path == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 509, __pyx_L1_error) + __PYX_ERR(0, 515, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 509, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 515, __pyx_L1_error) __pyx_v__path = __pyx_t_2; - /* "ssh2/session.pyx":510 + /* "ssh2/session.pyx":516 * cdef bytes b_path = to_bytes(path) * cdef char *_path = b_path * cdef StatInfo statinfo = StatInfo() # <<<<<<<<<<<<<< * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: */ - __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4ssh2_8statinfo_StatInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 510, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4ssh2_8statinfo_StatInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_statinfo = ((struct __pyx_obj_4ssh2_8statinfo_StatInfo *)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":512 + /* "ssh2/session.pyx":518 * cdef StatInfo statinfo = StatInfo() * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -7311,7 +7422,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s #endif /*try:*/ { - /* "ssh2/session.pyx":513 + /* "ssh2/session.pyx":519 * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: * channel = c_ssh2.libssh2_scp_recv( # <<<<<<<<<<<<<< @@ -7321,7 +7432,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s __pyx_v_channel = libssh2_scp_recv(__pyx_v_self->_session, __pyx_v__path, __pyx_v_statinfo->_stat); } - /* "ssh2/session.pyx":512 + /* "ssh2/session.pyx":518 * cdef StatInfo statinfo = StatInfo() * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -7340,7 +7451,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s } } - /* "ssh2/session.pyx":515 + /* "ssh2/session.pyx":521 * channel = c_ssh2.libssh2_scp_recv( * self._session, _path, statinfo._stat) * if channel is NULL: # <<<<<<<<<<<<<< @@ -7350,7 +7461,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s __pyx_t_3 = ((__pyx_v_channel == NULL) != 0); if (__pyx_t_3) { - /* "ssh2/session.pyx":516 + /* "ssh2/session.pyx":522 * self._session, _path, statinfo._stat) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -7359,29 +7470,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":517 + /* "ssh2/session.pyx":523 * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) # <<<<<<<<<<<<<< * return PyChannel(channel, self), statinfo * */ - __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 516, __pyx_L1_error) + __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 522, __pyx_L1_error) - /* "ssh2/session.pyx":516 + /* "ssh2/session.pyx":522 * self._session, _path, statinfo._stat) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< * self._session)) * return PyChannel(channel, self), statinfo */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 522, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":515 + /* "ssh2/session.pyx":521 * channel = c_ssh2.libssh2_scp_recv( * self._session, _path, statinfo._stat) * if channel is NULL: # <<<<<<<<<<<<<< @@ -7390,7 +7501,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s */ } - /* "ssh2/session.pyx":518 + /* "ssh2/session.pyx":524 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self), statinfo # <<<<<<<<<<<<<< @@ -7398,9 +7509,9 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s * IF EMBEDDED_LIB: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 518, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 524, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 518, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 524, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); @@ -7412,7 +7523,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s __pyx_t_5 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":498 + /* "ssh2/session.pyx":504 * return rc * * def scp_recv(self, path not None): # <<<<<<<<<<<<<< @@ -7434,7 +7545,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s return __pyx_r; } -/* "ssh2/session.pyx":521 +/* "ssh2/session.pyx":527 * * IF EMBEDDED_LIB: * def scp_recv2(self, path not None): # <<<<<<<<<<<<<< @@ -7453,7 +7564,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_61scp_recv2(PyObject *__pyx_v_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("scp_recv2 (wrapper)", 0); if (unlikely(((PyObject *)__pyx_v_path) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "path"); __PYX_ERR(0, 521, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "path"); __PYX_ERR(0, 527, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_60scp_recv2(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), ((PyObject *)__pyx_v_path)); @@ -7483,31 +7594,31 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("scp_recv2", 0); - /* "ssh2/session.pyx":531 + /* "ssh2/session.pyx":537 * :rtype: tuple(:py:class:`ssh2.channel.Channel`, * :py:class:`ssh2.fileinfo.FileInfo`) or ``None``""" * cdef FileInfo fileinfo = FileInfo() # <<<<<<<<<<<<<< * cdef bytes b_path = to_bytes(path) * cdef char *_path = b_path */ - __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4ssh2_8fileinfo_FileInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 531, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4ssh2_8fileinfo_FileInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_fileinfo = ((struct __pyx_obj_4ssh2_8fileinfo_FileInfo *)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":532 + /* "ssh2/session.pyx":538 * :py:class:`ssh2.fileinfo.FileInfo`) or ``None``""" * cdef FileInfo fileinfo = FileInfo() * cdef bytes b_path = to_bytes(path) # <<<<<<<<<<<<<< * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_path = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":533 + /* "ssh2/session.pyx":539 * cdef FileInfo fileinfo = FileInfo() * cdef bytes b_path = to_bytes(path) * cdef char *_path = b_path # <<<<<<<<<<<<<< @@ -7516,12 +7627,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 */ if (unlikely(__pyx_v_b_path == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 533, __pyx_L1_error) + __PYX_ERR(0, 539, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 533, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 539, __pyx_L1_error) __pyx_v__path = __pyx_t_2; - /* "ssh2/session.pyx":535 + /* "ssh2/session.pyx":541 * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -7536,7 +7647,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 #endif /*try:*/ { - /* "ssh2/session.pyx":536 + /* "ssh2/session.pyx":542 * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: * channel = c_ssh2.libssh2_scp_recv2( # <<<<<<<<<<<<<< @@ -7546,7 +7657,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 __pyx_v_channel = libssh2_scp_recv2(__pyx_v_self->_session, __pyx_v__path, __pyx_v_fileinfo->_stat); } - /* "ssh2/session.pyx":535 + /* "ssh2/session.pyx":541 * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -7565,7 +7676,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 } } - /* "ssh2/session.pyx":538 + /* "ssh2/session.pyx":544 * channel = c_ssh2.libssh2_scp_recv2( * self._session, _path, fileinfo._stat) * if channel is NULL: # <<<<<<<<<<<<<< @@ -7575,7 +7686,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 __pyx_t_3 = ((__pyx_v_channel == NULL) != 0); if (__pyx_t_3) { - /* "ssh2/session.pyx":539 + /* "ssh2/session.pyx":545 * self._session, _path, fileinfo._stat) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -7584,29 +7695,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":540 + /* "ssh2/session.pyx":546 * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) # <<<<<<<<<<<<<< * return PyChannel(channel, self), fileinfo * */ - __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 539, __pyx_L1_error) + __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 545, __pyx_L1_error) - /* "ssh2/session.pyx":539 + /* "ssh2/session.pyx":545 * self._session, _path, fileinfo._stat) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< * self._session)) * return PyChannel(channel, self), fileinfo */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 545, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":538 + /* "ssh2/session.pyx":544 * channel = c_ssh2.libssh2_scp_recv2( * self._session, _path, fileinfo._stat) * if channel is NULL: # <<<<<<<<<<<<<< @@ -7615,7 +7726,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 */ } - /* "ssh2/session.pyx":541 + /* "ssh2/session.pyx":547 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self), fileinfo # <<<<<<<<<<<<<< @@ -7623,9 +7734,9 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 * def scp_send(self, path not None, int mode, size_t size): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 541, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 547, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 541, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 547, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); @@ -7637,7 +7748,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 __pyx_t_5 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":521 + /* "ssh2/session.pyx":527 * * IF EMBEDDED_LIB: * def scp_recv2(self, path not None): # <<<<<<<<<<<<<< @@ -7659,7 +7770,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 return __pyx_r; } -/* "ssh2/session.pyx":543 +/* "ssh2/session.pyx":549 * return PyChannel(channel, self), fileinfo * * def scp_send(self, path not None, int mode, size_t size): # <<<<<<<<<<<<<< @@ -7705,17 +7816,17 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_63scp_send(PyObject *__pyx_v_s case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("scp_send", 1, 3, 3, 1); __PYX_ERR(0, 543, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send", 1, 3, 3, 1); __PYX_ERR(0, 549, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("scp_send", 1, 3, 3, 2); __PYX_ERR(0, 543, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send", 1, 3, 3, 2); __PYX_ERR(0, 549, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scp_send") < 0)) __PYX_ERR(0, 543, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scp_send") < 0)) __PYX_ERR(0, 549, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -7725,19 +7836,19 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_63scp_send(PyObject *__pyx_v_s values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_path = values[0]; - __pyx_v_mode = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 543, __pyx_L3_error) - __pyx_v_size = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_size == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 543, __pyx_L3_error) + __pyx_v_mode = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 549, __pyx_L3_error) + __pyx_v_size = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_size == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 549, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("scp_send", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 543, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 549, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.scp_send", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(((PyObject *)__pyx_v_path) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "path"); __PYX_ERR(0, 543, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "path"); __PYX_ERR(0, 549, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_62scp_send(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_path, __pyx_v_mode, __pyx_v_size); @@ -7765,19 +7876,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("scp_send", 0); - /* "ssh2/session.pyx":554 + /* "ssh2/session.pyx":560 * * :rtype: :py:class:`ssh2.channel.Channel`""" * cdef bytes b_path = to_bytes(path) # <<<<<<<<<<<<<< * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 554, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 560, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_path = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":555 + /* "ssh2/session.pyx":561 * :rtype: :py:class:`ssh2.channel.Channel`""" * cdef bytes b_path = to_bytes(path) * cdef char *_path = b_path # <<<<<<<<<<<<<< @@ -7786,12 +7897,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s */ if (unlikely(__pyx_v_b_path == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 555, __pyx_L1_error) + __PYX_ERR(0, 561, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 555, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 561, __pyx_L1_error) __pyx_v__path = __pyx_t_2; - /* "ssh2/session.pyx":557 + /* "ssh2/session.pyx":563 * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -7806,7 +7917,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s #endif /*try:*/ { - /* "ssh2/session.pyx":558 + /* "ssh2/session.pyx":564 * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: * channel = c_ssh2.libssh2_scp_send( # <<<<<<<<<<<<<< @@ -7816,7 +7927,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s __pyx_v_channel = libssh2_scp_send(__pyx_v_self->_session, __pyx_v__path, __pyx_v_mode, __pyx_v_size); } - /* "ssh2/session.pyx":557 + /* "ssh2/session.pyx":563 * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -7835,7 +7946,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s } } - /* "ssh2/session.pyx":560 + /* "ssh2/session.pyx":566 * channel = c_ssh2.libssh2_scp_send( * self._session, _path, mode, size) * if channel is NULL: # <<<<<<<<<<<<<< @@ -7845,7 +7956,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s __pyx_t_3 = ((__pyx_v_channel == NULL) != 0); if (__pyx_t_3) { - /* "ssh2/session.pyx":561 + /* "ssh2/session.pyx":567 * self._session, _path, mode, size) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -7854,29 +7965,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":562 + /* "ssh2/session.pyx":568 * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) # <<<<<<<<<<<<<< * return PyChannel(channel, self) * */ - __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 561, __pyx_L1_error) + __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 567, __pyx_L1_error) - /* "ssh2/session.pyx":561 + /* "ssh2/session.pyx":567 * self._session, _path, mode, size) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< * self._session)) * return PyChannel(channel, self) */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 561, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 567, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":560 + /* "ssh2/session.pyx":566 * channel = c_ssh2.libssh2_scp_send( * self._session, _path, mode, size) * if channel is NULL: # <<<<<<<<<<<<<< @@ -7885,7 +7996,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s */ } - /* "ssh2/session.pyx":563 + /* "ssh2/session.pyx":569 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self) # <<<<<<<<<<<<<< @@ -7893,13 +8004,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s * def scp_send64(self, path not None, int mode, c_ssh2.libssh2_uint64_t size, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 563, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 569, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":543 + /* "ssh2/session.pyx":549 * return PyChannel(channel, self), fileinfo * * def scp_send(self, path not None, int mode, size_t size): # <<<<<<<<<<<<<< @@ -7919,7 +8030,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s return __pyx_r; } -/* "ssh2/session.pyx":565 +/* "ssh2/session.pyx":571 * return PyChannel(channel, self) * * def scp_send64(self, path not None, int mode, c_ssh2.libssh2_uint64_t size, # <<<<<<<<<<<<<< @@ -7971,29 +8082,29 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_65scp_send64(PyObject *__pyx_v case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 1); __PYX_ERR(0, 565, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 1); __PYX_ERR(0, 571, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 2); __PYX_ERR(0, 565, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 2); __PYX_ERR(0, 571, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mtime)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 3); __PYX_ERR(0, 565, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 3); __PYX_ERR(0, 571, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_atime)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 4); __PYX_ERR(0, 565, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 4); __PYX_ERR(0, 571, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scp_send64") < 0)) __PYX_ERR(0, 565, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scp_send64") < 0)) __PYX_ERR(0, 571, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; @@ -8005,21 +8116,21 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_65scp_send64(PyObject *__pyx_v values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } __pyx_v_path = values[0]; - __pyx_v_mode = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 565, __pyx_L3_error) - __pyx_v_size = __Pyx_PyInt_As_libssh2_uint64_t(values[2]); if (unlikely((__pyx_v_size == ((libssh2_uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 565, __pyx_L3_error) - __pyx_v_mtime = __Pyx_PyInt_As_time_t(values[3]); if (unlikely((__pyx_v_mtime == ((time_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 566, __pyx_L3_error) - __pyx_v_atime = __Pyx_PyInt_As_time_t(values[4]); if (unlikely((__pyx_v_atime == ((time_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 566, __pyx_L3_error) + __pyx_v_mode = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 571, __pyx_L3_error) + __pyx_v_size = __Pyx_PyInt_As_libssh2_uint64_t(values[2]); if (unlikely((__pyx_v_size == ((libssh2_uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 571, __pyx_L3_error) + __pyx_v_mtime = __Pyx_PyInt_As_time_t(values[3]); if (unlikely((__pyx_v_mtime == ((time_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 572, __pyx_L3_error) + __pyx_v_atime = __Pyx_PyInt_As_time_t(values[4]); if (unlikely((__pyx_v_atime == ((time_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 572, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 565, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 571, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.scp_send64", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(((PyObject *)__pyx_v_path) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "path"); __PYX_ERR(0, 565, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "path"); __PYX_ERR(0, 571, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_64scp_send64(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_path, __pyx_v_mode, __pyx_v_size, __pyx_v_mtime, __pyx_v_atime); @@ -8047,19 +8158,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("scp_send64", 0); - /* "ssh2/session.pyx":577 + /* "ssh2/session.pyx":583 * * :rtype: :py:class:`ssh2.channel.Channel`""" * cdef bytes b_path = to_bytes(path) # <<<<<<<<<<<<<< * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 577, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 583, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_path = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":578 + /* "ssh2/session.pyx":584 * :rtype: :py:class:`ssh2.channel.Channel`""" * cdef bytes b_path = to_bytes(path) * cdef char *_path = b_path # <<<<<<<<<<<<<< @@ -8068,12 +8179,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ */ if (unlikely(__pyx_v_b_path == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 578, __pyx_L1_error) + __PYX_ERR(0, 584, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 578, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 584, __pyx_L1_error) __pyx_v__path = __pyx_t_2; - /* "ssh2/session.pyx":580 + /* "ssh2/session.pyx":586 * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -8088,7 +8199,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ #endif /*try:*/ { - /* "ssh2/session.pyx":581 + /* "ssh2/session.pyx":587 * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: * channel = c_ssh2.libssh2_scp_send64( # <<<<<<<<<<<<<< @@ -8098,7 +8209,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ __pyx_v_channel = libssh2_scp_send64(__pyx_v_self->_session, __pyx_v__path, __pyx_v_mode, __pyx_v_size, __pyx_v_mtime, __pyx_v_atime); } - /* "ssh2/session.pyx":580 + /* "ssh2/session.pyx":586 * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -8117,7 +8228,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ } } - /* "ssh2/session.pyx":583 + /* "ssh2/session.pyx":589 * channel = c_ssh2.libssh2_scp_send64( * self._session, _path, mode, size, mtime, atime) * if channel is NULL: # <<<<<<<<<<<<<< @@ -8127,7 +8238,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ __pyx_t_3 = ((__pyx_v_channel == NULL) != 0); if (__pyx_t_3) { - /* "ssh2/session.pyx":584 + /* "ssh2/session.pyx":590 * self._session, _path, mode, size, mtime, atime) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -8136,29 +8247,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":585 + /* "ssh2/session.pyx":591 * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) # <<<<<<<<<<<<<< * return PyChannel(channel, self) * */ - __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 584, __pyx_L1_error) + __pyx_t_4 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 590, __pyx_L1_error) - /* "ssh2/session.pyx":584 + /* "ssh2/session.pyx":590 * self._session, _path, mode, size, mtime, atime) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< * self._session)) * return PyChannel(channel, self) */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 584, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 590, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":583 + /* "ssh2/session.pyx":589 * channel = c_ssh2.libssh2_scp_send64( * self._session, _path, mode, size, mtime, atime) * if channel is NULL: # <<<<<<<<<<<<<< @@ -8167,7 +8278,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ */ } - /* "ssh2/session.pyx":586 + /* "ssh2/session.pyx":592 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self) # <<<<<<<<<<<<<< @@ -8175,13 +8286,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ * def publickey_init(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 592, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":565 + /* "ssh2/session.pyx":571 * return PyChannel(channel, self) * * def scp_send64(self, path not None, int mode, c_ssh2.libssh2_uint64_t size, # <<<<<<<<<<<<<< @@ -8201,7 +8312,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ return __pyx_r; } -/* "ssh2/session.pyx":588 +/* "ssh2/session.pyx":594 * return PyChannel(channel, self) * * def publickey_init(self): # <<<<<<<<<<<<<< @@ -8234,7 +8345,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("publickey_init", 0); - /* "ssh2/session.pyx":592 + /* "ssh2/session.pyx":598 * public keys""" * cdef c_pkey.LIBSSH2_PUBLICKEY *_pkey * with nogil: # <<<<<<<<<<<<<< @@ -8249,7 +8360,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ #endif /*try:*/ { - /* "ssh2/session.pyx":593 + /* "ssh2/session.pyx":599 * cdef c_pkey.LIBSSH2_PUBLICKEY *_pkey * with nogil: * _pkey = c_pkey.libssh2_publickey_init(self._session) # <<<<<<<<<<<<<< @@ -8259,7 +8370,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ __pyx_v__pkey = libssh2_publickey_init(__pyx_v_self->_session); } - /* "ssh2/session.pyx":592 + /* "ssh2/session.pyx":598 * public keys""" * cdef c_pkey.LIBSSH2_PUBLICKEY *_pkey * with nogil: # <<<<<<<<<<<<<< @@ -8278,7 +8389,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ } } - /* "ssh2/session.pyx":594 + /* "ssh2/session.pyx":600 * with nogil: * _pkey = c_pkey.libssh2_publickey_init(self._session) * if _pkey is NULL: # <<<<<<<<<<<<<< @@ -8288,20 +8399,20 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ __pyx_t_1 = ((__pyx_v__pkey == NULL) != 0); if (unlikely(__pyx_t_1)) { - /* "ssh2/session.pyx":595 + /* "ssh2/session.pyx":601 * _pkey = c_pkey.libssh2_publickey_init(self._session) * if _pkey is NULL: * raise PublicKeyInitError # <<<<<<<<<<<<<< * return PyPublicKeySystem(_pkey, self) * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PublicKeyInitError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 595, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PublicKeyInitError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 601, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 595, __pyx_L1_error) + __PYX_ERR(0, 601, __pyx_L1_error) - /* "ssh2/session.pyx":594 + /* "ssh2/session.pyx":600 * with nogil: * _pkey = c_pkey.libssh2_publickey_init(self._session) * if _pkey is NULL: # <<<<<<<<<<<<<< @@ -8310,7 +8421,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ */ } - /* "ssh2/session.pyx":596 + /* "ssh2/session.pyx":602 * if _pkey is NULL: * raise PublicKeyInitError * return PyPublicKeySystem(_pkey, self) # <<<<<<<<<<<<<< @@ -8318,13 +8429,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ * def hostkey_hash(self, int hash_type): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_f_4ssh2_9publickey_PyPublicKeySystem(__pyx_v__pkey, __pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 596, __pyx_L1_error) + __pyx_t_2 = __pyx_f_4ssh2_9publickey_PyPublicKeySystem(__pyx_v__pkey, __pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 602, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":588 + /* "ssh2/session.pyx":594 * return PyChannel(channel, self) * * def publickey_init(self): # <<<<<<<<<<<<<< @@ -8343,7 +8454,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ return __pyx_r; } -/* "ssh2/session.pyx":598 +/* "ssh2/session.pyx":604 * return PyPublicKeySystem(_pkey, self) * * def hostkey_hash(self, int hash_type): # <<<<<<<<<<<<<< @@ -8363,7 +8474,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_69hostkey_hash(PyObject *__pyx __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("hostkey_hash (wrapper)", 0); assert(__pyx_arg_hash_type); { - __pyx_v_hash_type = __Pyx_PyInt_As_int(__pyx_arg_hash_type); if (unlikely((__pyx_v_hash_type == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 598, __pyx_L3_error) + __pyx_v_hash_type = __Pyx_PyInt_As_int(__pyx_arg_hash_type); if (unlikely((__pyx_v_hash_type == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 604, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -8390,7 +8501,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob int __pyx_clineno = 0; __Pyx_RefNannySetupContext("hostkey_hash", 0); - /* "ssh2/session.pyx":608 + /* "ssh2/session.pyx":614 * cdef const char *_hash * cdef bytes b_hash * with nogil: # <<<<<<<<<<<<<< @@ -8405,7 +8516,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob #endif /*try:*/ { - /* "ssh2/session.pyx":609 + /* "ssh2/session.pyx":615 * cdef bytes b_hash * with nogil: * _hash = c_ssh2.libssh2_hostkey_hash(self._session, hash_type) # <<<<<<<<<<<<<< @@ -8415,7 +8526,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob __pyx_v__hash = libssh2_hostkey_hash(__pyx_v_self->_session, __pyx_v_hash_type); } - /* "ssh2/session.pyx":608 + /* "ssh2/session.pyx":614 * cdef const char *_hash * cdef bytes b_hash * with nogil: # <<<<<<<<<<<<<< @@ -8434,7 +8545,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob } } - /* "ssh2/session.pyx":610 + /* "ssh2/session.pyx":616 * with nogil: * _hash = c_ssh2.libssh2_hostkey_hash(self._session, hash_type) * if _hash is NULL: # <<<<<<<<<<<<<< @@ -8444,7 +8555,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob __pyx_t_1 = ((__pyx_v__hash == NULL) != 0); if (__pyx_t_1) { - /* "ssh2/session.pyx":611 + /* "ssh2/session.pyx":617 * _hash = c_ssh2.libssh2_hostkey_hash(self._session, hash_type) * if _hash is NULL: * return # <<<<<<<<<<<<<< @@ -8455,7 +8566,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "ssh2/session.pyx":610 + /* "ssh2/session.pyx":616 * with nogil: * _hash = c_ssh2.libssh2_hostkey_hash(self._session, hash_type) * if _hash is NULL: # <<<<<<<<<<<<<< @@ -8464,19 +8575,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob */ } - /* "ssh2/session.pyx":612 + /* "ssh2/session.pyx":618 * if _hash is NULL: * return * b_hash = _hash # <<<<<<<<<<<<<< * return b_hash * */ - __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v__hash); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 612, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v__hash); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 618, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_b_hash = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "ssh2/session.pyx":613 + /* "ssh2/session.pyx":619 * return * b_hash = _hash * return b_hash # <<<<<<<<<<<<<< @@ -8488,7 +8599,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob __pyx_r = __pyx_v_b_hash; goto __pyx_L0; - /* "ssh2/session.pyx":598 + /* "ssh2/session.pyx":604 * return PyPublicKeySystem(_pkey, self) * * def hostkey_hash(self, int hash_type): # <<<<<<<<<<<<<< @@ -8508,7 +8619,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob return __pyx_r; } -/* "ssh2/session.pyx":615 +/* "ssh2/session.pyx":621 * return b_hash * * def hostkey(self): # <<<<<<<<<<<<<< @@ -8546,7 +8657,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss int __pyx_clineno = 0; __Pyx_RefNannySetupContext("hostkey", 0); - /* "ssh2/session.pyx":624 + /* "ssh2/session.pyx":630 * * :rtype: tuple(bytes, int)""" * cdef bytes key = b"" # <<<<<<<<<<<<<< @@ -8556,7 +8667,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss __Pyx_INCREF(__pyx_kp_b__2); __pyx_v_key = __pyx_kp_b__2; - /* "ssh2/session.pyx":626 + /* "ssh2/session.pyx":632 * cdef bytes key = b"" * cdef const char *_key * cdef size_t key_len = 0 # <<<<<<<<<<<<<< @@ -8565,7 +8676,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss */ __pyx_v_key_len = 0; - /* "ssh2/session.pyx":627 + /* "ssh2/session.pyx":633 * cdef const char *_key * cdef size_t key_len = 0 * cdef int key_type = 0 # <<<<<<<<<<<<<< @@ -8574,7 +8685,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss */ __pyx_v_key_type = 0; - /* "ssh2/session.pyx":628 + /* "ssh2/session.pyx":634 * cdef size_t key_len = 0 * cdef int key_type = 0 * with nogil: # <<<<<<<<<<<<<< @@ -8589,7 +8700,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss #endif /*try:*/ { - /* "ssh2/session.pyx":629 + /* "ssh2/session.pyx":635 * cdef int key_type = 0 * with nogil: * _key = c_ssh2.libssh2_session_hostkey( # <<<<<<<<<<<<<< @@ -8599,7 +8710,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss __pyx_v__key = libssh2_session_hostkey(__pyx_v_self->_session, (&__pyx_v_key_len), (&__pyx_v_key_type)); } - /* "ssh2/session.pyx":628 + /* "ssh2/session.pyx":634 * cdef size_t key_len = 0 * cdef int key_type = 0 * with nogil: # <<<<<<<<<<<<<< @@ -8618,7 +8729,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss } } - /* "ssh2/session.pyx":631 + /* "ssh2/session.pyx":637 * _key = c_ssh2.libssh2_session_hostkey( * self._session, &key_len, &key_type) * if _key is NULL: # <<<<<<<<<<<<<< @@ -8628,14 +8739,14 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss __pyx_t_1 = ((__pyx_v__key == NULL) != 0); if (unlikely(__pyx_t_1)) { - /* "ssh2/session.pyx":632 + /* "ssh2/session.pyx":638 * self._session, &key_len, &key_type) * if _key is NULL: * raise SessionHostKeyError( # <<<<<<<<<<<<<< * "Error retrieving server host key for session") * key = _key[:key_len] */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_SessionHostKeyError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 632, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_SessionHostKeyError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 638, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -8649,14 +8760,14 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_Error_retrieving_server_host_key) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_Error_retrieving_server_host_key); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 632, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 638, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 632, __pyx_L1_error) + __PYX_ERR(0, 638, __pyx_L1_error) - /* "ssh2/session.pyx":631 + /* "ssh2/session.pyx":637 * _key = c_ssh2.libssh2_session_hostkey( * self._session, &key_len, &key_type) * if _key is NULL: # <<<<<<<<<<<<<< @@ -8665,19 +8776,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss */ } - /* "ssh2/session.pyx":634 + /* "ssh2/session.pyx":640 * raise SessionHostKeyError( * "Error retrieving server host key for session") * key = _key[:key_len] # <<<<<<<<<<<<<< * return key, key_type * */ - __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(__pyx_v__key + 0, __pyx_v_key_len - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 634, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(__pyx_v__key + 0, __pyx_v_key_len - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 640, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF_SET(__pyx_v_key, ((PyObject*)__pyx_t_2)); __pyx_t_2 = 0; - /* "ssh2/session.pyx":635 + /* "ssh2/session.pyx":641 * "Error retrieving server host key for session") * key = _key[:key_len] * return key, key_type # <<<<<<<<<<<<<< @@ -8685,9 +8796,9 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss * def knownhost_init(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_key_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 635, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_key_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 641, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 635, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 641, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_key); __Pyx_GIVEREF(__pyx_v_key); @@ -8699,7 +8810,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":615 + /* "ssh2/session.pyx":621 * return b_hash * * def hostkey(self): # <<<<<<<<<<<<<< @@ -8721,7 +8832,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss return __pyx_r; } -/* "ssh2/session.pyx":637 +/* "ssh2/session.pyx":643 * return key, key_type * * def knownhost_init(self): # <<<<<<<<<<<<<< @@ -8754,7 +8865,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("knownhost_init", 0); - /* "ssh2/session.pyx":642 + /* "ssh2/session.pyx":648 * :rtype: :py:class:`ssh2.knownhost.KnownHost`""" * cdef c_ssh2.LIBSSH2_KNOWNHOSTS *known_hosts * with nogil: # <<<<<<<<<<<<<< @@ -8769,7 +8880,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ #endif /*try:*/ { - /* "ssh2/session.pyx":643 + /* "ssh2/session.pyx":649 * cdef c_ssh2.LIBSSH2_KNOWNHOSTS *known_hosts * with nogil: * known_hosts = c_ssh2.libssh2_knownhost_init( # <<<<<<<<<<<<<< @@ -8779,7 +8890,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ __pyx_v_known_hosts = libssh2_knownhost_init(__pyx_v_self->_session); } - /* "ssh2/session.pyx":642 + /* "ssh2/session.pyx":648 * :rtype: :py:class:`ssh2.knownhost.KnownHost`""" * cdef c_ssh2.LIBSSH2_KNOWNHOSTS *known_hosts * with nogil: # <<<<<<<<<<<<<< @@ -8798,7 +8909,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ } } - /* "ssh2/session.pyx":645 + /* "ssh2/session.pyx":651 * known_hosts = c_ssh2.libssh2_knownhost_init( * self._session) * if known_hosts is NULL: # <<<<<<<<<<<<<< @@ -8808,20 +8919,20 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ __pyx_t_1 = ((__pyx_v_known_hosts == NULL) != 0); if (unlikely(__pyx_t_1)) { - /* "ssh2/session.pyx":646 + /* "ssh2/session.pyx":652 * self._session) * if known_hosts is NULL: * raise KnownHostError # <<<<<<<<<<<<<< * return PyKnownHost(self, known_hosts) * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_KnownHostError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 646, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_KnownHostError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 652, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 646, __pyx_L1_error) + __PYX_ERR(0, 652, __pyx_L1_error) - /* "ssh2/session.pyx":645 + /* "ssh2/session.pyx":651 * known_hosts = c_ssh2.libssh2_knownhost_init( * self._session) * if known_hosts is NULL: # <<<<<<<<<<<<<< @@ -8830,7 +8941,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ */ } - /* "ssh2/session.pyx":647 + /* "ssh2/session.pyx":653 * if known_hosts is NULL: * raise KnownHostError * return PyKnownHost(self, known_hosts) # <<<<<<<<<<<<<< @@ -8838,13 +8949,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ * def keepalive_config(self, bint want_reply, unsigned interval): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = ((PyObject *)__pyx_f_4ssh2_9knownhost_PyKnownHost(__pyx_v_self, __pyx_v_known_hosts)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 647, __pyx_L1_error) + __pyx_t_2 = ((PyObject *)__pyx_f_4ssh2_9knownhost_PyKnownHost(__pyx_v_self, __pyx_v_known_hosts)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 653, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":637 + /* "ssh2/session.pyx":643 * return key, key_type * * def knownhost_init(self): # <<<<<<<<<<<<<< @@ -8863,7 +8974,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ return __pyx_r; } -/* "ssh2/session.pyx":649 +/* "ssh2/session.pyx":655 * return PyKnownHost(self, known_hosts) * * def keepalive_config(self, bint want_reply, unsigned interval): # <<<<<<<<<<<<<< @@ -8906,11 +9017,11 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_75keepalive_config(PyObject *_ case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_interval)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("keepalive_config", 1, 2, 2, 1); __PYX_ERR(0, 649, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("keepalive_config", 1, 2, 2, 1); __PYX_ERR(0, 655, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "keepalive_config") < 0)) __PYX_ERR(0, 649, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "keepalive_config") < 0)) __PYX_ERR(0, 655, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -8918,12 +9029,12 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_75keepalive_config(PyObject *_ values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_want_reply = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_want_reply == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 649, __pyx_L3_error) - __pyx_v_interval = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_interval == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 649, __pyx_L3_error) + __pyx_v_want_reply = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_want_reply == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 655, __pyx_L3_error) + __pyx_v_interval = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_interval == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 655, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("keepalive_config", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 649, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("keepalive_config", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 655, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.keepalive_config", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -8941,7 +9052,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_74keepalive_config(struct __py __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("keepalive_config", 0); - /* "ssh2/session.pyx":659 + /* "ssh2/session.pyx":665 * keepalives. * :type interval: int""" * with nogil: # <<<<<<<<<<<<<< @@ -8956,7 +9067,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_74keepalive_config(struct __py #endif /*try:*/ { - /* "ssh2/session.pyx":660 + /* "ssh2/session.pyx":666 * :type interval: int""" * with nogil: * c_ssh2.libssh2_keepalive_config(self._session, want_reply, interval) # <<<<<<<<<<<<<< @@ -8966,7 +9077,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_74keepalive_config(struct __py libssh2_keepalive_config(__pyx_v_self->_session, __pyx_v_want_reply, __pyx_v_interval); } - /* "ssh2/session.pyx":659 + /* "ssh2/session.pyx":665 * keepalives. * :type interval: int""" * with nogil: # <<<<<<<<<<<<<< @@ -8985,7 +9096,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_74keepalive_config(struct __py } } - /* "ssh2/session.pyx":649 + /* "ssh2/session.pyx":655 * return PyKnownHost(self, known_hosts) * * def keepalive_config(self, bint want_reply, unsigned interval): # <<<<<<<<<<<<<< @@ -9000,7 +9111,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_74keepalive_config(struct __py return __pyx_r; } -/* "ssh2/session.pyx":662 +/* "ssh2/session.pyx":668 * c_ssh2.libssh2_keepalive_config(self._session, want_reply, interval) * * def keepalive_send(self): # <<<<<<<<<<<<<< @@ -9035,7 +9146,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("keepalive_send", 0); - /* "ssh2/session.pyx":668 + /* "ssh2/session.pyx":674 * * :rtype: int""" * cdef int seconds = 0 # <<<<<<<<<<<<<< @@ -9044,7 +9155,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ */ __pyx_v_seconds = 0; - /* "ssh2/session.pyx":669 + /* "ssh2/session.pyx":675 * :rtype: int""" * cdef int seconds = 0 * cdef int c_seconds = 0 # <<<<<<<<<<<<<< @@ -9053,7 +9164,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ */ __pyx_v_c_seconds = 0; - /* "ssh2/session.pyx":671 + /* "ssh2/session.pyx":677 * cdef int c_seconds = 0 * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -9068,7 +9179,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ #endif /*try:*/ { - /* "ssh2/session.pyx":672 + /* "ssh2/session.pyx":678 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_keepalive_send(self._session, &c_seconds) # <<<<<<<<<<<<<< @@ -9078,7 +9189,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ __pyx_v_rc = libssh2_keepalive_send(__pyx_v_self->_session, (&__pyx_v_c_seconds)); } - /* "ssh2/session.pyx":671 + /* "ssh2/session.pyx":677 * cdef int c_seconds = 0 * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -9097,16 +9208,16 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ } } - /* "ssh2/session.pyx":673 + /* "ssh2/session.pyx":679 * with nogil: * rc = c_ssh2.libssh2_keepalive_send(self._session, &c_seconds) * handle_error_codes(rc) # <<<<<<<<<<<<<< * return c_seconds * */ - __pyx_t_1 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 673, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 679, __pyx_L1_error) - /* "ssh2/session.pyx":674 + /* "ssh2/session.pyx":680 * rc = c_ssh2.libssh2_keepalive_send(self._session, &c_seconds) * handle_error_codes(rc) * return c_seconds # <<<<<<<<<<<<<< @@ -9114,13 +9225,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ * def trace(self, int bitmask): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_c_seconds); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 674, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_c_seconds); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 680, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":662 + /* "ssh2/session.pyx":668 * c_ssh2.libssh2_keepalive_config(self._session, want_reply, interval) * * def keepalive_send(self): # <<<<<<<<<<<<<< @@ -9139,7 +9250,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ return __pyx_r; } -/* "ssh2/session.pyx":676 +/* "ssh2/session.pyx":682 * return c_seconds * * def trace(self, int bitmask): # <<<<<<<<<<<<<< @@ -9159,7 +9270,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_79trace(PyObject *__pyx_v_self __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("trace (wrapper)", 0); assert(__pyx_arg_bitmask); { - __pyx_v_bitmask = __Pyx_PyInt_As_int(__pyx_arg_bitmask); if (unlikely((__pyx_v_bitmask == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 676, __pyx_L3_error) + __pyx_v_bitmask = __Pyx_PyInt_As_int(__pyx_arg_bitmask); if (unlikely((__pyx_v_bitmask == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 682, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -9179,14 +9290,14 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_78trace(struct __pyx_obj_4ssh2 __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("trace", 0); - /* "ssh2/session.pyx":681 + /* "ssh2/session.pyx":687 * Bitmask is one or more of `ssh2.session.LIBSSH2_TRACE_*`. * """ * c_ssh2.libssh2_trace(self._session, bitmask) # <<<<<<<<<<<<<< */ (void)(libssh2_trace(__pyx_v_self->_session, __pyx_v_bitmask)); - /* "ssh2/session.pyx":676 + /* "ssh2/session.pyx":682 * return c_seconds * * def trace(self, int bitmask): # <<<<<<<<<<<<<< @@ -9351,7 +9462,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_82__setstate_cython__(CYTHON_U return __pyx_r; } -static PyObject *__pyx_tp_new_4ssh2_7session_Session(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_4ssh2_7session_Session(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_4ssh2_7session_Session *p; PyObject *o; if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { @@ -9362,7 +9473,7 @@ static PyObject *__pyx_tp_new_4ssh2_7session_Session(PyTypeObject *t, CYTHON_UNU if (unlikely(!o)) return 0; p = ((struct __pyx_obj_4ssh2_7session_Session *)o); p->sock = Py_None; Py_INCREF(Py_None); - if (unlikely(__pyx_pw_4ssh2_7session_7Session_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad; + if (unlikely(__pyx_pw_4ssh2_7session_7Session_1__cinit__(o, a, k) < 0)) goto bad; return o; bad: Py_DECREF(o); o = 0; @@ -9613,6 +9724,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_hostname, __pyx_k_hostname, sizeof(__pyx_k_hostname), 0, 0, 1, 1}, {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, {&__pyx_n_s_interval, __pyx_k_interval, sizeof(__pyx_k_interval), 0, 0, 1, 1}, + {&__pyx_n_s_kbd_callback, __pyx_k_kbd_callback, sizeof(__pyx_k_kbd_callback), 0, 0, 1, 1}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, {&__pyx_n_s_msg_size, __pyx_k_msg_size, sizeof(__pyx_k_msg_size), 0, 0, 1, 1}, @@ -9636,6 +9748,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, {&__pyx_n_s_shost, __pyx_k_shost, sizeof(__pyx_k_shost), 0, 0, 1, 1}, {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, + {&__pyx_n_s_socket, __pyx_k_socket, sizeof(__pyx_k_socket), 0, 0, 1, 1}, {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1}, {&__pyx_n_s_sport, __pyx_k_sport, sizeof(__pyx_k_sport), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, @@ -9644,7 +9757,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 67, __pyx_L1_error) + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 68, __pyx_L1_error) __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error) return 0; __pyx_L1_error:; @@ -10393,6 +10506,122 @@ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { return result; } +/* RaiseDoubleKeywords */ +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif +} + +/* ParseKeywords */ +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + /* RaiseArgTupleInvalid */ static void __Pyx_RaiseArgtupleInvalid( const char* func_name, @@ -10419,45 +10648,19 @@ static void __Pyx_RaiseArgtupleInvalid( (num_expected == 1) ? "" : "s", num_found); } -/* KeywordStringCheck */ -static int __Pyx_CheckKeywordStrings( - PyObject *kwdict, - const char* function_name, - int kw_allowed) -{ - PyObject* key = 0; - Py_ssize_t pos = 0; -#if CYTHON_COMPILING_IN_PYPY - if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0)) - goto invalid_keyword; - return 1; -#else - while (PyDict_Next(kwdict, &pos, &key, 0)) { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_Check(key))) - #endif - if (unlikely(!PyUnicode_Check(key))) - goto invalid_keyword_type; - } - if ((!kw_allowed) && unlikely(key)) - goto invalid_keyword; - return 1; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - return 0; +/* PyObjectSetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_setattro)) + return tp->tp_setattro(obj, attr_name, value); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_setattr)) + return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); #endif -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif - return 0; + return PyObject_SetAttr(obj, attr_name, value); } +#endif /* PyObjectCall */ #if CYTHON_COMPILING_IN_CPYTHON @@ -10551,122 +10754,6 @@ static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObje return result; } -/* RaiseDoubleKeywords */ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AsString(kw_name)); - #endif -} - -/* ParseKeywords */ -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - continue; - } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = (**name == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - /* ArgTypeTest */ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) { diff --git a/ssh2/session.pyx b/ssh2/session.pyx index 88ab74e9..1456fe31 100644 --- a/ssh2/session.pyx +++ b/ssh2/session.pyx @@ -61,12 +61,18 @@ LIBSSH2_TRACE_SOCKET = c_ssh2.LIBSSH2_TRACE_SOCKET cdef class Session: """LibSSH2 Session class providing session functions""" - def __cinit__(self): - self._session = c_ssh2.libssh2_session_init() + def __cinit__(self, socket=None): + self._session = c_ssh2.libssh2_session_init_ex( + NULL, NULL, NULL, self) if self._session is NULL: raise MemoryError - self._sock = 0 - self.sock = None + if socket is not None: + self._sock = PyObject_AsFileDescriptor(socket) + self.sock = socket + else: + self._sock = 0 + self.sock = None + self._kbd_callback = None def __dealloc__(self): if self._session is not NULL: