diff --git a/Changelog.rst b/Changelog.rst index c9f7bade..68462251 100644 --- a/Changelog.rst +++ b/Changelog.rst @@ -1,6 +1,18 @@ Change Log ============= + +0.25.0 +++++++ + +Changes +------- + +* Added new in libssh2 `1.9.0` errors as exceptions. +* Added ``Session.methods``, ``Session.method_pref`` and ``Session.supported_algs`` functions. +* Added supported method types as ``ssh2.session.LIBSSH2_METHOD_*``. + + 0.24.0 ++++++ diff --git a/README.rst b/README.rst index e3ccc84d..f4946e1e 100644 --- a/README.rst +++ b/README.rst @@ -61,7 +61,7 @@ If the examples seem long, this is not the right library. Use `parallel-ssh curexc_type +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() PyErr_Occurred() +#endif + +/* PyErrFetchRestore.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + +/* RaiseException.proto */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); + /* PyFunctionFastCall.proto */ #if CYTHON_FAST_PYCALL #define __Pyx_PyFunction_FastCall(func, args, nargs)\ @@ -1098,13 +1169,6 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) #endif -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); -#else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) -#endif - /* PyObjectCallMethO.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); @@ -1127,10 +1191,6 @@ static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObje /* PyObjectCallOneArg.proto */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); -/* 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); @@ -1151,14 +1211,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 :\ @@ -1231,42 +1283,6 @@ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, PyObject *module, PyObject *globals, PyObject* code); -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() PyErr_Occurred() -#endif - -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) -#else -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#endif -#else -#define __Pyx_PyErr_Clear() PyErr_Clear() -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - /* GetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) @@ -1346,12 +1362,26 @@ static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_ve static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); #endif -/* RaiseException.proto */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); - /* PyObjectCall2Args.proto */ static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); +/* ListCompAppend.proto */ +#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS +static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len)) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + __Pyx_SET_SIZE(list, len + 1); + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) +#endif + /* IncludeStringH.proto */ #include @@ -1612,6 +1642,7 @@ static PyTypeObject *__pyx_ptype_4ssh2_8fileinfo_FileInfo = 0; /* Module declarations from 'ssh2.session' */ static PyTypeObject *__pyx_ptype_4ssh2_7session_Session = 0; +static PyTypeObject *__pyx_ptype_4ssh2_7session_MethodType = 0; static PyTypeObject *__pyx_ptype_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive = 0; static void __pyx_f_4ssh2_7session_kbd_callback(char const *, int, char const *, int, int, LIBSSH2_USERAUTH_KBDINT_PROMPT const *, LIBSSH2_USERAUTH_KBDINT_RESPONSE *, void **); /*proto*/ #define __Pyx_MODULE_NAME "ssh2.session" @@ -1619,11 +1650,11 @@ extern int __pyx_module_is_main_ssh2__session; int __pyx_module_is_main_ssh2__session = 0; /* Implementation of 'ssh2.session' */ +static PyObject *__pyx_builtin_TypeError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_MemoryError; -static PyObject *__pyx_builtin_TypeError; -static const char __pyx_k_[] = ","; -static const char __pyx_k__2[] = ""; +static const char __pyx_k__3[] = ","; +static const char __pyx_k__4[] = ""; static const char __pyx_k_host[] = "host"; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_mode[] = "mode"; @@ -1634,10 +1665,12 @@ static const char __pyx_k_size[] = "size"; static const char __pyx_k_test[] = "__test__"; static const char __pyx_k_atime[] = "atime"; static const char __pyx_k_mtime[] = "mtime"; +static const char __pyx_k_prefs[] = "prefs"; static const char __pyx_k_range[] = "range"; static const char __pyx_k_shost[] = "shost"; static const char __pyx_k_split[] = "split"; static const char __pyx_k_sport[] = "sport"; +static const char __pyx_k_value[] = "value"; static const char __pyx_k_errmsg[] = "errmsg"; static const char __pyx_k_import[] = "__import__"; static const char __pyx_k_passwd[] = "passwd"; @@ -1654,12 +1687,14 @@ static const char __pyx_k_username[] = "username"; static const char __pyx_k_TypeError[] = "TypeError"; static const char __pyx_k_publickey[] = "publickey"; static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; +static const char __pyx_k_MethodType[] = "MethodType"; static const char __pyx_k_exceptions[] = "exceptions"; static const char __pyx_k_passphrase[] = "passphrase"; static const char __pyx_k_privatekey[] = "privatekey"; 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_method_type[] = "method_type"; static const char __pyx_k_ChannelError[] = "ChannelError"; static const char __pyx_k_ssh2_session[] = "ssh2.session"; static const char __pyx_k_queue_maxsize[] = "queue_maxsize"; @@ -1668,10 +1703,20 @@ static const char __pyx_k_KnownHostError[] = "KnownHostError"; static const char __pyx_k_setstate_cython[] = "__setstate_cython__"; static const char __pyx_k_ssh2_session_pyx[] = "ssh2/session.pyx"; static const char __pyx_k_publickeyfiledata[] = "publickeyfiledata"; +static const char __pyx_k_LIBSSH2_METHOD_KEX[] = "LIBSSH2_METHOD_KEX"; 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_SessionHostKeyError[] = "SessionHostKeyError"; +static const char __pyx_k_LIBSSH2_METHOD_MAC_CS[] = "LIBSSH2_METHOD_MAC_CS"; +static const char __pyx_k_LIBSSH2_METHOD_MAC_SC[] = "LIBSSH2_METHOD_MAC_SC"; +static const char __pyx_k_LIBSSH2_METHOD_COMP_CS[] = "LIBSSH2_METHOD_COMP_CS"; +static const char __pyx_k_LIBSSH2_METHOD_COMP_SC[] = "LIBSSH2_METHOD_COMP_SC"; +static const char __pyx_k_LIBSSH2_METHOD_HOSTKEY[] = "LIBSSH2_METHOD_HOSTKEY"; +static const char __pyx_k_LIBSSH2_METHOD_LANG_CS[] = "LIBSSH2_METHOD_LANG_CS"; +static const char __pyx_k_LIBSSH2_METHOD_LANG_SC[] = "LIBSSH2_METHOD_LANG_SC"; +static const char __pyx_k_LIBSSH2_METHOD_CRYPT_CS[] = "LIBSSH2_METHOD_CRYPT_CS"; +static const char __pyx_k_LIBSSH2_METHOD_CRYPT_SC[] = "LIBSSH2_METHOD_CRYPT_SC"; 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"; @@ -1687,7 +1732,6 @@ static const char __pyx_k_LIBSSH2_SESSION_BLOCK_OUTBOUND[] = "LIBSSH2_SESSION_BL static const char __pyx_k_Error_retrieving_server_host_key[] = "Error retrieving server host key for session"; static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__"; static const char __pyx_k_userauth_keyboardinteractive_loc[] = "userauth_keyboardinteractive..passwd"; -static PyObject *__pyx_kp_s_; static PyObject *__pyx_n_s_ChannelError; static PyObject *__pyx_kp_s_Error_retrieving_server_host_key; static PyObject *__pyx_n_s_KnownHostError; @@ -1701,15 +1745,27 @@ static PyObject *__pyx_n_s_LIBSSH2_HOSTKEY_TYPE_ECDSA_521; static PyObject *__pyx_n_s_LIBSSH2_HOSTKEY_TYPE_ED25519; static PyObject *__pyx_n_s_LIBSSH2_HOSTKEY_TYPE_RSA; static PyObject *__pyx_n_s_LIBSSH2_HOSTKEY_TYPE_UNKNOWN; +static PyObject *__pyx_n_s_LIBSSH2_METHOD_COMP_CS; +static PyObject *__pyx_n_s_LIBSSH2_METHOD_COMP_SC; +static PyObject *__pyx_n_s_LIBSSH2_METHOD_CRYPT_CS; +static PyObject *__pyx_n_s_LIBSSH2_METHOD_CRYPT_SC; +static PyObject *__pyx_n_s_LIBSSH2_METHOD_HOSTKEY; +static PyObject *__pyx_n_s_LIBSSH2_METHOD_KEX; +static PyObject *__pyx_n_s_LIBSSH2_METHOD_LANG_CS; +static PyObject *__pyx_n_s_LIBSSH2_METHOD_LANG_SC; +static PyObject *__pyx_n_s_LIBSSH2_METHOD_MAC_CS; +static PyObject *__pyx_n_s_LIBSSH2_METHOD_MAC_SC; static PyObject *__pyx_n_s_LIBSSH2_SESSION_BLOCK_INBOUND; static PyObject *__pyx_n_s_LIBSSH2_SESSION_BLOCK_OUTBOUND; static PyObject *__pyx_n_s_MemoryError; +static PyObject *__pyx_n_s_MethodType; static PyObject *__pyx_n_s_PublicKeyInitError; static PyObject *__pyx_n_s_Session; static PyObject *__pyx_n_s_SessionHostKeyError; static PyObject *__pyx_n_s_TypeError; -static PyObject *__pyx_kp_b__2; -static PyObject *__pyx_kp_s__2; +static PyObject *__pyx_kp_s__3; +static PyObject *__pyx_kp_b__4; +static PyObject *__pyx_kp_s__4; static PyObject *__pyx_n_s_atime; static PyObject *__pyx_n_s_cline_in_traceback; static PyObject *__pyx_n_s_errcode; @@ -1721,6 +1777,7 @@ static PyObject *__pyx_n_s_hostname; static PyObject *__pyx_n_s_import; static PyObject *__pyx_n_s_interval; static PyObject *__pyx_n_s_main; +static PyObject *__pyx_n_s_method_type; static PyObject *__pyx_n_s_mode; static PyObject *__pyx_n_s_msg_size; static PyObject *__pyx_n_s_mtime; @@ -1731,6 +1788,7 @@ static PyObject *__pyx_n_s_passwd; static PyObject *__pyx_n_s_password; static PyObject *__pyx_n_s_path; static PyObject *__pyx_n_s_port; +static PyObject *__pyx_n_s_prefs; static PyObject *__pyx_n_s_privatekey; static PyObject *__pyx_n_s_privatekeyfiledata; static PyObject *__pyx_n_s_pubkeydata; @@ -1752,7 +1810,11 @@ static PyObject *__pyx_kp_s_ssh2_session_pyx; static PyObject *__pyx_n_s_test; static PyObject *__pyx_n_s_userauth_keyboardinteractive_loc; static PyObject *__pyx_n_s_username; +static PyObject *__pyx_n_s_value; static PyObject *__pyx_n_s_want_reply; +static int __pyx_pf_4ssh2_7session_10MethodType___cinit__(struct __pyx_obj_4ssh2_7session_MethodType *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_4ssh2_7session_10MethodType_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4ssh2_7session_MethodType *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4ssh2_7session_10MethodType_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4ssh2_7session_MethodType *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static int __pyx_pf_4ssh2_7session_7Session___cinit__(struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self); /* 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 */ @@ -1793,99 +1855,319 @@ 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_78supported_algs(struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self, struct __pyx_obj_4ssh2_7session_MethodType *__pyx_v_method_type); /* proto */ +static PyObject *__pyx_pf_4ssh2_7session_7Session_80methods(struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self, struct __pyx_obj_4ssh2_7session_MethodType *__pyx_v_method_type); /* proto */ +static PyObject *__pyx_pf_4ssh2_7session_7Session_82method_pref(struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self, struct __pyx_obj_4ssh2_7session_MethodType *__pyx_v_method_type, PyObject *__pyx_v_prefs); /* 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_13_kbd_callback___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_84__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4ssh2_7session_7Session_86__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 PyObject *__pyx_tp_new_4ssh2_7session_MethodType(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive(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_int_0; -static PyObject *__pyx_tuple__4; -static PyObject *__pyx_tuple__5; -static PyObject *__pyx_codeobj__3; +static PyObject *__pyx_tuple_; +static PyObject *__pyx_tuple__2; +static PyObject *__pyx_tuple__6; +static PyObject *__pyx_tuple__7; +static PyObject *__pyx_codeobj__5; /* Late includes */ -/* "ssh2/session.pyx":65 +/* "ssh2/session.pyx":66 * + * cdef class MethodType: + * def __cinit__(self, value): # <<<<<<<<<<<<<< + * self.value = value * - * cdef void kbd_callback(const char *name, int name_len, # <<<<<<<<<<<<<< - * const char *instruction, int instruction_len, - * int num_prompts, */ -static void __pyx_f_4ssh2_7session_kbd_callback(CYTHON_UNUSED char const *__pyx_v_name, CYTHON_UNUSED int __pyx_v_name_len, CYTHON_UNUSED char const *__pyx_v_instruction, CYTHON_UNUSED int __pyx_v_instruction_len, int __pyx_v_num_prompts, CYTHON_UNUSED LIBSSH2_USERAUTH_KBDINT_PROMPT const *__pyx_v_prompts, LIBSSH2_USERAUTH_KBDINT_RESPONSE *__pyx_v_responses, void **__pyx_v_abstract) { - struct __pyx_obj_4ssh2_7session_Session *__pyx_v_py_sess = NULL; - PyObject *__pyx_v_b_password = 0; - size_t __pyx_v__len; - char *__pyx_v__password; - char *__pyx_v__password_copy; - size_t __pyx_v_i; +/* Python wrapper */ +static int __pyx_pw_4ssh2_7session_10MethodType_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4ssh2_7session_10MethodType_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_value = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - void *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - Py_ssize_t __pyx_t_7; - char *__pyx_t_8; - size_t __pyx_t_9; - size_t __pyx_t_10; - size_t __pyx_t_11; + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_value,0}; + PyObject* values[1] = {0}; + 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 (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(1, 66, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_value = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 66, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("ssh2.session.MethodType.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4ssh2_7session_10MethodType___cinit__(((struct __pyx_obj_4ssh2_7session_MethodType *)__pyx_v_self), __pyx_v_value); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4ssh2_7session_10MethodType___cinit__(struct __pyx_obj_4ssh2_7session_MethodType *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("kbd_callback", 0); + __Pyx_RefNannySetupContext("__cinit__", 0); - /* "ssh2/session.pyx":71 - * c_ssh2.LIBSSH2_USERAUTH_KBDINT_RESPONSE *responses, - * void **abstract) except *: - * py_sess = (c_dereference(abstract)) # <<<<<<<<<<<<<< - * if py_sess._kbd_callback is None: - * return + /* "ssh2/session.pyx":67 + * cdef class MethodType: + * def __cinit__(self, value): + * self.value = value # <<<<<<<<<<<<<< + * + * */ - __pyx_t_1 = (*__pyx_v_abstract); - __pyx_t_2 = ((PyObject *)__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); - __pyx_v_py_sess = ((struct __pyx_obj_4ssh2_7session_Session *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 67, __pyx_L1_error) + __pyx_v_self->value = __pyx_t_1; - /* "ssh2/session.pyx":72 - * void **abstract) except *: - * py_sess = (c_dereference(abstract)) - * if py_sess._kbd_callback is None: # <<<<<<<<<<<<<< - * return - * cdef bytes b_password = to_bytes(py_sess._kbd_callback()) + /* "ssh2/session.pyx":66 + * + * cdef class MethodType: + * def __cinit__(self, value): # <<<<<<<<<<<<<< + * self.value = value + * */ - __pyx_t_3 = (__pyx_v_py_sess->_kbd_callback == Py_None); - __pyx_t_4 = (__pyx_t_3 != 0); - if (__pyx_t_4) { - /* "ssh2/session.pyx":73 - * py_sess = (c_dereference(abstract)) - * if py_sess._kbd_callback is None: - * return # <<<<<<<<<<<<<< - * cdef bytes b_password = to_bytes(py_sess._kbd_callback()) - * cdef size_t _len = len(b_password) - */ - goto __pyx_L0; + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("ssh2.session.MethodType.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "ssh2/session.pyx":72 - * void **abstract) except *: - * py_sess = (c_dereference(abstract)) - * if py_sess._kbd_callback is None: # <<<<<<<<<<<<<< - * return - * cdef bytes b_password = to_bytes(py_sess._kbd_callback()) +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): */ - } - /* "ssh2/session.pyx":74 - * if py_sess._kbd_callback is None: - * return - * cdef bytes b_password = to_bytes(py_sess._kbd_callback()) # <<<<<<<<<<<<<< - * cdef size_t _len = len(b_password) - * cdef char *_password = b_password +/* Python wrapper */ +static PyObject *__pyx_pw_4ssh2_7session_10MethodType_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_4ssh2_7session_10MethodType_2__reduce_cython__[] = "MethodType.__reduce_cython__(self)"; +static PyObject *__pyx_pw_4ssh2_7session_10MethodType_3__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_10MethodType_2__reduce_cython__(((struct __pyx_obj_4ssh2_7session_MethodType *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_4ssh2_7session_10MethodType_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4ssh2_7session_MethodType *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("ssh2.session.MethodType.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_4ssh2_7session_10MethodType_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static char __pyx_doc_4ssh2_7session_10MethodType_4__setstate_cython__[] = "MethodType.__setstate_cython__(self, __pyx_state)"; +static PyObject *__pyx_pw_4ssh2_7session_10MethodType_5__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_10MethodType_4__setstate_cython__(((struct __pyx_obj_4ssh2_7session_MethodType *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_4ssh2_7session_10MethodType_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4ssh2_7session_MethodType *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("ssh2.session.MethodType.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ssh2/session.pyx":83 + * + * + * cdef void kbd_callback(const char *name, int name_len, # <<<<<<<<<<<<<< + * const char *instruction, int instruction_len, + * int num_prompts, + */ + +static void __pyx_f_4ssh2_7session_kbd_callback(CYTHON_UNUSED char const *__pyx_v_name, CYTHON_UNUSED int __pyx_v_name_len, CYTHON_UNUSED char const *__pyx_v_instruction, CYTHON_UNUSED int __pyx_v_instruction_len, int __pyx_v_num_prompts, CYTHON_UNUSED LIBSSH2_USERAUTH_KBDINT_PROMPT const *__pyx_v_prompts, LIBSSH2_USERAUTH_KBDINT_RESPONSE *__pyx_v_responses, void **__pyx_v_abstract) { + struct __pyx_obj_4ssh2_7session_Session *__pyx_v_py_sess = NULL; + PyObject *__pyx_v_b_password = 0; + size_t __pyx_v__len; + char *__pyx_v__password; + char *__pyx_v__password_copy; + size_t __pyx_v_i; + __Pyx_RefNannyDeclarations + void *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + Py_ssize_t __pyx_t_7; + char *__pyx_t_8; + size_t __pyx_t_9; + size_t __pyx_t_10; + size_t __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("kbd_callback", 0); + + /* "ssh2/session.pyx":89 + * c_ssh2.LIBSSH2_USERAUTH_KBDINT_RESPONSE *responses, + * void **abstract) except *: + * py_sess = (c_dereference(abstract)) # <<<<<<<<<<<<<< + * if py_sess._kbd_callback is None: + * return + */ + __pyx_t_1 = (*__pyx_v_abstract); + __pyx_t_2 = ((PyObject *)__pyx_t_1); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_py_sess = ((struct __pyx_obj_4ssh2_7session_Session *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "ssh2/session.pyx":90 + * void **abstract) except *: + * py_sess = (c_dereference(abstract)) + * if py_sess._kbd_callback is None: # <<<<<<<<<<<<<< + * return + * cdef bytes b_password = to_bytes(py_sess._kbd_callback()) + */ + __pyx_t_3 = (__pyx_v_py_sess->_kbd_callback == Py_None); + __pyx_t_4 = (__pyx_t_3 != 0); + if (__pyx_t_4) { + + /* "ssh2/session.pyx":91 + * py_sess = (c_dereference(abstract)) + * if py_sess._kbd_callback is None: + * return # <<<<<<<<<<<<<< + * cdef bytes b_password = to_bytes(py_sess._kbd_callback()) + * cdef size_t _len = len(b_password) + */ + goto __pyx_L0; + + /* "ssh2/session.pyx":90 + * void **abstract) except *: + * py_sess = (c_dereference(abstract)) + * if py_sess._kbd_callback is None: # <<<<<<<<<<<<<< + * return + * cdef bytes b_password = to_bytes(py_sess._kbd_callback()) + */ + } + + /* "ssh2/session.pyx":92 + * if py_sess._kbd_callback is None: + * return + * cdef bytes b_password = to_bytes(py_sess._kbd_callback()) # <<<<<<<<<<<<<< + * cdef size_t _len = len(b_password) + * cdef char *_password = b_password */ __Pyx_INCREF(__pyx_v_py_sess->_kbd_callback); __pyx_t_5 = __pyx_v_py_sess->_kbd_callback; __pyx_t_6 = NULL; @@ -1900,16 +2182,16 @@ static void __pyx_f_4ssh2_7session_kbd_callback(CYTHON_UNUSED char const *__pyx_ } __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 74, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 74, __pyx_L1_error) + __pyx_t_5 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_b_password = ((PyObject*)__pyx_t_5); __pyx_t_5 = 0; - /* "ssh2/session.pyx":75 + /* "ssh2/session.pyx":93 * return * cdef bytes b_password = to_bytes(py_sess._kbd_callback()) * cdef size_t _len = len(b_password) # <<<<<<<<<<<<<< @@ -1918,12 +2200,12 @@ static void __pyx_f_4ssh2_7session_kbd_callback(CYTHON_UNUSED char const *__pyx_ */ if (unlikely(__pyx_v_b_password == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 75, __pyx_L1_error) + __PYX_ERR(1, 93, __pyx_L1_error) } - __pyx_t_7 = PyBytes_GET_SIZE(__pyx_v_b_password); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 75, __pyx_L1_error) + __pyx_t_7 = PyBytes_GET_SIZE(__pyx_v_b_password); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(1, 93, __pyx_L1_error) __pyx_v__len = __pyx_t_7; - /* "ssh2/session.pyx":76 + /* "ssh2/session.pyx":94 * cdef bytes b_password = to_bytes(py_sess._kbd_callback()) * cdef size_t _len = len(b_password) * cdef char *_password = b_password # <<<<<<<<<<<<<< @@ -1932,12 +2214,12 @@ static void __pyx_f_4ssh2_7session_kbd_callback(CYTHON_UNUSED char const *__pyx_ */ if (unlikely(__pyx_v_b_password == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 76, __pyx_L1_error) + __PYX_ERR(1, 94, __pyx_L1_error) } - __pyx_t_8 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_password); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 76, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_password); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(1, 94, __pyx_L1_error) __pyx_v__password = __pyx_t_8; - /* "ssh2/session.pyx":78 + /* "ssh2/session.pyx":96 * cdef char *_password = b_password * cdef char *_password_copy * if num_prompts == 1: # <<<<<<<<<<<<<< @@ -1947,7 +2229,7 @@ static void __pyx_f_4ssh2_7session_kbd_callback(CYTHON_UNUSED char const *__pyx_ __pyx_t_4 = ((__pyx_v_num_prompts == 1) != 0); if (__pyx_t_4) { - /* "ssh2/session.pyx":79 + /* "ssh2/session.pyx":97 * cdef char *_password_copy * if num_prompts == 1: * _password_copy = malloc(sizeof(char) * _len) # <<<<<<<<<<<<<< @@ -1956,7 +2238,7 @@ static void __pyx_f_4ssh2_7session_kbd_callback(CYTHON_UNUSED char const *__pyx_ */ __pyx_v__password_copy = ((char *)malloc(((sizeof(char)) * __pyx_v__len))); - /* "ssh2/session.pyx":80 + /* "ssh2/session.pyx":98 * if num_prompts == 1: * _password_copy = malloc(sizeof(char) * _len) * for i in range(_len): # <<<<<<<<<<<<<< @@ -1968,7 +2250,7 @@ static void __pyx_f_4ssh2_7session_kbd_callback(CYTHON_UNUSED char const *__pyx_ for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; - /* "ssh2/session.pyx":81 + /* "ssh2/session.pyx":99 * _password_copy = malloc(sizeof(char) * _len) * for i in range(_len): * _password_copy[i] = _password[i] # <<<<<<<<<<<<<< @@ -1978,7 +2260,7 @@ static void __pyx_f_4ssh2_7session_kbd_callback(CYTHON_UNUSED char const *__pyx_ (__pyx_v__password_copy[__pyx_v_i]) = (__pyx_v__password[__pyx_v_i]); } - /* "ssh2/session.pyx":82 + /* "ssh2/session.pyx":100 * for i in range(_len): * _password_copy[i] = _password[i] * responses[0].text = _password_copy # <<<<<<<<<<<<<< @@ -1987,7 +2269,7 @@ static void __pyx_f_4ssh2_7session_kbd_callback(CYTHON_UNUSED char const *__pyx_ */ (__pyx_v_responses[0]).text = __pyx_v__password_copy; - /* "ssh2/session.pyx":83 + /* "ssh2/session.pyx":101 * _password_copy[i] = _password[i] * responses[0].text = _password_copy * responses[0].length = _len # <<<<<<<<<<<<<< @@ -1996,7 +2278,7 @@ static void __pyx_f_4ssh2_7session_kbd_callback(CYTHON_UNUSED char const *__pyx_ */ (__pyx_v_responses[0]).length = __pyx_v__len; - /* "ssh2/session.pyx":78 + /* "ssh2/session.pyx":96 * cdef char *_password = b_password * cdef char *_password_copy * if num_prompts == 1: # <<<<<<<<<<<<<< @@ -2005,7 +2287,7 @@ static void __pyx_f_4ssh2_7session_kbd_callback(CYTHON_UNUSED char const *__pyx_ */ } - /* "ssh2/session.pyx":65 + /* "ssh2/session.pyx":83 * * * cdef void kbd_callback(const char *name, int name_len, # <<<<<<<<<<<<<< @@ -2026,7 +2308,7 @@ static void __pyx_f_4ssh2_7session_kbd_callback(CYTHON_UNUSED char const *__pyx_ __Pyx_RefNannyFinishContext(); } -/* "ssh2/session.pyx":90 +/* "ssh2/session.pyx":108 * """LibSSH2 Session class providing session functions""" * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -2059,7 +2341,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":91 + /* "ssh2/session.pyx":109 * * def __cinit__(self): * self._session = c_ssh2.libssh2_session_init_ex( # <<<<<<<<<<<<<< @@ -2068,7 +2350,7 @@ static int __pyx_pf_4ssh2_7session_7Session___cinit__(struct __pyx_obj_4ssh2_7se */ __pyx_v_self->_session = libssh2_session_init_ex(NULL, NULL, NULL, ((void *)__pyx_v_self)); - /* "ssh2/session.pyx":93 + /* "ssh2/session.pyx":111 * self._session = c_ssh2.libssh2_session_init_ex( * NULL, NULL, NULL, self) * if self._session is NULL: # <<<<<<<<<<<<<< @@ -2078,16 +2360,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":94 + /* "ssh2/session.pyx":112 * NULL, NULL, NULL, self) * if self._session is NULL: * raise MemoryError # <<<<<<<<<<<<<< * self._sock = 0 * self.sock = None */ - PyErr_NoMemory(); __PYX_ERR(0, 94, __pyx_L1_error) + PyErr_NoMemory(); __PYX_ERR(1, 112, __pyx_L1_error) - /* "ssh2/session.pyx":93 + /* "ssh2/session.pyx":111 * self._session = c_ssh2.libssh2_session_init_ex( * NULL, NULL, NULL, self) * if self._session is NULL: # <<<<<<<<<<<<<< @@ -2096,7 +2378,7 @@ static int __pyx_pf_4ssh2_7session_7Session___cinit__(struct __pyx_obj_4ssh2_7se */ } - /* "ssh2/session.pyx":95 + /* "ssh2/session.pyx":113 * if self._session is NULL: * raise MemoryError * self._sock = 0 # <<<<<<<<<<<<<< @@ -2105,7 +2387,7 @@ static int __pyx_pf_4ssh2_7session_7Session___cinit__(struct __pyx_obj_4ssh2_7se */ __pyx_v_self->_sock = 0; - /* "ssh2/session.pyx":96 + /* "ssh2/session.pyx":114 * raise MemoryError * self._sock = 0 * self.sock = None # <<<<<<<<<<<<<< @@ -2118,7 +2400,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":97 + /* "ssh2/session.pyx":115 * self._sock = 0 * self.sock = None * self._kbd_callback = None # <<<<<<<<<<<<<< @@ -2131,7 +2413,7 @@ static int __pyx_pf_4ssh2_7session_7Session___cinit__(struct __pyx_obj_4ssh2_7se __Pyx_DECREF(__pyx_v_self->_kbd_callback); __pyx_v_self->_kbd_callback = Py_None; - /* "ssh2/session.pyx":90 + /* "ssh2/session.pyx":108 * """LibSSH2 Session class providing session functions""" * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -2150,7 +2432,7 @@ static int __pyx_pf_4ssh2_7session_7Session___cinit__(struct __pyx_obj_4ssh2_7se return __pyx_r; } -/* "ssh2/session.pyx":99 +/* "ssh2/session.pyx":117 * self._kbd_callback = None * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -2174,7 +2456,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":100 + /* "ssh2/session.pyx":118 * * def __dealloc__(self): * if self._session is not NULL: # <<<<<<<<<<<<<< @@ -2184,7 +2466,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":101 + /* "ssh2/session.pyx":119 * def __dealloc__(self): * if self._session is not NULL: * c_ssh2.libssh2_session_free(self._session) # <<<<<<<<<<<<<< @@ -2193,7 +2475,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":100 + /* "ssh2/session.pyx":118 * * def __dealloc__(self): * if self._session is not NULL: # <<<<<<<<<<<<<< @@ -2202,7 +2484,7 @@ static void __pyx_pf_4ssh2_7session_7Session_2__dealloc__(struct __pyx_obj_4ssh2 */ } - /* "ssh2/session.pyx":102 + /* "ssh2/session.pyx":120 * if self._session is not NULL: * c_ssh2.libssh2_session_free(self._session) * self._session = NULL # <<<<<<<<<<<<<< @@ -2211,7 +2493,7 @@ static void __pyx_pf_4ssh2_7session_7Session_2__dealloc__(struct __pyx_obj_4ssh2 */ __pyx_v_self->_session = NULL; - /* "ssh2/session.pyx":99 + /* "ssh2/session.pyx":117 * self._kbd_callback = None * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -2223,7 +2505,7 @@ static void __pyx_pf_4ssh2_7session_7Session_2__dealloc__(struct __pyx_obj_4ssh2 __Pyx_RefNannyFinishContext(); } -/* "ssh2/session.pyx":104 +/* "ssh2/session.pyx":122 * self._session = NULL * * def disconnect(self): # <<<<<<<<<<<<<< @@ -2256,7 +2538,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_4disconnect(struct __pyx_obj_4 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("disconnect", 0); - /* "ssh2/session.pyx":106 + /* "ssh2/session.pyx":124 * def disconnect(self): * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -2271,7 +2553,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_4disconnect(struct __pyx_obj_4 #endif /*try:*/ { - /* "ssh2/session.pyx":107 + /* "ssh2/session.pyx":125 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_session_disconnect(self._session, b"end") # <<<<<<<<<<<<<< @@ -2281,7 +2563,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":106 + /* "ssh2/session.pyx":124 * def disconnect(self): * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -2300,7 +2582,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_4disconnect(struct __pyx_obj_4 } } - /* "ssh2/session.pyx":108 + /* "ssh2/session.pyx":126 * with nogil: * rc = c_ssh2.libssh2_session_disconnect(self._session, b"end") * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -2308,14 +2590,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, 108, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __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(1, 126, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":104 + /* "ssh2/session.pyx":122 * self._session = NULL * * def disconnect(self): # <<<<<<<<<<<<<< @@ -2334,7 +2616,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_4disconnect(struct __pyx_obj_4 return __pyx_r; } -/* "ssh2/session.pyx":110 +/* "ssh2/session.pyx":128 * return handle_error_codes(rc) * * def handshake(self, sock not None): # <<<<<<<<<<<<<< @@ -2353,7 +2635,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, 110, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sock"); __PYX_ERR(1, 128, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_6handshake(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), ((PyObject *)__pyx_v_sock)); @@ -2378,17 +2660,17 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("handshake", 0); - /* "ssh2/session.pyx":114 + /* "ssh2/session.pyx":132 * * 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, 114, __pyx_L1_error) + __pyx_t_1 = PyObject_AsFileDescriptor(__pyx_v_sock); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 132, __pyx_L1_error) __pyx_v__sock = __pyx_t_1; - /* "ssh2/session.pyx":116 + /* "ssh2/session.pyx":134 * cdef int _sock = PyObject_AsFileDescriptor(sock) * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -2403,7 +2685,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4s #endif /*try:*/ { - /* "ssh2/session.pyx":117 + /* "ssh2/session.pyx":135 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_session_handshake(self._session, _sock) # <<<<<<<<<<<<<< @@ -2412,7 +2694,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":118 + /* "ssh2/session.pyx":136 * with nogil: * rc = c_ssh2.libssh2_session_handshake(self._session, _sock) * self._sock = _sock # <<<<<<<<<<<<<< @@ -2422,7 +2704,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4s __pyx_v_self->_sock = __pyx_v__sock; } - /* "ssh2/session.pyx":116 + /* "ssh2/session.pyx":134 * cdef int _sock = PyObject_AsFileDescriptor(sock) * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -2441,7 +2723,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4s } } - /* "ssh2/session.pyx":119 + /* "ssh2/session.pyx":137 * rc = c_ssh2.libssh2_session_handshake(self._session, _sock) * self._sock = _sock * self.sock = sock # <<<<<<<<<<<<<< @@ -2454,7 +2736,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":120 + /* "ssh2/session.pyx":138 * self._sock = _sock * self.sock = sock * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -2462,14 +2744,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, 120, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __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(1, 138, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":110 + /* "ssh2/session.pyx":128 * return handle_error_codes(rc) * * def handshake(self, sock not None): # <<<<<<<<<<<<<< @@ -2488,7 +2770,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4s return __pyx_r; } -/* "ssh2/session.pyx":122 +/* "ssh2/session.pyx":140 * return handle_error_codes(rc) * * def startup(self, sock): # <<<<<<<<<<<<<< @@ -2522,17 +2804,17 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_8startup(struct __pyx_obj_4ssh int __pyx_clineno = 0; __Pyx_RefNannySetupContext("startup", 0); - /* "ssh2/session.pyx":124 + /* "ssh2/session.pyx":142 * 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, 124, __pyx_L1_error) + __pyx_t_1 = PyObject_AsFileDescriptor(__pyx_v_sock); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 142, __pyx_L1_error) __pyx_v__sock = __pyx_t_1; - /* "ssh2/session.pyx":126 + /* "ssh2/session.pyx":144 * cdef int _sock = PyObject_AsFileDescriptor(sock) * cdef int rc * rc = c_ssh2.libssh2_session_startup(self._session, _sock) # <<<<<<<<<<<<<< @@ -2541,7 +2823,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":127 + /* "ssh2/session.pyx":145 * cdef int rc * rc = c_ssh2.libssh2_session_startup(self._session, _sock) * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -2549,14 +2831,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, 127, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 127, __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(1, 145, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":122 + /* "ssh2/session.pyx":140 * return handle_error_codes(rc) * * def startup(self, sock): # <<<<<<<<<<<<<< @@ -2575,7 +2857,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_8startup(struct __pyx_obj_4ssh return __pyx_r; } -/* "ssh2/session.pyx":129 +/* "ssh2/session.pyx":147 * return handle_error_codes(rc) * * def set_blocking(self, bint blocking): # <<<<<<<<<<<<<< @@ -2595,7 +2877,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, 129, __pyx_L3_error) + __pyx_v_blocking = __Pyx_PyObject_IsTrue(__pyx_arg_blocking); if (unlikely((__pyx_v_blocking == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 147, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -2615,7 +2897,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_10set_blocking(struct __pyx_ob __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_blocking", 0); - /* "ssh2/session.pyx":135 + /* "ssh2/session.pyx":153 * Session default is blocking unless set otherwise. * :type blocking: bool""" * with nogil: # <<<<<<<<<<<<<< @@ -2630,7 +2912,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_10set_blocking(struct __pyx_ob #endif /*try:*/ { - /* "ssh2/session.pyx":136 + /* "ssh2/session.pyx":154 * :type blocking: bool""" * with nogil: * c_ssh2.libssh2_session_set_blocking( # <<<<<<<<<<<<<< @@ -2640,7 +2922,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":135 + /* "ssh2/session.pyx":153 * Session default is blocking unless set otherwise. * :type blocking: bool""" * with nogil: # <<<<<<<<<<<<<< @@ -2659,7 +2941,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_10set_blocking(struct __pyx_ob } } - /* "ssh2/session.pyx":129 + /* "ssh2/session.pyx":147 * return handle_error_codes(rc) * * def set_blocking(self, bint blocking): # <<<<<<<<<<<<<< @@ -2674,7 +2956,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_10set_blocking(struct __pyx_ob return __pyx_r; } -/* "ssh2/session.pyx":139 +/* "ssh2/session.pyx":157 * self._session, blocking) * * def get_blocking(self): # <<<<<<<<<<<<<< @@ -2707,7 +2989,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":144 + /* "ssh2/session.pyx":162 * :rtype: bool""" * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -2722,7 +3004,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_12get_blocking(struct __pyx_ob #endif /*try:*/ { - /* "ssh2/session.pyx":145 + /* "ssh2/session.pyx":163 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_session_get_blocking(self._session) # <<<<<<<<<<<<<< @@ -2732,7 +3014,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":144 + /* "ssh2/session.pyx":162 * :rtype: bool""" * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -2751,7 +3033,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_12get_blocking(struct __pyx_ob } } - /* "ssh2/session.pyx":146 + /* "ssh2/session.pyx":164 * with nogil: * rc = c_ssh2.libssh2_session_get_blocking(self._session) * return bool(rc) # <<<<<<<<<<<<<< @@ -2759,17 +3041,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, 146, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 164, __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, 146, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 164, __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, 146, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBool_FromLong((!(!__pyx_t_2))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":139 + /* "ssh2/session.pyx":157 * self._session, blocking) * * def get_blocking(self): # <<<<<<<<<<<<<< @@ -2788,7 +3070,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_12get_blocking(struct __pyx_ob return __pyx_r; } -/* "ssh2/session.pyx":148 +/* "ssh2/session.pyx":166 * return bool(rc) * * def set_timeout(self, long timeout): # <<<<<<<<<<<<<< @@ -2808,7 +3090,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, 148, __pyx_L3_error) + __pyx_v_timeout = __Pyx_PyInt_As_long(__pyx_arg_timeout); if (unlikely((__pyx_v_timeout == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 166, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -2828,7 +3110,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_14set_timeout(struct __pyx_obj __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_timeout", 0); - /* "ssh2/session.pyx":156 + /* "ssh2/session.pyx":174 * time out. * :param timeout: Milliseconds to wait before timeout.""" * with nogil: # <<<<<<<<<<<<<< @@ -2843,7 +3125,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_14set_timeout(struct __pyx_obj #endif /*try:*/ { - /* "ssh2/session.pyx":157 + /* "ssh2/session.pyx":175 * :param timeout: Milliseconds to wait before timeout.""" * with nogil: * c_ssh2.libssh2_session_set_timeout(self._session, timeout) # <<<<<<<<<<<<<< @@ -2853,7 +3135,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":156 + /* "ssh2/session.pyx":174 * time out. * :param timeout: Milliseconds to wait before timeout.""" * with nogil: # <<<<<<<<<<<<<< @@ -2872,7 +3154,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_14set_timeout(struct __pyx_obj } } - /* "ssh2/session.pyx":148 + /* "ssh2/session.pyx":166 * return bool(rc) * * def set_timeout(self, long timeout): # <<<<<<<<<<<<<< @@ -2887,7 +3169,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_14set_timeout(struct __pyx_obj return __pyx_r; } -/* "ssh2/session.pyx":159 +/* "ssh2/session.pyx":177 * c_ssh2.libssh2_session_set_timeout(self._session, timeout) * * def get_timeout(self): # <<<<<<<<<<<<<< @@ -2919,7 +3201,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":162 + /* "ssh2/session.pyx":180 * """Get current session timeout setting""" * cdef long timeout * with nogil: # <<<<<<<<<<<<<< @@ -2934,7 +3216,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_16get_timeout(struct __pyx_obj #endif /*try:*/ { - /* "ssh2/session.pyx":163 + /* "ssh2/session.pyx":181 * cdef long timeout * with nogil: * timeout = c_ssh2.libssh2_session_get_timeout(self._session) # <<<<<<<<<<<<<< @@ -2944,7 +3226,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":162 + /* "ssh2/session.pyx":180 * """Get current session timeout setting""" * cdef long timeout * with nogil: # <<<<<<<<<<<<<< @@ -2963,7 +3245,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_16get_timeout(struct __pyx_obj } } - /* "ssh2/session.pyx":164 + /* "ssh2/session.pyx":182 * with nogil: * timeout = c_ssh2.libssh2_session_get_timeout(self._session) * return timeout # <<<<<<<<<<<<<< @@ -2971,13 +3253,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, 164, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_timeout); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":159 + /* "ssh2/session.pyx":177 * c_ssh2.libssh2_session_set_timeout(self._session, timeout) * * def get_timeout(self): # <<<<<<<<<<<<<< @@ -2996,7 +3278,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_16get_timeout(struct __pyx_obj return __pyx_r; } -/* "ssh2/session.pyx":166 +/* "ssh2/session.pyx":184 * return timeout * * def userauth_authenticated(self): # <<<<<<<<<<<<<< @@ -3029,7 +3311,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_18userauth_authenticated(struc int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_authenticated", 0); - /* "ssh2/session.pyx":171 + /* "ssh2/session.pyx":189 * :rtype: bool""" * cdef bint rc * with nogil: # <<<<<<<<<<<<<< @@ -3044,7 +3326,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_18userauth_authenticated(struc #endif /*try:*/ { - /* "ssh2/session.pyx":172 + /* "ssh2/session.pyx":190 * cdef bint rc * with nogil: * rc = c_ssh2.libssh2_userauth_authenticated(self._session) # <<<<<<<<<<<<<< @@ -3054,7 +3336,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_18userauth_authenticated(struc __pyx_v_rc = libssh2_userauth_authenticated(__pyx_v_self->_session); } - /* "ssh2/session.pyx":171 + /* "ssh2/session.pyx":189 * :rtype: bool""" * cdef bint rc * with nogil: # <<<<<<<<<<<<<< @@ -3073,7 +3355,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_18userauth_authenticated(struc } } - /* "ssh2/session.pyx":173 + /* "ssh2/session.pyx":191 * with nogil: * rc = c_ssh2.libssh2_userauth_authenticated(self._session) * return bool(rc) # <<<<<<<<<<<<<< @@ -3082,13 +3364,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, 173, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBool_FromLong((!(!__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 191, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":166 + /* "ssh2/session.pyx":184 * return timeout * * def userauth_authenticated(self): # <<<<<<<<<<<<<< @@ -3107,7 +3389,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_18userauth_authenticated(struc return __pyx_r; } -/* "ssh2/session.pyx":175 +/* "ssh2/session.pyx":193 * return bool(rc) * * def userauth_list(self, username not None): # <<<<<<<<<<<<<< @@ -3126,7 +3408,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, 175, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(1, 193, __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)); @@ -3156,19 +3438,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":179 + /* "ssh2/session.pyx":197 * * :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, 179, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":180 + /* "ssh2/session.pyx":198 * :rtype: list""" * cdef bytes b_username = to_bytes(username) * cdef char *_username = b_username # <<<<<<<<<<<<<< @@ -3177,12 +3459,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, 180, __pyx_L1_error) + __PYX_ERR(1, 198, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 198, __pyx_L1_error) __pyx_v__username = __pyx_t_2; - /* "ssh2/session.pyx":181 + /* "ssh2/session.pyx":199 * cdef bytes b_username = to_bytes(username) * cdef char *_username = b_username * cdef size_t username_len = len(b_username) # <<<<<<<<<<<<<< @@ -3191,12 +3473,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, 181, __pyx_L1_error) + __PYX_ERR(1, 199, __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, 181, __pyx_L1_error) + __pyx_t_3 = PyBytes_GET_SIZE(__pyx_v_b_username); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 199, __pyx_L1_error) __pyx_v_username_len = __pyx_t_3; - /* "ssh2/session.pyx":184 + /* "ssh2/session.pyx":202 * cdef char *_auth * cdef str auth * with nogil: # <<<<<<<<<<<<<< @@ -3211,7 +3493,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o #endif /*try:*/ { - /* "ssh2/session.pyx":185 + /* "ssh2/session.pyx":203 * cdef str auth * with nogil: * _auth = c_ssh2.libssh2_userauth_list( # <<<<<<<<<<<<<< @@ -3221,7 +3503,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":184 + /* "ssh2/session.pyx":202 * cdef char *_auth * cdef str auth * with nogil: # <<<<<<<<<<<<<< @@ -3240,7 +3522,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o } } - /* "ssh2/session.pyx":187 + /* "ssh2/session.pyx":205 * _auth = c_ssh2.libssh2_userauth_list( * self._session, _username, username_len) * if _auth is NULL: # <<<<<<<<<<<<<< @@ -3250,7 +3532,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":188 + /* "ssh2/session.pyx":206 * self._session, _username, username_len) * if _auth is NULL: * return # <<<<<<<<<<<<<< @@ -3261,7 +3543,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":187 + /* "ssh2/session.pyx":205 * _auth = c_ssh2.libssh2_userauth_list( * self._session, _username, username_len) * if _auth is NULL: # <<<<<<<<<<<<<< @@ -3270,20 +3552,20 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o */ } - /* "ssh2/session.pyx":189 + /* "ssh2/session.pyx":207 * 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, 189, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_str(__pyx_v__auth); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 207, __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, 189, __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(1, 207, __pyx_L1_error) __pyx_v_auth = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":190 + /* "ssh2/session.pyx":208 * return * auth = to_str(_auth) * return auth.split(',') # <<<<<<<<<<<<<< @@ -3291,13 +3573,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, 190, __pyx_L1_error) + __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_split, __pyx_v_auth, __pyx_kp_s__3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":175 + /* "ssh2/session.pyx":193 * return bool(rc) * * def userauth_list(self, username not None): # <<<<<<<<<<<<<< @@ -3318,7 +3600,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o return __pyx_r; } -/* "ssh2/session.pyx":192 +/* "ssh2/session.pyx":210 * return auth.split(',') * * def userauth_publickey_fromfile(self, username not None, # <<<<<<<<<<<<<< @@ -3343,9 +3625,9 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_23userauth_publickey_fromfile( { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_username,&__pyx_n_s_privatekey,&__pyx_n_s_passphrase,&__pyx_n_s_publickey,0}; PyObject* values[4] = {0,0,0,0}; - values[2] = ((PyObject *)__pyx_kp_s__2); + values[2] = ((PyObject *)__pyx_kp_s__4); - /* "ssh2/session.pyx":195 + /* "ssh2/session.pyx":213 * privatekey not None, * passphrase='', * publickey=None): # <<<<<<<<<<<<<< @@ -3377,7 +3659,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, 192, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_publickey_fromfile", 0, 2, 4, 1); __PYX_ERR(1, 210, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -3393,7 +3675,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, 192, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_publickey_fromfile") < 0)) __PYX_ERR(1, 210, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3414,21 +3696,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, 192, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_publickey_fromfile", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 210, __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, 192, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(1, 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, 193, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "privatekey"); __PYX_ERR(1, 211, __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":192 + /* "ssh2/session.pyx":210 * return auth.split(',') * * def userauth_publickey_fromfile(self, username not None, # <<<<<<<<<<<<<< @@ -3468,19 +3750,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_publickey_fromfile", 0); - /* "ssh2/session.pyx":200 + /* "ssh2/session.pyx":218 * :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, 200, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":202 + /* "ssh2/session.pyx":220 * cdef bytes b_username = to_bytes(username) * cdef bytes b_publickey = to_bytes(publickey) \ * if publickey is not None else None # <<<<<<<<<<<<<< @@ -3490,20 +3772,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":201 + /* "ssh2/session.pyx":219 * 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, 201, __pyx_L1_error) + __pyx_t_3 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_publickey); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 219, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; } else { - /* "ssh2/session.pyx":202 + /* "ssh2/session.pyx":220 * cdef bytes b_username = to_bytes(username) * cdef bytes b_publickey = to_bytes(publickey) \ * if publickey is not None else None # <<<<<<<<<<<<<< @@ -3516,31 +3798,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":203 + /* "ssh2/session.pyx":221 * 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, 203, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_privatekey); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_privatekey = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":204 + /* "ssh2/session.pyx":222 * 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, 204, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_passphrase); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_passphrase = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":205 + /* "ssh2/session.pyx":223 * cdef bytes b_privatekey = to_bytes(privatekey) * cdef bytes b_passphrase = to_bytes(passphrase) * cdef char *_username = b_username # <<<<<<<<<<<<<< @@ -3549,12 +3831,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, 205, __pyx_L1_error) + __PYX_ERR(1, 223, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 223, __pyx_L1_error) __pyx_v__username = __pyx_t_4; - /* "ssh2/session.pyx":206 + /* "ssh2/session.pyx":224 * cdef bytes b_passphrase = to_bytes(passphrase) * cdef char *_username = b_username * cdef char *_publickey = NULL # <<<<<<<<<<<<<< @@ -3563,7 +3845,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( */ __pyx_v__publickey = NULL; - /* "ssh2/session.pyx":207 + /* "ssh2/session.pyx":225 * cdef char *_username = b_username * cdef char *_publickey = NULL * cdef char *_privatekey = b_privatekey # <<<<<<<<<<<<<< @@ -3572,12 +3854,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, 207, __pyx_L1_error) + __PYX_ERR(1, 225, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_privatekey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_privatekey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 225, __pyx_L1_error) __pyx_v__privatekey = __pyx_t_4; - /* "ssh2/session.pyx":208 + /* "ssh2/session.pyx":226 * cdef char *_publickey = NULL * cdef char *_privatekey = b_privatekey * cdef char *_passphrase = b_passphrase # <<<<<<<<<<<<<< @@ -3586,12 +3868,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, 208, __pyx_L1_error) + __PYX_ERR(1, 226, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_passphrase); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_passphrase); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 226, __pyx_L1_error) __pyx_v__passphrase = __pyx_t_4; - /* "ssh2/session.pyx":209 + /* "ssh2/session.pyx":227 * cdef char *_privatekey = b_privatekey * cdef char *_passphrase = b_passphrase * if b_publickey is not None: # <<<<<<<<<<<<<< @@ -3602,7 +3884,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":210 + /* "ssh2/session.pyx":228 * cdef char *_passphrase = b_passphrase * if b_publickey is not None: * _publickey = b_publickey # <<<<<<<<<<<<<< @@ -3611,12 +3893,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, 210, __pyx_L1_error) + __PYX_ERR(1, 228, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_publickey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 210, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_publickey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 228, __pyx_L1_error) __pyx_v__publickey = __pyx_t_4; - /* "ssh2/session.pyx":209 + /* "ssh2/session.pyx":227 * cdef char *_privatekey = b_privatekey * cdef char *_passphrase = b_passphrase * if b_publickey is not None: # <<<<<<<<<<<<<< @@ -3625,7 +3907,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( */ } - /* "ssh2/session.pyx":211 + /* "ssh2/session.pyx":229 * if b_publickey is not None: * _publickey = b_publickey * with nogil: # <<<<<<<<<<<<<< @@ -3640,7 +3922,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( #endif /*try:*/ { - /* "ssh2/session.pyx":212 + /* "ssh2/session.pyx":230 * _publickey = b_publickey * with nogil: * rc = c_ssh2.libssh2_userauth_publickey_fromfile( # <<<<<<<<<<<<<< @@ -3650,7 +3932,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":211 + /* "ssh2/session.pyx":229 * if b_publickey is not None: * _publickey = b_publickey * with nogil: # <<<<<<<<<<<<<< @@ -3669,7 +3951,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( } } - /* "ssh2/session.pyx":214 + /* "ssh2/session.pyx":232 * rc = c_ssh2.libssh2_userauth_publickey_fromfile( * self._session, _username, _publickey, _privatekey, _passphrase) * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -3677,14 +3959,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, 214, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 214, __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(1, 232, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":192 + /* "ssh2/session.pyx":210 * return auth.split(',') * * def userauth_publickey_fromfile(self, username not None, # <<<<<<<<<<<<<< @@ -3708,7 +3990,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( return __pyx_r; } -/* "ssh2/session.pyx":216 +/* "ssh2/session.pyx":234 * return handle_error_codes(rc) * * def userauth_publickey(self, username not None, # <<<<<<<<<<<<<< @@ -3751,11 +4033,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, 216, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_publickey", 1, 2, 2, 1); __PYX_ERR(1, 234, __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, 216, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_publickey") < 0)) __PYX_ERR(1, 234, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -3768,16 +4050,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, 216, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_publickey", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 234, __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, 216, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(1, 234, __pyx_L1_error) } - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pubkeydata), (&PyBytes_Type), 0, "pubkeydata", 1))) __PYX_ERR(0, 217, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pubkeydata), (&PyBytes_Type), 0, "pubkeydata", 1))) __PYX_ERR(1, 235, __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 */ @@ -3807,19 +4089,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_24userauth_publickey(struct __ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_publickey", 0); - /* "ssh2/session.pyx":227 + /* "ssh2/session.pyx":245 * :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, 227, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":228 + /* "ssh2/session.pyx":246 * cdef int rc * cdef bytes b_username = to_bytes(username) * cdef char *_username = b_username # <<<<<<<<<<<<<< @@ -3828,32 +4110,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, 228, __pyx_L1_error) + __PYX_ERR(1, 246, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 228, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 246, __pyx_L1_error) __pyx_v__username = __pyx_t_2; - /* "ssh2/session.pyx":229 + /* "ssh2/session.pyx":247 * 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, 229, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBytes_AsWritableUString(__pyx_v_pubkeydata); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(1, 247, __pyx_L1_error) __pyx_v__pubkeydata = __pyx_t_3; - /* "ssh2/session.pyx":230 + /* "ssh2/session.pyx":248 * 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, 230, __pyx_L1_error) + __pyx_t_4 = PyBytes_GET_SIZE(__pyx_v_pubkeydata); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 248, __pyx_L1_error) __pyx_v_pubkeydata_len = __pyx_t_4; - /* "ssh2/session.pyx":231 + /* "ssh2/session.pyx":249 * cdef unsigned char *_pubkeydata = pubkeydata * cdef size_t pubkeydata_len = len(pubkeydata) * with nogil: # <<<<<<<<<<<<<< @@ -3868,7 +4150,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_24userauth_publickey(struct __ #endif /*try:*/ { - /* "ssh2/session.pyx":232 + /* "ssh2/session.pyx":250 * cdef size_t pubkeydata_len = len(pubkeydata) * with nogil: * rc = c_ssh2.libssh2_userauth_publickey( # <<<<<<<<<<<<<< @@ -3878,7 +4160,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":231 + /* "ssh2/session.pyx":249 * cdef unsigned char *_pubkeydata = pubkeydata * cdef size_t pubkeydata_len = len(pubkeydata) * with nogil: # <<<<<<<<<<<<<< @@ -3897,7 +4179,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_24userauth_publickey(struct __ } } - /* "ssh2/session.pyx":235 + /* "ssh2/session.pyx":253 * self._session, _username, _pubkeydata, * pubkeydata_len, NULL, NULL) * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -3905,14 +4187,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, 235, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __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(1, 253, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 253, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":216 + /* "ssh2/session.pyx":234 * return handle_error_codes(rc) * * def userauth_publickey(self, username not None, # <<<<<<<<<<<<<< @@ -3932,7 +4214,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_24userauth_publickey(struct __ return __pyx_r; } -/* "ssh2/session.pyx":237 +/* "ssh2/session.pyx":255 * return handle_error_codes(rc) * * def userauth_hostbased_fromfile(self, # <<<<<<<<<<<<<< @@ -3959,7 +4241,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":241 + /* "ssh2/session.pyx":259 * privatekey not None, * hostname not None, * publickey=None, # <<<<<<<<<<<<<< @@ -3967,7 +4249,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_27userauth_hostbased_fromfile( * cdef int rc */ values[3] = ((PyObject *)Py_None); - values[4] = ((PyObject *)__pyx_kp_s__2); + values[4] = ((PyObject *)__pyx_kp_s__4); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); @@ -3994,13 +4276,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, 237, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_hostbased_fromfile", 0, 3, 5, 1); __PYX_ERR(1, 255, __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, 237, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_hostbased_fromfile", 0, 3, 5, 2); __PYX_ERR(1, 255, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: @@ -4016,7 +4298,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, 237, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_hostbased_fromfile") < 0)) __PYX_ERR(1, 255, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4039,24 +4321,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, 237, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_hostbased_fromfile", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 255, __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, 238, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(1, 256, __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, 239, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "privatekey"); __PYX_ERR(1, 257, __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, 240, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "hostname"); __PYX_ERR(1, 258, __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":237 + /* "ssh2/session.pyx":255 * return handle_error_codes(rc) * * def userauth_hostbased_fromfile(self, # <<<<<<<<<<<<<< @@ -4098,19 +4380,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_hostbased_fromfile", 0); - /* "ssh2/session.pyx":244 + /* "ssh2/session.pyx":262 * 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, 244, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 262, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":246 + /* "ssh2/session.pyx":264 * cdef bytes b_username = to_bytes(username) * cdef bytes b_publickey = to_bytes(publickey) \ * if publickey is not None else None # <<<<<<<<<<<<<< @@ -4120,20 +4402,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":245 + /* "ssh2/session.pyx":263 * 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, 245, __pyx_L1_error) + __pyx_t_3 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_publickey); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 263, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; } else { - /* "ssh2/session.pyx":246 + /* "ssh2/session.pyx":264 * cdef bytes b_username = to_bytes(username) * cdef bytes b_publickey = to_bytes(publickey) \ * if publickey is not None else None # <<<<<<<<<<<<<< @@ -4146,43 +4428,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":247 + /* "ssh2/session.pyx":265 * 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, 247, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_privatekey); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 265, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_privatekey = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":248 + /* "ssh2/session.pyx":266 * 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, 248, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_passphrase); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 266, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_passphrase = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":249 + /* "ssh2/session.pyx":267 * 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, 249, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_hostname); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 267, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_hostname = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":250 + /* "ssh2/session.pyx":268 * cdef bytes b_passphrase = to_bytes(passphrase) * cdef bytes b_hostname = to_bytes(hostname) * cdef char *_username = b_username # <<<<<<<<<<<<<< @@ -4191,12 +4473,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, 250, __pyx_L1_error) + __PYX_ERR(1, 268, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 250, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 268, __pyx_L1_error) __pyx_v__username = __pyx_t_4; - /* "ssh2/session.pyx":251 + /* "ssh2/session.pyx":269 * cdef bytes b_hostname = to_bytes(hostname) * cdef char *_username = b_username * cdef char *_publickey = NULL # <<<<<<<<<<<<<< @@ -4205,7 +4487,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( */ __pyx_v__publickey = NULL; - /* "ssh2/session.pyx":252 + /* "ssh2/session.pyx":270 * cdef char *_username = b_username * cdef char *_publickey = NULL * cdef char *_privatekey = b_privatekey # <<<<<<<<<<<<<< @@ -4214,12 +4496,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, 252, __pyx_L1_error) + __PYX_ERR(1, 270, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_privatekey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 252, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_privatekey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 270, __pyx_L1_error) __pyx_v__privatekey = __pyx_t_4; - /* "ssh2/session.pyx":253 + /* "ssh2/session.pyx":271 * cdef char *_publickey = NULL * cdef char *_privatekey = b_privatekey * cdef char *_passphrase = b_passphrase # <<<<<<<<<<<<<< @@ -4228,12 +4510,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, 253, __pyx_L1_error) + __PYX_ERR(1, 271, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_passphrase); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 253, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_passphrase); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 271, __pyx_L1_error) __pyx_v__passphrase = __pyx_t_4; - /* "ssh2/session.pyx":254 + /* "ssh2/session.pyx":272 * cdef char *_privatekey = b_privatekey * cdef char *_passphrase = b_passphrase * cdef char *_hostname = b_hostname # <<<<<<<<<<<<<< @@ -4242,12 +4524,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, 254, __pyx_L1_error) + __PYX_ERR(1, 272, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_hostname); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 254, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_hostname); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 272, __pyx_L1_error) __pyx_v__hostname = __pyx_t_4; - /* "ssh2/session.pyx":255 + /* "ssh2/session.pyx":273 * cdef char *_passphrase = b_passphrase * cdef char *_hostname = b_hostname * if b_publickey is not None: # <<<<<<<<<<<<<< @@ -4258,7 +4540,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":256 + /* "ssh2/session.pyx":274 * cdef char *_hostname = b_hostname * if b_publickey is not None: * _publickey = b_publickey # <<<<<<<<<<<<<< @@ -4267,12 +4549,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, 256, __pyx_L1_error) + __PYX_ERR(1, 274, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_publickey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 256, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_publickey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 274, __pyx_L1_error) __pyx_v__publickey = __pyx_t_4; - /* "ssh2/session.pyx":255 + /* "ssh2/session.pyx":273 * cdef char *_passphrase = b_passphrase * cdef char *_hostname = b_hostname * if b_publickey is not None: # <<<<<<<<<<<<<< @@ -4281,7 +4563,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( */ } - /* "ssh2/session.pyx":257 + /* "ssh2/session.pyx":275 * if b_publickey is not None: * _publickey = b_publickey * with nogil: # <<<<<<<<<<<<<< @@ -4296,7 +4578,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( #endif /*try:*/ { - /* "ssh2/session.pyx":258 + /* "ssh2/session.pyx":276 * _publickey = b_publickey * with nogil: * rc = c_ssh2.libssh2_userauth_hostbased_fromfile( # <<<<<<<<<<<<<< @@ -4306,7 +4588,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":257 + /* "ssh2/session.pyx":275 * if b_publickey is not None: * _publickey = b_publickey * with nogil: # <<<<<<<<<<<<<< @@ -4325,7 +4607,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( } } - /* "ssh2/session.pyx":261 + /* "ssh2/session.pyx":279 * self._session, _username, _publickey, * _privatekey, _passphrase, _hostname) * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -4333,14 +4615,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, 261, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __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(1, 279, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 279, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":237 + /* "ssh2/session.pyx":255 * return handle_error_codes(rc) * * def userauth_hostbased_fromfile(self, # <<<<<<<<<<<<<< @@ -4365,7 +4647,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( return __pyx_r; } -/* "ssh2/session.pyx":264 +/* "ssh2/session.pyx":282 * * IF EMBEDDED_LIB: * def userauth_publickey_frommemory( # <<<<<<<<<<<<<< @@ -4390,9 +4672,9 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_29userauth_publickey_frommemor { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_username,&__pyx_n_s_privatekeyfiledata,&__pyx_n_s_passphrase,&__pyx_n_s_publickeyfiledata,0}; PyObject* values[4] = {0,0,0,0}; - values[2] = ((PyObject *)__pyx_kp_s__2); + values[2] = ((PyObject *)__pyx_kp_s__4); - /* "ssh2/session.pyx":266 + /* "ssh2/session.pyx":284 * def userauth_publickey_frommemory( * self, username, bytes privatekeyfiledata, * passphrase='', bytes publickeyfiledata=None): # <<<<<<<<<<<<<< @@ -4424,7 +4706,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, 264, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_publickey_frommemory", 0, 2, 4, 1); __PYX_ERR(1, 282, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -4440,7 +4722,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, 264, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_publickey_frommemory") < 0)) __PYX_ERR(1, 282, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4461,17 +4743,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, 264, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_publickey_frommemory", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 282, __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, 265, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_publickeyfiledata), (&PyBytes_Type), 1, "publickeyfiledata", 1))) __PYX_ERR(0, 266, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_privatekeyfiledata), (&PyBytes_Type), 1, "privatekeyfiledata", 1))) __PYX_ERR(1, 283, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_publickeyfiledata), (&PyBytes_Type), 1, "publickeyfiledata", 1))) __PYX_ERR(1, 284, __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":264 + /* "ssh2/session.pyx":282 * * IF EMBEDDED_LIB: * def userauth_publickey_frommemory( # <<<<<<<<<<<<<< @@ -4513,31 +4795,31 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_publickey_frommemory", 0); - /* "ssh2/session.pyx":268 + /* "ssh2/session.pyx":286 * 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, 268, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 286, __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":287 * 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, 269, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_passphrase); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 287, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_passphrase = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":270 + /* "ssh2/session.pyx":288 * cdef bytes b_username = to_bytes(username) * cdef bytes b_passphrase = to_bytes(passphrase) * cdef char *_username = b_username # <<<<<<<<<<<<<< @@ -4546,12 +4828,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, 270, __pyx_L1_error) + __PYX_ERR(1, 288, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 270, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 288, __pyx_L1_error) __pyx_v__username = __pyx_t_2; - /* "ssh2/session.pyx":271 + /* "ssh2/session.pyx":289 * cdef bytes b_passphrase = to_bytes(passphrase) * cdef char *_username = b_username * cdef char *_passphrase = b_passphrase # <<<<<<<<<<<<<< @@ -4560,12 +4842,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, 271, __pyx_L1_error) + __PYX_ERR(1, 289, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_passphrase); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 271, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_passphrase); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 289, __pyx_L1_error) __pyx_v__passphrase = __pyx_t_2; - /* "ssh2/session.pyx":272 + /* "ssh2/session.pyx":290 * cdef char *_username = b_username * cdef char *_passphrase = b_passphrase * cdef char *_publickeyfiledata = NULL # <<<<<<<<<<<<<< @@ -4574,7 +4856,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor */ __pyx_v__publickeyfiledata = NULL; - /* "ssh2/session.pyx":273 + /* "ssh2/session.pyx":291 * cdef char *_passphrase = b_passphrase * cdef char *_publickeyfiledata = NULL * cdef char *_privatekeyfiledata = privatekeyfiledata # <<<<<<<<<<<<<< @@ -4583,12 +4865,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, 273, __pyx_L1_error) + __PYX_ERR(1, 291, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_privatekeyfiledata); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 273, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_privatekeyfiledata); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 291, __pyx_L1_error) __pyx_v__privatekeyfiledata = __pyx_t_2; - /* "ssh2/session.pyx":275 + /* "ssh2/session.pyx":293 * cdef char *_privatekeyfiledata = privatekeyfiledata * cdef size_t username_len, privatekeydata_len * cdef size_t pubkeydata_len = 0 # <<<<<<<<<<<<<< @@ -4597,7 +4879,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor */ __pyx_v_pubkeydata_len = 0; - /* "ssh2/session.pyx":277 + /* "ssh2/session.pyx":295 * cdef size_t pubkeydata_len = 0 * username_len, privatekeydata_len = \ * len(b_username), len(privatekeyfiledata) # <<<<<<<<<<<<<< @@ -4606,18 +4888,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, 277, __pyx_L1_error) + __PYX_ERR(1, 295, __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, 277, __pyx_L1_error) + __pyx_t_3 = PyBytes_GET_SIZE(__pyx_v_b_username); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 295, __pyx_L1_error) if (unlikely(__pyx_v_privatekeyfiledata == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 277, __pyx_L1_error) + __PYX_ERR(1, 295, __pyx_L1_error) } - __pyx_t_4 = PyBytes_GET_SIZE(__pyx_v_privatekeyfiledata); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 277, __pyx_L1_error) + __pyx_t_4 = PyBytes_GET_SIZE(__pyx_v_privatekeyfiledata); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 295, __pyx_L1_error) __pyx_v_username_len = __pyx_t_3; __pyx_v_privatekeydata_len = __pyx_t_4; - /* "ssh2/session.pyx":278 + /* "ssh2/session.pyx":296 * username_len, privatekeydata_len = \ * len(b_username), len(privatekeyfiledata) * if publickeyfiledata is not None: # <<<<<<<<<<<<<< @@ -4628,7 +4910,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":279 + /* "ssh2/session.pyx":297 * len(b_username), len(privatekeyfiledata) * if publickeyfiledata is not None: * _publickeyfiledata = publickeyfiledata # <<<<<<<<<<<<<< @@ -4637,12 +4919,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, 279, __pyx_L1_error) + __PYX_ERR(1, 297, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_publickeyfiledata); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 279, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_publickeyfiledata); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 297, __pyx_L1_error) __pyx_v__publickeyfiledata = __pyx_t_2; - /* "ssh2/session.pyx":280 + /* "ssh2/session.pyx":298 * if publickeyfiledata is not None: * _publickeyfiledata = publickeyfiledata * pubkeydata_len = len(publickeyfiledata) # <<<<<<<<<<<<<< @@ -4651,12 +4933,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, 280, __pyx_L1_error) + __PYX_ERR(1, 298, __pyx_L1_error) } - __pyx_t_4 = PyBytes_GET_SIZE(__pyx_v_publickeyfiledata); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 280, __pyx_L1_error) + __pyx_t_4 = PyBytes_GET_SIZE(__pyx_v_publickeyfiledata); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 298, __pyx_L1_error) __pyx_v_pubkeydata_len = __pyx_t_4; - /* "ssh2/session.pyx":278 + /* "ssh2/session.pyx":296 * username_len, privatekeydata_len = \ * len(b_username), len(privatekeyfiledata) * if publickeyfiledata is not None: # <<<<<<<<<<<<<< @@ -4665,7 +4947,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor */ } - /* "ssh2/session.pyx":281 + /* "ssh2/session.pyx":299 * _publickeyfiledata = publickeyfiledata * pubkeydata_len = len(publickeyfiledata) * with nogil: # <<<<<<<<<<<<<< @@ -4680,7 +4962,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor #endif /*try:*/ { - /* "ssh2/session.pyx":282 + /* "ssh2/session.pyx":300 * pubkeydata_len = len(publickeyfiledata) * with nogil: * rc = c_ssh2.libssh2_userauth_publickey_frommemory( # <<<<<<<<<<<<<< @@ -4690,7 +4972,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":281 + /* "ssh2/session.pyx":299 * _publickeyfiledata = publickeyfiledata * pubkeydata_len = len(publickeyfiledata) * with nogil: # <<<<<<<<<<<<<< @@ -4709,7 +4991,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor } } - /* "ssh2/session.pyx":286 + /* "ssh2/session.pyx":304 * pubkeydata_len, _privatekeyfiledata, * privatekeydata_len, _passphrase) * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -4717,14 +4999,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, 286, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 286, __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(1, 304, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 304, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":264 + /* "ssh2/session.pyx":282 * * IF EMBEDDED_LIB: * def userauth_publickey_frommemory( # <<<<<<<<<<<<<< @@ -4745,7 +5027,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor return __pyx_r; } -/* "ssh2/session.pyx":288 +/* "ssh2/session.pyx":306 * return handle_error_codes(rc) * * def userauth_password(self, username not None, password not None): # <<<<<<<<<<<<<< @@ -4788,11 +5070,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, 288, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_password", 1, 2, 2, 1); __PYX_ERR(1, 306, __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, 288, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_password") < 0)) __PYX_ERR(1, 306, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -4805,17 +5087,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, 288, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_password", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 306, __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, 288, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(1, 306, __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, 288, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "password"); __PYX_ERR(1, 306, __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); @@ -4845,31 +5127,31 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_30userauth_password(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_password", 0); - /* "ssh2/session.pyx":296 + /* "ssh2/session.pyx":314 * :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, 296, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 314, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":297 + /* "ssh2/session.pyx":315 * 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, 297, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_password); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 315, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_password = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":298 + /* "ssh2/session.pyx":316 * cdef bytes b_username = to_bytes(username) * cdef bytes b_password = to_bytes(password) * cdef const char *_username = b_username # <<<<<<<<<<<<<< @@ -4878,12 +5160,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, 298, __pyx_L1_error) + __PYX_ERR(1, 316, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 298, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 316, __pyx_L1_error) __pyx_v__username = __pyx_t_2; - /* "ssh2/session.pyx":299 + /* "ssh2/session.pyx":317 * cdef bytes b_password = to_bytes(password) * cdef const char *_username = b_username * cdef const char *_password = b_password # <<<<<<<<<<<<<< @@ -4892,12 +5174,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, 299, __pyx_L1_error) + __PYX_ERR(1, 317, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyBytes_AsString(__pyx_v_b_password); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 299, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBytes_AsString(__pyx_v_b_password); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(1, 317, __pyx_L1_error) __pyx_v__password = __pyx_t_3; - /* "ssh2/session.pyx":300 + /* "ssh2/session.pyx":318 * cdef const char *_username = b_username * cdef const char *_password = b_password * with nogil: # <<<<<<<<<<<<<< @@ -4912,7 +5194,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_30userauth_password(struct __p #endif /*try:*/ { - /* "ssh2/session.pyx":301 + /* "ssh2/session.pyx":319 * cdef const char *_password = b_password * with nogil: * rc = c_ssh2.libssh2_userauth_password( # <<<<<<<<<<<<<< @@ -4922,7 +5204,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":300 + /* "ssh2/session.pyx":318 * cdef const char *_username = b_username * cdef const char *_password = b_password * with nogil: # <<<<<<<<<<<<<< @@ -4941,7 +5223,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_30userauth_password(struct __p } } - /* "ssh2/session.pyx":303 + /* "ssh2/session.pyx":321 * rc = c_ssh2.libssh2_userauth_password( * self._session, _username, _password) * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -4949,14 +5231,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, 303, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 303, __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(1, 321, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 321, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":288 + /* "ssh2/session.pyx":306 * return handle_error_codes(rc) * * def userauth_password(self, username not None, password not None): # <<<<<<<<<<<<<< @@ -4977,7 +5259,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_30userauth_password(struct __p return __pyx_r; } -/* "ssh2/session.pyx":305 +/* "ssh2/session.pyx":323 * return handle_error_codes(rc) * * def userauth_keyboardinteractive(self, username not None, # <<<<<<<<<<<<<< @@ -5020,11 +5302,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, 305, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_keyboardinteractive", 1, 2, 2, 1); __PYX_ERR(1, 323, __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, 305, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "userauth_keyboardinteractive") < 0)) __PYX_ERR(1, 323, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -5037,17 +5319,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, 305, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_keyboardinteractive", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 323, __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, 305, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(1, 323, __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, 306, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "password"); __PYX_ERR(1, 324, __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); @@ -5060,7 +5342,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_33userauth_keyboardinteractive return __pyx_r; } -/* "ssh2/session.pyx":318 +/* "ssh2/session.pyx":336 * cdef const char *_username = b_username * * def passwd(): # <<<<<<<<<<<<<< @@ -5094,7 +5376,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_keyboardinteractive __pyx_outer_scope = (struct __pyx_obj_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; - /* "ssh2/session.pyx":319 + /* "ssh2/session.pyx":337 * * def passwd(): * return password # <<<<<<<<<<<<<< @@ -5102,12 +5384,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_keyboardinteractive * self._kbd_callback = passwd */ __Pyx_XDECREF(__pyx_r); - if (unlikely(!__pyx_cur_scope->__pyx_v_password)) { __Pyx_RaiseClosureNameError("password"); __PYX_ERR(0, 319, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_v_password)) { __Pyx_RaiseClosureNameError("password"); __PYX_ERR(1, 337, __pyx_L1_error) } __Pyx_INCREF(__pyx_cur_scope->__pyx_v_password); __pyx_r = __pyx_cur_scope->__pyx_v_password; goto __pyx_L0; - /* "ssh2/session.pyx":318 + /* "ssh2/session.pyx":336 * cdef const char *_username = b_username * * def passwd(): # <<<<<<<<<<<<<< @@ -5125,7 +5407,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_keyboardinteractive return __pyx_r; } -/* "ssh2/session.pyx":305 +/* "ssh2/session.pyx":323 * return handle_error_codes(rc) * * def userauth_keyboardinteractive(self, username not None, # <<<<<<<<<<<<<< @@ -5152,7 +5434,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_32userauth_keyboardinteractive if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 305, __pyx_L1_error) + __PYX_ERR(1, 323, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -5160,19 +5442,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_32userauth_keyboardinteractive __Pyx_INCREF(__pyx_cur_scope->__pyx_v_password); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_password); - /* "ssh2/session.pyx":315 + /* "ssh2/session.pyx":333 * """ * cdef int rc * cdef bytes b_username = to_bytes(username) # <<<<<<<<<<<<<< * 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, 315, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 333, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":316 + /* "ssh2/session.pyx":334 * cdef int rc * cdef bytes b_username = to_bytes(username) * cdef const char *_username = b_username # <<<<<<<<<<<<<< @@ -5181,24 +5463,24 @@ 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, 316, __pyx_L1_error) + __PYX_ERR(1, 334, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 316, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 334, __pyx_L1_error) __pyx_v__username = __pyx_t_2; - /* "ssh2/session.pyx":318 + /* "ssh2/session.pyx":336 * cdef const char *_username = b_username * * def passwd(): # <<<<<<<<<<<<<< * return password * */ - __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_28userauth_keyboardinteractive_1passwd, 0, __pyx_n_s_userauth_keyboardinteractive_loc, ((PyObject*)__pyx_cur_scope), __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__3)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 318, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_28userauth_keyboardinteractive_1passwd, 0, __pyx_n_s_userauth_keyboardinteractive_loc, ((PyObject*)__pyx_cur_scope), __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 336, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_passwd = __pyx_t_1; __pyx_t_1 = 0; - /* "ssh2/session.pyx":321 + /* "ssh2/session.pyx":339 * return password * * self._kbd_callback = passwd # <<<<<<<<<<<<<< @@ -5211,7 +5493,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_32userauth_keyboardinteractive __Pyx_DECREF(__pyx_v_self->_kbd_callback); __pyx_v_self->_kbd_callback = __pyx_v_passwd; - /* "ssh2/session.pyx":322 + /* "ssh2/session.pyx":340 * * self._kbd_callback = passwd * rc = c_ssh2.libssh2_userauth_keyboard_interactive( # <<<<<<<<<<<<<< @@ -5220,7 +5502,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_f_4ssh2_7session_kbd_callback)); - /* "ssh2/session.pyx":324 + /* "ssh2/session.pyx":342 * rc = c_ssh2.libssh2_userauth_keyboard_interactive( * self._session, _username, &kbd_callback) * self._kbd_callback = None # <<<<<<<<<<<<<< @@ -5233,7 +5515,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_32userauth_keyboardinteractive __Pyx_DECREF(__pyx_v_self->_kbd_callback); __pyx_v_self->_kbd_callback = Py_None; - /* "ssh2/session.pyx":325 + /* "ssh2/session.pyx":343 * self._session, _username, &kbd_callback) * self._kbd_callback = None * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -5241,14 +5523,14 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_32userauth_keyboardinteractive * def agent_init(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 325, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 325, __pyx_L1_error) + __pyx_t_3 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 343, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 343, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":305 + /* "ssh2/session.pyx":323 * return handle_error_codes(rc) * * def userauth_keyboardinteractive(self, username not None, # <<<<<<<<<<<<<< @@ -5270,7 +5552,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_32userauth_keyboardinteractive return __pyx_r; } -/* "ssh2/session.pyx":327 +/* "ssh2/session.pyx":345 * return handle_error_codes(rc) * * def agent_init(self): # <<<<<<<<<<<<<< @@ -5303,7 +5585,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":333 + /* "ssh2/session.pyx":351 * """ * cdef c_ssh2.LIBSSH2_AGENT *agent * with nogil: # <<<<<<<<<<<<<< @@ -5318,18 +5600,18 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_34agent_init(struct __pyx_obj_ #endif /*try:*/ { - /* "ssh2/session.pyx":334 + /* "ssh2/session.pyx":352 * 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, 334, __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(1, 352, __pyx_L4_error) __pyx_v_agent = __pyx_t_1; } - /* "ssh2/session.pyx":333 + /* "ssh2/session.pyx":351 * """ * cdef c_ssh2.LIBSSH2_AGENT *agent * with nogil: # <<<<<<<<<<<<<< @@ -5355,7 +5637,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_34agent_init(struct __pyx_obj_ } } - /* "ssh2/session.pyx":335 + /* "ssh2/session.pyx":353 * with nogil: * agent = agent_init(self._session) * return PyAgent(agent, self) # <<<<<<<<<<<<<< @@ -5363,13 +5645,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, 335, __pyx_L1_error) + __pyx_t_2 = __pyx_f_4ssh2_5agent_PyAgent(__pyx_v_agent, __pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 353, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":327 + /* "ssh2/session.pyx":345 * return handle_error_codes(rc) * * def agent_init(self): # <<<<<<<<<<<<<< @@ -5388,7 +5670,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_34agent_init(struct __pyx_obj_ return __pyx_r; } -/* "ssh2/session.pyx":337 +/* "ssh2/session.pyx":355 * return PyAgent(agent, self) * * def agent_auth(self, username not None): # <<<<<<<<<<<<<< @@ -5407,7 +5689,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, 337, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(1, 355, __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)); @@ -5437,19 +5719,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":363 + /* "ssh2/session.pyx":381 * * :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, 363, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":364 + /* "ssh2/session.pyx":382 * :rtype: None""" * cdef bytes b_username = to_bytes(username) * cdef char *_username = b_username # <<<<<<<<<<<<<< @@ -5458,12 +5740,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, 364, __pyx_L1_error) + __PYX_ERR(1, 382, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 364, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 382, __pyx_L1_error) __pyx_v__username = __pyx_t_2; - /* "ssh2/session.pyx":365 + /* "ssh2/session.pyx":383 * cdef bytes b_username = to_bytes(username) * cdef char *_username = b_username * cdef c_ssh2.LIBSSH2_AGENT *agent = NULL # <<<<<<<<<<<<<< @@ -5472,7 +5754,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ */ __pyx_v_agent = NULL; - /* "ssh2/session.pyx":366 + /* "ssh2/session.pyx":384 * cdef char *_username = b_username * cdef c_ssh2.LIBSSH2_AGENT *agent = NULL * cdef c_ssh2.libssh2_agent_publickey *identity = NULL # <<<<<<<<<<<<<< @@ -5481,7 +5763,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ */ __pyx_v_identity = NULL; - /* "ssh2/session.pyx":367 + /* "ssh2/session.pyx":385 * cdef c_ssh2.LIBSSH2_AGENT *agent = NULL * cdef c_ssh2.libssh2_agent_publickey *identity = NULL * cdef c_ssh2.libssh2_agent_publickey *prev = NULL # <<<<<<<<<<<<<< @@ -5490,17 +5772,17 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ */ __pyx_v_prev = NULL; - /* "ssh2/session.pyx":368 + /* "ssh2/session.pyx":386 * 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, 368, __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(1, 386, __pyx_L1_error) __pyx_v_agent = __pyx_t_3; - /* "ssh2/session.pyx":369 + /* "ssh2/session.pyx":387 * cdef c_ssh2.libssh2_agent_publickey *prev = NULL * agent = init_connect_agent(self._session) * with nogil: # <<<<<<<<<<<<<< @@ -5515,17 +5797,17 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ #endif /*try:*/ { - /* "ssh2/session.pyx":370 + /* "ssh2/session.pyx":388 * 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, 370, __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(1, 388, __pyx_L4_error) } - /* "ssh2/session.pyx":369 + /* "ssh2/session.pyx":387 * cdef c_ssh2.libssh2_agent_publickey *prev = NULL * agent = init_connect_agent(self._session) * with nogil: # <<<<<<<<<<<<<< @@ -5551,7 +5833,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ } } - /* "ssh2/session.pyx":337 + /* "ssh2/session.pyx":355 * return PyAgent(agent, self) * * def agent_auth(self, username not None): # <<<<<<<<<<<<<< @@ -5573,7 +5855,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ return __pyx_r; } -/* "ssh2/session.pyx":372 +/* "ssh2/session.pyx":390 * agent_auth(_username, agent) * * def open_session(self): # <<<<<<<<<<<<<< @@ -5607,7 +5889,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":378 + /* "ssh2/session.pyx":396 * """ * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -5622,7 +5904,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob #endif /*try:*/ { - /* "ssh2/session.pyx":379 + /* "ssh2/session.pyx":397 * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: * channel = c_ssh2.libssh2_channel_open_session( # <<<<<<<<<<<<<< @@ -5632,7 +5914,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":378 + /* "ssh2/session.pyx":396 * """ * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -5651,7 +5933,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob } } - /* "ssh2/session.pyx":381 + /* "ssh2/session.pyx":399 * channel = c_ssh2.libssh2_channel_open_session( * self._session) * if channel is NULL: # <<<<<<<<<<<<<< @@ -5661,7 +5943,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":382 + /* "ssh2/session.pyx":400 * self._session) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -5670,29 +5952,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":383 + /* "ssh2/session.pyx":401 * 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, 382, __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(1, 400, __pyx_L1_error) - /* "ssh2/session.pyx":382 + /* "ssh2/session.pyx":400 * 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, 382, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 400, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":381 + /* "ssh2/session.pyx":399 * channel = c_ssh2.libssh2_channel_open_session( * self._session) * if channel is NULL: # <<<<<<<<<<<<<< @@ -5701,7 +5983,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob */ } - /* "ssh2/session.pyx":384 + /* "ssh2/session.pyx":402 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self) # <<<<<<<<<<<<<< @@ -5709,13 +5991,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, 384, __pyx_L1_error) + __pyx_t_3 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 402, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":372 + /* "ssh2/session.pyx":390 * agent_auth(_username, agent) * * def open_session(self): # <<<<<<<<<<<<<< @@ -5734,7 +6016,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob return __pyx_r; } -/* "ssh2/session.pyx":386 +/* "ssh2/session.pyx":404 * return PyChannel(channel, self) * * def direct_tcpip_ex(self, host not None, int port, # <<<<<<<<<<<<<< @@ -5783,23 +6065,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, 386, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, 1); __PYX_ERR(1, 404, __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, 386, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, 2); __PYX_ERR(1, 404, __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, 386, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, 3); __PYX_ERR(1, 404, __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, 386, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "direct_tcpip_ex") < 0)) __PYX_ERR(1, 404, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -5810,23 +6092,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, 386, __pyx_L3_error) + __pyx_v_port = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 404, __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, 387, __pyx_L3_error) + __pyx_v_sport = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_sport == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 405, __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, 386, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 404, __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, 386, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "host"); __PYX_ERR(1, 404, __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, 387, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "shost"); __PYX_ERR(1, 405, __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); @@ -5856,31 +6138,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":389 + /* "ssh2/session.pyx":407 * 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, 389, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_host); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 407, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_host = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":390 + /* "ssh2/session.pyx":408 * 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, 390, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_shost); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 408, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_shost = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":391 + /* "ssh2/session.pyx":409 * cdef bytes b_host = to_bytes(host) * cdef bytes b_shost = to_bytes(shost) * cdef char *_host = b_host # <<<<<<<<<<<<<< @@ -5889,12 +6171,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, 391, __pyx_L1_error) + __PYX_ERR(1, 409, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_host); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 391, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_host); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 409, __pyx_L1_error) __pyx_v__host = __pyx_t_2; - /* "ssh2/session.pyx":392 + /* "ssh2/session.pyx":410 * cdef bytes b_shost = to_bytes(shost) * cdef char *_host = b_host * cdef char *_shost = b_shost # <<<<<<<<<<<<<< @@ -5903,12 +6185,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, 392, __pyx_L1_error) + __PYX_ERR(1, 410, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_shost); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 392, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_shost); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 410, __pyx_L1_error) __pyx_v__shost = __pyx_t_2; - /* "ssh2/session.pyx":393 + /* "ssh2/session.pyx":411 * cdef char *_host = b_host * cdef char *_shost = b_shost * with nogil: # <<<<<<<<<<<<<< @@ -5923,7 +6205,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx #endif /*try:*/ { - /* "ssh2/session.pyx":394 + /* "ssh2/session.pyx":412 * cdef char *_shost = b_shost * with nogil: * channel = c_ssh2.libssh2_channel_direct_tcpip_ex( # <<<<<<<<<<<<<< @@ -5933,7 +6215,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":393 + /* "ssh2/session.pyx":411 * cdef char *_host = b_host * cdef char *_shost = b_shost * with nogil: # <<<<<<<<<<<<<< @@ -5952,7 +6234,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx } } - /* "ssh2/session.pyx":396 + /* "ssh2/session.pyx":414 * channel = c_ssh2.libssh2_channel_direct_tcpip_ex( * self._session, _host, port, _shost, sport) * if channel is NULL: # <<<<<<<<<<<<<< @@ -5962,7 +6244,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":397 + /* "ssh2/session.pyx":415 * self._session, _host, port, _shost, sport) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -5971,29 +6253,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":398 + /* "ssh2/session.pyx":416 * 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, 397, __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(1, 415, __pyx_L1_error) - /* "ssh2/session.pyx":397 + /* "ssh2/session.pyx":415 * 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, 397, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 415, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":396 + /* "ssh2/session.pyx":414 * channel = c_ssh2.libssh2_channel_direct_tcpip_ex( * self._session, _host, port, _shost, sport) * if channel is NULL: # <<<<<<<<<<<<<< @@ -6002,7 +6284,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx */ } - /* "ssh2/session.pyx":399 + /* "ssh2/session.pyx":417 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self) # <<<<<<<<<<<<<< @@ -6010,13 +6292,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, 399, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 417, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":386 + /* "ssh2/session.pyx":404 * return PyChannel(channel, self) * * def direct_tcpip_ex(self, host not None, int port, # <<<<<<<<<<<<<< @@ -6037,7 +6319,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx return __pyx_r; } -/* "ssh2/session.pyx":401 +/* "ssh2/session.pyx":419 * return PyChannel(channel, self) * * def direct_tcpip(self, host not None, int port): # <<<<<<<<<<<<<< @@ -6080,11 +6362,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, 401, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("direct_tcpip", 1, 2, 2, 1); __PYX_ERR(1, 419, __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, 401, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "direct_tcpip") < 0)) __PYX_ERR(1, 419, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -6093,18 +6375,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, 401, __pyx_L3_error) + __pyx_v_port = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 419, __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, 401, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("direct_tcpip", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 419, __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, 401, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "host"); __PYX_ERR(1, 419, __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); @@ -6132,19 +6414,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":408 + /* "ssh2/session.pyx":426 * """ * 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, 408, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_host); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 426, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_host = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":409 + /* "ssh2/session.pyx":427 * cdef c_ssh2.LIBSSH2_CHANNEL *channel * cdef bytes b_host = to_bytes(host) * cdef char *_host = b_host # <<<<<<<<<<<<<< @@ -6153,12 +6435,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, 409, __pyx_L1_error) + __PYX_ERR(1, 427, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_host); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 409, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_host); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 427, __pyx_L1_error) __pyx_v__host = __pyx_t_2; - /* "ssh2/session.pyx":410 + /* "ssh2/session.pyx":428 * cdef bytes b_host = to_bytes(host) * cdef char *_host = b_host * with nogil: # <<<<<<<<<<<<<< @@ -6173,7 +6455,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob #endif /*try:*/ { - /* "ssh2/session.pyx":411 + /* "ssh2/session.pyx":429 * cdef char *_host = b_host * with nogil: * channel = c_ssh2.libssh2_channel_direct_tcpip( # <<<<<<<<<<<<<< @@ -6183,7 +6465,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":410 + /* "ssh2/session.pyx":428 * cdef bytes b_host = to_bytes(host) * cdef char *_host = b_host * with nogil: # <<<<<<<<<<<<<< @@ -6202,7 +6484,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob } } - /* "ssh2/session.pyx":413 + /* "ssh2/session.pyx":431 * channel = c_ssh2.libssh2_channel_direct_tcpip( * self._session, _host, port) * if channel is NULL: # <<<<<<<<<<<<<< @@ -6212,7 +6494,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":414 + /* "ssh2/session.pyx":432 * self._session, _host, port) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -6221,29 +6503,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":415 + /* "ssh2/session.pyx":433 * 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, 414, __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(1, 432, __pyx_L1_error) - /* "ssh2/session.pyx":414 + /* "ssh2/session.pyx":432 * 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, 414, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 432, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":413 + /* "ssh2/session.pyx":431 * channel = c_ssh2.libssh2_channel_direct_tcpip( * self._session, _host, port) * if channel is NULL: # <<<<<<<<<<<<<< @@ -6252,7 +6534,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob */ } - /* "ssh2/session.pyx":416 + /* "ssh2/session.pyx":434 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self) # <<<<<<<<<<<<<< @@ -6260,13 +6542,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, 416, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 434, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":401 + /* "ssh2/session.pyx":419 * return PyChannel(channel, self) * * def direct_tcpip(self, host not None, int port): # <<<<<<<<<<<<<< @@ -6286,7 +6568,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob return __pyx_r; } -/* "ssh2/session.pyx":418 +/* "ssh2/session.pyx":436 * return PyChannel(channel, self) * * def block_directions(self): # <<<<<<<<<<<<<< @@ -6318,7 +6600,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_44block_directions(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("block_directions", 0); - /* "ssh2/session.pyx":440 + /* "ssh2/session.pyx":458 * :rtype: int""" * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -6333,7 +6615,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_44block_directions(struct __py #endif /*try:*/ { - /* "ssh2/session.pyx":441 + /* "ssh2/session.pyx":459 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_session_block_directions( # <<<<<<<<<<<<<< @@ -6343,7 +6625,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":440 + /* "ssh2/session.pyx":458 * :rtype: int""" * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -6362,7 +6644,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_44block_directions(struct __py } } - /* "ssh2/session.pyx":443 + /* "ssh2/session.pyx":461 * rc = c_ssh2.libssh2_session_block_directions( * self._session) * return rc # <<<<<<<<<<<<<< @@ -6370,13 +6652,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, 443, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 461, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":418 + /* "ssh2/session.pyx":436 * return PyChannel(channel, self) * * def block_directions(self): # <<<<<<<<<<<<<< @@ -6395,7 +6677,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_44block_directions(struct __py return __pyx_r; } -/* "ssh2/session.pyx":445 +/* "ssh2/session.pyx":463 * return rc * * def forward_listen(self, int port): # <<<<<<<<<<<<<< @@ -6415,7 +6697,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, 445, __pyx_L3_error) + __pyx_v_port = __Pyx_PyInt_As_int(__pyx_arg_port); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 463, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -6442,7 +6724,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("forward_listen", 0); - /* "ssh2/session.pyx":453 + /* "ssh2/session.pyx":471 * :rtype: :py:class:`ssh2.listener.Listener` or None""" * cdef c_ssh2.LIBSSH2_LISTENER *listener * with nogil: # <<<<<<<<<<<<<< @@ -6457,7 +6739,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ #endif /*try:*/ { - /* "ssh2/session.pyx":454 + /* "ssh2/session.pyx":472 * cdef c_ssh2.LIBSSH2_LISTENER *listener * with nogil: * listener = c_ssh2.libssh2_channel_forward_listen( # <<<<<<<<<<<<<< @@ -6467,7 +6749,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":453 + /* "ssh2/session.pyx":471 * :rtype: :py:class:`ssh2.listener.Listener` or None""" * cdef c_ssh2.LIBSSH2_LISTENER *listener * with nogil: # <<<<<<<<<<<<<< @@ -6486,7 +6768,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ } } - /* "ssh2/session.pyx":456 + /* "ssh2/session.pyx":474 * listener = c_ssh2.libssh2_channel_forward_listen( * self._session, port) * if listener is NULL: # <<<<<<<<<<<<<< @@ -6496,7 +6778,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":457 + /* "ssh2/session.pyx":475 * self._session, port) * if listener is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -6505,29 +6787,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":458 + /* "ssh2/session.pyx":476 * 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, 457, __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(1, 475, __pyx_L1_error) - /* "ssh2/session.pyx":457 + /* "ssh2/session.pyx":475 * 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, 457, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 475, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":456 + /* "ssh2/session.pyx":474 * listener = c_ssh2.libssh2_channel_forward_listen( * self._session, port) * if listener is NULL: # <<<<<<<<<<<<<< @@ -6536,7 +6818,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ */ } - /* "ssh2/session.pyx":459 + /* "ssh2/session.pyx":477 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyListener(listener, self) # <<<<<<<<<<<<<< @@ -6544,13 +6826,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ * def forward_listen_ex(self, int queue_maxsize, host=None, int port=0): */ __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, 459, __pyx_L1_error) + __pyx_t_3 = __pyx_f_4ssh2_8listener_PyListener(__pyx_v_listener, __pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 477, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":445 + /* "ssh2/session.pyx":463 * return rc * * def forward_listen(self, int port): # <<<<<<<<<<<<<< @@ -6569,7 +6851,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ return __pyx_r; } -/* "ssh2/session.pyx":461 +/* "ssh2/session.pyx":479 * return PyListener(listener, self) * * def forward_listen_ex(self, int queue_maxsize, host=None, int port=0): # <<<<<<<<<<<<<< @@ -6626,7 +6908,7 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_49forward_listen_ex(PyObject * } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "forward_listen_ex") < 0)) __PYX_ERR(0, 461, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "forward_listen_ex") < 0)) __PYX_ERR(1, 479, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -6639,17 +6921,17 @@ static PyObject *__pyx_pw_4ssh2_7session_7Session_49forward_listen_ex(PyObject * default: goto __pyx_L5_argtuple_error; } } - __pyx_v_queue_maxsize = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_queue_maxsize == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 461, __pyx_L3_error) + __pyx_v_queue_maxsize = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_queue_maxsize == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 479, __pyx_L3_error) __pyx_v_host = values[1]; if (values[2]) { - __pyx_v_port = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 461, __pyx_L3_error) + __pyx_v_port = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 479, __pyx_L3_error) } else { __pyx_v_port = ((int)0); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("forward_listen_ex", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 461, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("forward_listen_ex", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 479, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.forward_listen_ex", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -6681,7 +6963,7 @@ 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":484 + /* "ssh2/session.pyx":502 * """ * cdef c_ssh2.LIBSSH2_LISTENER *listener * cdef bytes b_host = None if host is None else to_bytes(host) # <<<<<<<<<<<<<< @@ -6693,7 +6975,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p __Pyx_INCREF(Py_None); __pyx_t_1 = Py_None; } else { - __pyx_t_3 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_host); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 484, __pyx_L1_error) + __pyx_t_3 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_host); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; @@ -6701,7 +6983,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p __pyx_v_b_host = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":485 + /* "ssh2/session.pyx":503 * cdef c_ssh2.LIBSSH2_LISTENER *listener * cdef bytes b_host = None if host is None else to_bytes(host) * cdef char *_host = NULL # <<<<<<<<<<<<<< @@ -6710,7 +6992,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p */ __pyx_v__host = NULL; - /* "ssh2/session.pyx":486 + /* "ssh2/session.pyx":504 * cdef bytes b_host = None if host is None else to_bytes(host) * cdef char *_host = NULL * if b_host is not None: # <<<<<<<<<<<<<< @@ -6721,7 +7003,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p __pyx_t_4 = (__pyx_t_2 != 0); if (__pyx_t_4) { - /* "ssh2/session.pyx":487 + /* "ssh2/session.pyx":505 * cdef char *_host = NULL * if b_host is not None: * _host = b_host # <<<<<<<<<<<<<< @@ -6730,12 +7012,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, 487, __pyx_L1_error) + __PYX_ERR(1, 505, __pyx_L1_error) } - __pyx_t_5 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_host); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 487, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_host); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(1, 505, __pyx_L1_error) __pyx_v__host = __pyx_t_5; - /* "ssh2/session.pyx":486 + /* "ssh2/session.pyx":504 * cdef bytes b_host = None if host is None else to_bytes(host) * cdef char *_host = NULL * if b_host is not None: # <<<<<<<<<<<<<< @@ -6744,7 +7026,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p */ } - /* "ssh2/session.pyx":488 + /* "ssh2/session.pyx":506 * if b_host is not None: * _host = b_host * cdef int bound_port = 0 # <<<<<<<<<<<<<< @@ -6753,7 +7035,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p */ __pyx_v_bound_port = 0; - /* "ssh2/session.pyx":489 + /* "ssh2/session.pyx":507 * _host = b_host * cdef int bound_port = 0 * with nogil: # <<<<<<<<<<<<<< @@ -6768,7 +7050,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p #endif /*try:*/ { - /* "ssh2/session.pyx":490 + /* "ssh2/session.pyx":508 * cdef int bound_port = 0 * with nogil: * listener = c_ssh2.libssh2_channel_forward_listen_ex( # <<<<<<<<<<<<<< @@ -6778,7 +7060,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":489 + /* "ssh2/session.pyx":507 * _host = b_host * cdef int bound_port = 0 * with nogil: # <<<<<<<<<<<<<< @@ -6797,7 +7079,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p } } - /* "ssh2/session.pyx":492 + /* "ssh2/session.pyx":510 * listener = c_ssh2.libssh2_channel_forward_listen_ex( * self._session, _host, port, &bound_port, queue_maxsize) * if listener is NULL: # <<<<<<<<<<<<<< @@ -6807,7 +7089,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p __pyx_t_4 = ((__pyx_v_listener == NULL) != 0); if (__pyx_t_4) { - /* "ssh2/session.pyx":493 + /* "ssh2/session.pyx":511 * self._session, _host, port, &bound_port, queue_maxsize) * if listener is NULL: * return (handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -6816,25 +7098,25 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":494 + /* "ssh2/session.pyx":512 * if listener is NULL: * return (handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)), 0) # <<<<<<<<<<<<<< * return (PyListener(listener, self), bound_port) * */ - __pyx_t_6 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 493, __pyx_L1_error) + __pyx_t_6 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 511, __pyx_L1_error) - /* "ssh2/session.pyx":493 + /* "ssh2/session.pyx":511 * self._session, _host, port, &bound_port, queue_maxsize) * if listener is NULL: * return (handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< * self._session)), 0) * return (PyListener(listener, self), bound_port) */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 511, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 493, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 511, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); @@ -6846,7 +7128,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":492 + /* "ssh2/session.pyx":510 * listener = c_ssh2.libssh2_channel_forward_listen_ex( * self._session, _host, port, &bound_port, queue_maxsize) * if listener is NULL: # <<<<<<<<<<<<<< @@ -6855,7 +7137,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p */ } - /* "ssh2/session.pyx":495 + /* "ssh2/session.pyx":513 * return (handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)), 0) * return (PyListener(listener, self), bound_port) # <<<<<<<<<<<<<< @@ -6863,11 +7145,11 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p * def sftp_init(self): */ __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, 495, __pyx_L1_error) + __pyx_t_3 = __pyx_f_4ssh2_8listener_PyListener(__pyx_v_listener, __pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 513, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_bound_port); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_bound_port); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 513, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 495, __pyx_L1_error) + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 513, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); @@ -6879,7 +7161,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p __pyx_t_7 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":461 + /* "ssh2/session.pyx":479 * return PyListener(listener, self) * * def forward_listen_ex(self, int queue_maxsize, host=None, int port=0): # <<<<<<<<<<<<<< @@ -6901,7 +7183,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p return __pyx_r; } -/* "ssh2/session.pyx":497 +/* "ssh2/session.pyx":515 * return (PyListener(listener, self), bound_port) * * def sftp_init(self): # <<<<<<<<<<<<<< @@ -6935,7 +7217,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":503 + /* "ssh2/session.pyx":521 * """ * cdef c_sftp.LIBSSH2_SFTP *_sftp * with nogil: # <<<<<<<<<<<<<< @@ -6950,7 +7232,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 #endif /*try:*/ { - /* "ssh2/session.pyx":504 + /* "ssh2/session.pyx":522 * cdef c_sftp.LIBSSH2_SFTP *_sftp * with nogil: * _sftp = c_sftp.libssh2_sftp_init(self._session) # <<<<<<<<<<<<<< @@ -6960,7 +7242,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":503 + /* "ssh2/session.pyx":521 * """ * cdef c_sftp.LIBSSH2_SFTP *_sftp * with nogil: # <<<<<<<<<<<<<< @@ -6979,7 +7261,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 } } - /* "ssh2/session.pyx":505 + /* "ssh2/session.pyx":523 * with nogil: * _sftp = c_sftp.libssh2_sftp_init(self._session) * if _sftp is NULL: # <<<<<<<<<<<<<< @@ -6989,7 +7271,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":506 + /* "ssh2/session.pyx":524 * _sftp = c_sftp.libssh2_sftp_init(self._session) * if _sftp is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -6998,29 +7280,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":507 + /* "ssh2/session.pyx":525 * 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, 506, __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(1, 524, __pyx_L1_error) - /* "ssh2/session.pyx":506 + /* "ssh2/session.pyx":524 * _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, 506, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 524, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":505 + /* "ssh2/session.pyx":523 * with nogil: * _sftp = c_sftp.libssh2_sftp_init(self._session) * if _sftp is NULL: # <<<<<<<<<<<<<< @@ -7029,7 +7311,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 */ } - /* "ssh2/session.pyx":508 + /* "ssh2/session.pyx":526 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PySFTP(_sftp, self) # <<<<<<<<<<<<<< @@ -7037,13 +7319,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, 508, __pyx_L1_error) + __pyx_t_3 = __pyx_f_4ssh2_4sftp_PySFTP(__pyx_v__sftp, __pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 526, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":497 + /* "ssh2/session.pyx":515 * return (PyListener(listener, self), bound_port) * * def sftp_init(self): # <<<<<<<<<<<<<< @@ -7062,7 +7344,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 return __pyx_r; } -/* "ssh2/session.pyx":510 +/* "ssh2/session.pyx":528 * return PySFTP(_sftp, self) * * def last_error(self, size_t msg_size=1024): # <<<<<<<<<<<<<< @@ -7102,7 +7384,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, 510, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "last_error") < 0)) __PYX_ERR(1, 528, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -7113,14 +7395,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, 510, __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(1, 528, __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, 510, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("last_error", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 528, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.last_error", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -7155,17 +7437,17 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("last_error", 0); - /* "ssh2/session.pyx":517 + /* "ssh2/session.pyx":535 * """ * cdef char *_error_msg * cdef bytes msg = b'' # <<<<<<<<<<<<<< * cdef int errmsg_len = 0 * with nogil: */ - __Pyx_INCREF(__pyx_kp_b__2); - __pyx_v_msg = __pyx_kp_b__2; + __Pyx_INCREF(__pyx_kp_b__4); + __pyx_v_msg = __pyx_kp_b__4; - /* "ssh2/session.pyx":518 + /* "ssh2/session.pyx":536 * cdef char *_error_msg * cdef bytes msg = b'' * cdef int errmsg_len = 0 # <<<<<<<<<<<<<< @@ -7174,7 +7456,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ */ __pyx_v_errmsg_len = 0; - /* "ssh2/session.pyx":519 + /* "ssh2/session.pyx":537 * cdef bytes msg = b'' * cdef int errmsg_len = 0 * with nogil: # <<<<<<<<<<<<<< @@ -7189,7 +7471,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ #endif /*try:*/ { - /* "ssh2/session.pyx":520 + /* "ssh2/session.pyx":538 * cdef int errmsg_len = 0 * with nogil: * _error_msg = malloc(sizeof(char) * msg_size) # <<<<<<<<<<<<<< @@ -7198,7 +7480,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":521 + /* "ssh2/session.pyx":539 * with nogil: * _error_msg = malloc(sizeof(char) * msg_size) * c_ssh2.libssh2_session_last_error( # <<<<<<<<<<<<<< @@ -7208,7 +7490,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":519 + /* "ssh2/session.pyx":537 * cdef bytes msg = b'' * cdef int errmsg_len = 0 * with nogil: # <<<<<<<<<<<<<< @@ -7227,7 +7509,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ } } - /* "ssh2/session.pyx":523 + /* "ssh2/session.pyx":541 * c_ssh2.libssh2_session_last_error( * self._session, &_error_msg, &errmsg_len, 1) * try: # <<<<<<<<<<<<<< @@ -7236,7 +7518,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ */ /*try:*/ { - /* "ssh2/session.pyx":524 + /* "ssh2/session.pyx":542 * self._session, &_error_msg, &errmsg_len, 1) * try: * if errmsg_len > 0: # <<<<<<<<<<<<<< @@ -7246,19 +7528,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":525 + /* "ssh2/session.pyx":543 * 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, 525, __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(1, 543, __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":524 + /* "ssh2/session.pyx":542 * self._session, &_error_msg, &errmsg_len, 1) * try: * if errmsg_len > 0: # <<<<<<<<<<<<<< @@ -7267,7 +7549,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ */ } - /* "ssh2/session.pyx":526 + /* "ssh2/session.pyx":544 * if errmsg_len > 0: * msg = _error_msg[:errmsg_len] * return msg # <<<<<<<<<<<<<< @@ -7280,7 +7562,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ goto __pyx_L6_return; } - /* "ssh2/session.pyx":528 + /* "ssh2/session.pyx":546 * return msg * finally: * free(_error_msg) # <<<<<<<<<<<<<< @@ -7330,7 +7612,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ } } - /* "ssh2/session.pyx":510 + /* "ssh2/session.pyx":528 * return PySFTP(_sftp, self) * * def last_error(self, size_t msg_size=1024): # <<<<<<<<<<<<<< @@ -7350,7 +7632,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ return __pyx_r; } -/* "ssh2/session.pyx":530 +/* "ssh2/session.pyx":548 * free(_error_msg) * * def last_errno(self): # <<<<<<<<<<<<<< @@ -7382,7 +7664,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":537 + /* "ssh2/session.pyx":555 * """ * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -7397,7 +7679,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_54last_errno(struct __pyx_obj_ #endif /*try:*/ { - /* "ssh2/session.pyx":538 + /* "ssh2/session.pyx":556 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -7407,7 +7689,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":537 + /* "ssh2/session.pyx":555 * """ * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -7426,7 +7708,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_54last_errno(struct __pyx_obj_ } } - /* "ssh2/session.pyx":540 + /* "ssh2/session.pyx":558 * rc = c_ssh2.libssh2_session_last_errno( * self._session) * return rc # <<<<<<<<<<<<<< @@ -7434,13 +7716,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, 540, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 558, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":530 + /* "ssh2/session.pyx":548 * free(_error_msg) * * def last_errno(self): # <<<<<<<<<<<<<< @@ -7459,7 +7741,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_54last_errno(struct __pyx_obj_ return __pyx_r; } -/* "ssh2/session.pyx":543 +/* "ssh2/session.pyx":561 * * IF EMBEDDED_LIB: * def set_last_error(self, int errcode, errmsg not None): # <<<<<<<<<<<<<< @@ -7502,11 +7784,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, 543, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("set_last_error", 1, 2, 2, 1); __PYX_ERR(1, 561, __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, 543, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_last_error") < 0)) __PYX_ERR(1, 561, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -7514,19 +7796,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, 543, __pyx_L3_error) + __pyx_v_errcode = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_errcode == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 561, __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, 543, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("set_last_error", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 561, __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, 543, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "errmsg"); __PYX_ERR(1, 561, __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); @@ -7552,19 +7834,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":544 + /* "ssh2/session.pyx":562 * 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, 544, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_errmsg); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 562, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_errmsg = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":545 + /* "ssh2/session.pyx":563 * def set_last_error(self, int errcode, errmsg not None): * cdef bytes b_errmsg = to_bytes(errmsg) * cdef char *_errmsg = b_errmsg # <<<<<<<<<<<<<< @@ -7573,12 +7855,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, 545, __pyx_L1_error) + __PYX_ERR(1, 563, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_errmsg); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 545, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_errmsg); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 563, __pyx_L1_error) __pyx_v__errmsg = __pyx_t_2; - /* "ssh2/session.pyx":547 + /* "ssh2/session.pyx":565 * cdef char *_errmsg = b_errmsg * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -7593,7 +7875,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_56set_last_error(struct __pyx_ #endif /*try:*/ { - /* "ssh2/session.pyx":548 + /* "ssh2/session.pyx":566 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_session_set_last_error( # <<<<<<<<<<<<<< @@ -7603,7 +7885,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":547 + /* "ssh2/session.pyx":565 * cdef char *_errmsg = b_errmsg * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -7622,7 +7904,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_56set_last_error(struct __pyx_ } } - /* "ssh2/session.pyx":550 + /* "ssh2/session.pyx":568 * rc = c_ssh2.libssh2_session_set_last_error( * self._session, errcode, _errmsg) * return rc # <<<<<<<<<<<<<< @@ -7630,13 +7912,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, 550, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 568, __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":561 * * IF EMBEDDED_LIB: * def set_last_error(self, int errcode, errmsg not None): # <<<<<<<<<<<<<< @@ -7656,7 +7938,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_56set_last_error(struct __pyx_ return __pyx_r; } -/* "ssh2/session.pyx":552 +/* "ssh2/session.pyx":570 * return rc * * def scp_recv(self, path not None): # <<<<<<<<<<<<<< @@ -7675,7 +7957,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, 552, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "path"); __PYX_ERR(1, 570, __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)); @@ -7705,19 +7987,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":562 + /* "ssh2/session.pyx":580 * :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, 562, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 580, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_path = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":563 + /* "ssh2/session.pyx":581 * :py:class:`ssh2.statinfo.StatInfo`) or None""" * cdef bytes b_path = to_bytes(path) * cdef char *_path = b_path # <<<<<<<<<<<<<< @@ -7726,24 +8008,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, 563, __pyx_L1_error) + __PYX_ERR(1, 581, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 563, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 581, __pyx_L1_error) __pyx_v__path = __pyx_t_2; - /* "ssh2/session.pyx":564 + /* "ssh2/session.pyx":582 * 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, 564, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4ssh2_8statinfo_StatInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 582, __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":566 + /* "ssh2/session.pyx":584 * cdef StatInfo statinfo = StatInfo() * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -7758,7 +8040,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s #endif /*try:*/ { - /* "ssh2/session.pyx":567 + /* "ssh2/session.pyx":585 * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: * channel = c_ssh2.libssh2_scp_recv( # <<<<<<<<<<<<<< @@ -7768,7 +8050,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":566 + /* "ssh2/session.pyx":584 * cdef StatInfo statinfo = StatInfo() * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -7787,7 +8069,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s } } - /* "ssh2/session.pyx":569 + /* "ssh2/session.pyx":587 * channel = c_ssh2.libssh2_scp_recv( * self._session, _path, statinfo._stat) * if channel is NULL: # <<<<<<<<<<<<<< @@ -7797,7 +8079,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":570 + /* "ssh2/session.pyx":588 * self._session, _path, statinfo._stat) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -7806,29 +8088,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":571 + /* "ssh2/session.pyx":589 * 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, 570, __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(1, 588, __pyx_L1_error) - /* "ssh2/session.pyx":570 + /* "ssh2/session.pyx":588 * 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, 570, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 588, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":569 + /* "ssh2/session.pyx":587 * channel = c_ssh2.libssh2_scp_recv( * self._session, _path, statinfo._stat) * if channel is NULL: # <<<<<<<<<<<<<< @@ -7837,7 +8119,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s */ } - /* "ssh2/session.pyx":572 + /* "ssh2/session.pyx":590 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self), statinfo # <<<<<<<<<<<<<< @@ -7845,9 +8127,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, 572, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 590, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 572, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 590, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); @@ -7859,7 +8141,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s __pyx_t_5 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":552 + /* "ssh2/session.pyx":570 * return rc * * def scp_recv(self, path not None): # <<<<<<<<<<<<<< @@ -7881,7 +8163,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s return __pyx_r; } -/* "ssh2/session.pyx":575 +/* "ssh2/session.pyx":593 * * IF EMBEDDED_LIB: * def scp_recv2(self, path not None): # <<<<<<<<<<<<<< @@ -7900,7 +8182,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, 575, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "path"); __PYX_ERR(1, 593, __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)); @@ -7930,31 +8212,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":585 + /* "ssh2/session.pyx":603 * :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, 585, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4ssh2_8fileinfo_FileInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 603, __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":586 + /* "ssh2/session.pyx":604 * :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, 586, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 604, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_path = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":587 + /* "ssh2/session.pyx":605 * cdef FileInfo fileinfo = FileInfo() * cdef bytes b_path = to_bytes(path) * cdef char *_path = b_path # <<<<<<<<<<<<<< @@ -7963,12 +8245,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, 587, __pyx_L1_error) + __PYX_ERR(1, 605, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 587, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 605, __pyx_L1_error) __pyx_v__path = __pyx_t_2; - /* "ssh2/session.pyx":589 + /* "ssh2/session.pyx":607 * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -7983,7 +8265,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 #endif /*try:*/ { - /* "ssh2/session.pyx":590 + /* "ssh2/session.pyx":608 * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: * channel = c_ssh2.libssh2_scp_recv2( # <<<<<<<<<<<<<< @@ -7993,7 +8275,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":589 + /* "ssh2/session.pyx":607 * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -8012,7 +8294,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 } } - /* "ssh2/session.pyx":592 + /* "ssh2/session.pyx":610 * channel = c_ssh2.libssh2_scp_recv2( * self._session, _path, fileinfo._stat) * if channel is NULL: # <<<<<<<<<<<<<< @@ -8022,7 +8304,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":593 + /* "ssh2/session.pyx":611 * self._session, _path, fileinfo._stat) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -8031,29 +8313,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":594 + /* "ssh2/session.pyx":612 * 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, 593, __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(1, 611, __pyx_L1_error) - /* "ssh2/session.pyx":593 + /* "ssh2/session.pyx":611 * 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, 593, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 611, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":592 + /* "ssh2/session.pyx":610 * channel = c_ssh2.libssh2_scp_recv2( * self._session, _path, fileinfo._stat) * if channel is NULL: # <<<<<<<<<<<<<< @@ -8062,7 +8344,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 */ } - /* "ssh2/session.pyx":595 + /* "ssh2/session.pyx":613 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self), fileinfo # <<<<<<<<<<<<<< @@ -8070,9 +8352,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, 595, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 613, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 595, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 613, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); @@ -8084,7 +8366,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 __pyx_t_5 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":575 + /* "ssh2/session.pyx":593 * * IF EMBEDDED_LIB: * def scp_recv2(self, path not None): # <<<<<<<<<<<<<< @@ -8106,7 +8388,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 return __pyx_r; } -/* "ssh2/session.pyx":597 +/* "ssh2/session.pyx":615 * return PyChannel(channel, self), fileinfo * * def scp_send(self, path not None, int mode, size_t size): # <<<<<<<<<<<<<< @@ -8152,17 +8434,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, 597, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send", 1, 3, 3, 1); __PYX_ERR(1, 615, __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, 597, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send", 1, 3, 3, 2); __PYX_ERR(1, 615, __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, 597, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scp_send") < 0)) __PYX_ERR(1, 615, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -8172,19 +8454,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, 597, __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, 597, __pyx_L3_error) + __pyx_v_mode = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 615, __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(1, 615, __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, 597, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 615, __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, 597, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "path"); __PYX_ERR(1, 615, __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); @@ -8212,19 +8494,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":608 + /* "ssh2/session.pyx":626 * * :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, 608, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 626, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_path = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":609 + /* "ssh2/session.pyx":627 * :rtype: :py:class:`ssh2.channel.Channel`""" * cdef bytes b_path = to_bytes(path) * cdef char *_path = b_path # <<<<<<<<<<<<<< @@ -8233,12 +8515,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, 609, __pyx_L1_error) + __PYX_ERR(1, 627, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 609, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 627, __pyx_L1_error) __pyx_v__path = __pyx_t_2; - /* "ssh2/session.pyx":611 + /* "ssh2/session.pyx":629 * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -8253,7 +8535,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s #endif /*try:*/ { - /* "ssh2/session.pyx":612 + /* "ssh2/session.pyx":630 * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: * channel = c_ssh2.libssh2_scp_send( # <<<<<<<<<<<<<< @@ -8263,7 +8545,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":611 + /* "ssh2/session.pyx":629 * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -8282,7 +8564,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s } } - /* "ssh2/session.pyx":614 + /* "ssh2/session.pyx":632 * channel = c_ssh2.libssh2_scp_send( * self._session, _path, mode, size) * if channel is NULL: # <<<<<<<<<<<<<< @@ -8292,7 +8574,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":615 + /* "ssh2/session.pyx":633 * self._session, _path, mode, size) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -8301,29 +8583,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":616 + /* "ssh2/session.pyx":634 * 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, 615, __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(1, 633, __pyx_L1_error) - /* "ssh2/session.pyx":615 + /* "ssh2/session.pyx":633 * 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, 615, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 633, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":614 + /* "ssh2/session.pyx":632 * channel = c_ssh2.libssh2_scp_send( * self._session, _path, mode, size) * if channel is NULL: # <<<<<<<<<<<<<< @@ -8332,7 +8614,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s */ } - /* "ssh2/session.pyx":617 + /* "ssh2/session.pyx":635 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self) # <<<<<<<<<<<<<< @@ -8340,13 +8622,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, 617, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 635, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":597 + /* "ssh2/session.pyx":615 * return PyChannel(channel, self), fileinfo * * def scp_send(self, path not None, int mode, size_t size): # <<<<<<<<<<<<<< @@ -8366,7 +8648,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s return __pyx_r; } -/* "ssh2/session.pyx":619 +/* "ssh2/session.pyx":637 * return PyChannel(channel, self) * * def scp_send64(self, path not None, int mode, c_ssh2.libssh2_uint64_t size, # <<<<<<<<<<<<<< @@ -8418,29 +8700,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, 619, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 1); __PYX_ERR(1, 637, __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, 619, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 2); __PYX_ERR(1, 637, __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, 619, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 3); __PYX_ERR(1, 637, __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, 619, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 4); __PYX_ERR(1, 637, __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, 619, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scp_send64") < 0)) __PYX_ERR(1, 637, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; @@ -8452,21 +8734,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, 619, __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, 619, __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, 620, __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, 620, __pyx_L3_error) + __pyx_v_mode = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 637, __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(1, 637, __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(1, 638, __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(1, 638, __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, 619, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 637, __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, 619, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "path"); __PYX_ERR(1, 637, __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); @@ -8494,19 +8776,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":631 + /* "ssh2/session.pyx":649 * * :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, 631, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 649, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_path = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":632 + /* "ssh2/session.pyx":650 * :rtype: :py:class:`ssh2.channel.Channel`""" * cdef bytes b_path = to_bytes(path) * cdef char *_path = b_path # <<<<<<<<<<<<<< @@ -8515,12 +8797,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, 632, __pyx_L1_error) + __PYX_ERR(1, 650, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 632, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 650, __pyx_L1_error) __pyx_v__path = __pyx_t_2; - /* "ssh2/session.pyx":634 + /* "ssh2/session.pyx":652 * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -8535,7 +8817,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ #endif /*try:*/ { - /* "ssh2/session.pyx":635 + /* "ssh2/session.pyx":653 * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: * channel = c_ssh2.libssh2_scp_send64( # <<<<<<<<<<<<<< @@ -8545,7 +8827,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":634 + /* "ssh2/session.pyx":652 * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -8564,7 +8846,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ } } - /* "ssh2/session.pyx":637 + /* "ssh2/session.pyx":655 * channel = c_ssh2.libssh2_scp_send64( * self._session, _path, mode, size, mtime, atime) * if channel is NULL: # <<<<<<<<<<<<<< @@ -8574,7 +8856,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":638 + /* "ssh2/session.pyx":656 * self._session, _path, mode, size, mtime, atime) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -8583,29 +8865,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":639 + /* "ssh2/session.pyx":657 * 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, 638, __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(1, 656, __pyx_L1_error) - /* "ssh2/session.pyx":638 + /* "ssh2/session.pyx":656 * 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, 638, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 656, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":637 + /* "ssh2/session.pyx":655 * channel = c_ssh2.libssh2_scp_send64( * self._session, _path, mode, size, mtime, atime) * if channel is NULL: # <<<<<<<<<<<<<< @@ -8614,7 +8896,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ */ } - /* "ssh2/session.pyx":640 + /* "ssh2/session.pyx":658 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self) # <<<<<<<<<<<<<< @@ -8622,13 +8904,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, 640, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_7channel_PyChannel(__pyx_v_channel, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 658, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":619 + /* "ssh2/session.pyx":637 * return PyChannel(channel, self) * * def scp_send64(self, path not None, int mode, c_ssh2.libssh2_uint64_t size, # <<<<<<<<<<<<<< @@ -8648,7 +8930,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ return __pyx_r; } -/* "ssh2/session.pyx":642 +/* "ssh2/session.pyx":660 * return PyChannel(channel, self) * * def publickey_init(self): # <<<<<<<<<<<<<< @@ -8681,7 +8963,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("publickey_init", 0); - /* "ssh2/session.pyx":646 + /* "ssh2/session.pyx":664 * public keys""" * cdef c_pkey.LIBSSH2_PUBLICKEY *_pkey * with nogil: # <<<<<<<<<<<<<< @@ -8696,7 +8978,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ #endif /*try:*/ { - /* "ssh2/session.pyx":647 + /* "ssh2/session.pyx":665 * cdef c_pkey.LIBSSH2_PUBLICKEY *_pkey * with nogil: * _pkey = c_pkey.libssh2_publickey_init(self._session) # <<<<<<<<<<<<<< @@ -8706,7 +8988,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":646 + /* "ssh2/session.pyx":664 * public keys""" * cdef c_pkey.LIBSSH2_PUBLICKEY *_pkey * with nogil: # <<<<<<<<<<<<<< @@ -8725,7 +9007,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ } } - /* "ssh2/session.pyx":648 + /* "ssh2/session.pyx":666 * with nogil: * _pkey = c_pkey.libssh2_publickey_init(self._session) * if _pkey is NULL: # <<<<<<<<<<<<<< @@ -8735,20 +9017,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":649 + /* "ssh2/session.pyx":667 * _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, 649, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PublicKeyInitError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 667, __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, 649, __pyx_L1_error) + __PYX_ERR(1, 667, __pyx_L1_error) - /* "ssh2/session.pyx":648 + /* "ssh2/session.pyx":666 * with nogil: * _pkey = c_pkey.libssh2_publickey_init(self._session) * if _pkey is NULL: # <<<<<<<<<<<<<< @@ -8757,7 +9039,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ */ } - /* "ssh2/session.pyx":650 + /* "ssh2/session.pyx":668 * if _pkey is NULL: * raise PublicKeyInitError * return PyPublicKeySystem(_pkey, self) # <<<<<<<<<<<<<< @@ -8765,13 +9047,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, 650, __pyx_L1_error) + __pyx_t_2 = __pyx_f_4ssh2_9publickey_PyPublicKeySystem(__pyx_v__pkey, __pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 668, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":642 + /* "ssh2/session.pyx":660 * return PyChannel(channel, self) * * def publickey_init(self): # <<<<<<<<<<<<<< @@ -8790,7 +9072,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ return __pyx_r; } -/* "ssh2/session.pyx":652 +/* "ssh2/session.pyx":670 * return PyPublicKeySystem(_pkey, self) * * def hostkey_hash(self, int hash_type): # <<<<<<<<<<<<<< @@ -8810,7 +9092,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, 652, __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(1, 670, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -8837,7 +9119,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":662 + /* "ssh2/session.pyx":680 * cdef const char *_hash * cdef bytes b_hash * with nogil: # <<<<<<<<<<<<<< @@ -8852,7 +9134,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob #endif /*try:*/ { - /* "ssh2/session.pyx":663 + /* "ssh2/session.pyx":681 * cdef bytes b_hash * with nogil: * _hash = c_ssh2.libssh2_hostkey_hash(self._session, hash_type) # <<<<<<<<<<<<<< @@ -8862,7 +9144,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":662 + /* "ssh2/session.pyx":680 * cdef const char *_hash * cdef bytes b_hash * with nogil: # <<<<<<<<<<<<<< @@ -8881,7 +9163,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob } } - /* "ssh2/session.pyx":664 + /* "ssh2/session.pyx":682 * with nogil: * _hash = c_ssh2.libssh2_hostkey_hash(self._session, hash_type) * if _hash is NULL: # <<<<<<<<<<<<<< @@ -8891,7 +9173,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":665 + /* "ssh2/session.pyx":683 * _hash = c_ssh2.libssh2_hostkey_hash(self._session, hash_type) * if _hash is NULL: * return # <<<<<<<<<<<<<< @@ -8902,7 +9184,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":664 + /* "ssh2/session.pyx":682 * with nogil: * _hash = c_ssh2.libssh2_hostkey_hash(self._session, hash_type) * if _hash is NULL: # <<<<<<<<<<<<<< @@ -8911,19 +9193,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob */ } - /* "ssh2/session.pyx":666 + /* "ssh2/session.pyx":684 * 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, 666, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v__hash); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 684, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_b_hash = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "ssh2/session.pyx":667 + /* "ssh2/session.pyx":685 * return * b_hash = _hash * return b_hash # <<<<<<<<<<<<<< @@ -8935,7 +9217,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":652 + /* "ssh2/session.pyx":670 * return PyPublicKeySystem(_pkey, self) * * def hostkey_hash(self, int hash_type): # <<<<<<<<<<<<<< @@ -8955,7 +9237,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob return __pyx_r; } -/* "ssh2/session.pyx":669 +/* "ssh2/session.pyx":687 * return b_hash * * def hostkey(self): # <<<<<<<<<<<<<< @@ -8993,17 +9275,17 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss int __pyx_clineno = 0; __Pyx_RefNannySetupContext("hostkey", 0); - /* "ssh2/session.pyx":678 + /* "ssh2/session.pyx":696 * * :rtype: tuple(bytes, int)""" * cdef bytes key = b"" # <<<<<<<<<<<<<< * cdef const char *_key * cdef size_t key_len = 0 */ - __Pyx_INCREF(__pyx_kp_b__2); - __pyx_v_key = __pyx_kp_b__2; + __Pyx_INCREF(__pyx_kp_b__4); + __pyx_v_key = __pyx_kp_b__4; - /* "ssh2/session.pyx":680 + /* "ssh2/session.pyx":698 * cdef bytes key = b"" * cdef const char *_key * cdef size_t key_len = 0 # <<<<<<<<<<<<<< @@ -9012,7 +9294,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss */ __pyx_v_key_len = 0; - /* "ssh2/session.pyx":681 + /* "ssh2/session.pyx":699 * cdef const char *_key * cdef size_t key_len = 0 * cdef int key_type = 0 # <<<<<<<<<<<<<< @@ -9021,7 +9303,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss */ __pyx_v_key_type = 0; - /* "ssh2/session.pyx":682 + /* "ssh2/session.pyx":700 * cdef size_t key_len = 0 * cdef int key_type = 0 * with nogil: # <<<<<<<<<<<<<< @@ -9036,7 +9318,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss #endif /*try:*/ { - /* "ssh2/session.pyx":683 + /* "ssh2/session.pyx":701 * cdef int key_type = 0 * with nogil: * _key = c_ssh2.libssh2_session_hostkey( # <<<<<<<<<<<<<< @@ -9046,7 +9328,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":682 + /* "ssh2/session.pyx":700 * cdef size_t key_len = 0 * cdef int key_type = 0 * with nogil: # <<<<<<<<<<<<<< @@ -9065,7 +9347,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss } } - /* "ssh2/session.pyx":685 + /* "ssh2/session.pyx":703 * _key = c_ssh2.libssh2_session_hostkey( * self._session, &key_len, &key_type) * if _key is NULL: # <<<<<<<<<<<<<< @@ -9075,14 +9357,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":686 + /* "ssh2/session.pyx":704 * 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, 686, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_SessionHostKeyError); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 704, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -9096,14 +9378,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, 686, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 704, __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, 686, __pyx_L1_error) + __PYX_ERR(1, 704, __pyx_L1_error) - /* "ssh2/session.pyx":685 + /* "ssh2/session.pyx":703 * _key = c_ssh2.libssh2_session_hostkey( * self._session, &key_len, &key_type) * if _key is NULL: # <<<<<<<<<<<<<< @@ -9112,19 +9394,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss */ } - /* "ssh2/session.pyx":688 + /* "ssh2/session.pyx":706 * 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, 688, __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(1, 706, __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":689 + /* "ssh2/session.pyx":707 * "Error retrieving server host key for session") * key = _key[:key_len] * return key, key_type # <<<<<<<<<<<<<< @@ -9132,9 +9414,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, 689, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_key_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 707, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 689, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 707, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_key); __Pyx_GIVEREF(__pyx_v_key); @@ -9146,7 +9428,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":669 + /* "ssh2/session.pyx":687 * return b_hash * * def hostkey(self): # <<<<<<<<<<<<<< @@ -9168,7 +9450,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss return __pyx_r; } -/* "ssh2/session.pyx":691 +/* "ssh2/session.pyx":709 * return key, key_type * * def knownhost_init(self): # <<<<<<<<<<<<<< @@ -9201,7 +9483,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("knownhost_init", 0); - /* "ssh2/session.pyx":696 + /* "ssh2/session.pyx":714 * :rtype: :py:class:`ssh2.knownhost.KnownHost`""" * cdef c_ssh2.LIBSSH2_KNOWNHOSTS *known_hosts * with nogil: # <<<<<<<<<<<<<< @@ -9216,7 +9498,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ #endif /*try:*/ { - /* "ssh2/session.pyx":697 + /* "ssh2/session.pyx":715 * cdef c_ssh2.LIBSSH2_KNOWNHOSTS *known_hosts * with nogil: * known_hosts = c_ssh2.libssh2_knownhost_init( # <<<<<<<<<<<<<< @@ -9226,7 +9508,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":696 + /* "ssh2/session.pyx":714 * :rtype: :py:class:`ssh2.knownhost.KnownHost`""" * cdef c_ssh2.LIBSSH2_KNOWNHOSTS *known_hosts * with nogil: # <<<<<<<<<<<<<< @@ -9245,7 +9527,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ } } - /* "ssh2/session.pyx":699 + /* "ssh2/session.pyx":717 * known_hosts = c_ssh2.libssh2_knownhost_init( * self._session) * if known_hosts is NULL: # <<<<<<<<<<<<<< @@ -9255,20 +9537,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":700 + /* "ssh2/session.pyx":718 * 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, 700, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_KnownHostError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 718, __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, 700, __pyx_L1_error) + __PYX_ERR(1, 718, __pyx_L1_error) - /* "ssh2/session.pyx":699 + /* "ssh2/session.pyx":717 * known_hosts = c_ssh2.libssh2_knownhost_init( * self._session) * if known_hosts is NULL: # <<<<<<<<<<<<<< @@ -9277,7 +9559,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ */ } - /* "ssh2/session.pyx":701 + /* "ssh2/session.pyx":719 * if known_hosts is NULL: * raise KnownHostError * return PyKnownHost(self, known_hosts) # <<<<<<<<<<<<<< @@ -9285,13 +9567,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, 701, __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(1, 719, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":691 + /* "ssh2/session.pyx":709 * return key, key_type * * def knownhost_init(self): # <<<<<<<<<<<<<< @@ -9310,7 +9592,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ return __pyx_r; } -/* "ssh2/session.pyx":703 +/* "ssh2/session.pyx":721 * return PyKnownHost(self, known_hosts) * * def keepalive_config(self, bint want_reply, unsigned interval): # <<<<<<<<<<<<<< @@ -9353,11 +9635,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, 703, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("keepalive_config", 1, 2, 2, 1); __PYX_ERR(1, 721, __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, 703, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "keepalive_config") < 0)) __PYX_ERR(1, 721, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -9365,12 +9647,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, 703, __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, 703, __pyx_L3_error) + __pyx_v_want_reply = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_want_reply == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 721, __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(1, 721, __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, 703, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("keepalive_config", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 721, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ssh2.session.Session.keepalive_config", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -9388,7 +9670,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_74keepalive_config(struct __py __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("keepalive_config", 0); - /* "ssh2/session.pyx":713 + /* "ssh2/session.pyx":731 * keepalives. * :type interval: int""" * with nogil: # <<<<<<<<<<<<<< @@ -9403,7 +9685,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_74keepalive_config(struct __py #endif /*try:*/ { - /* "ssh2/session.pyx":714 + /* "ssh2/session.pyx":732 * :type interval: int""" * with nogil: * c_ssh2.libssh2_keepalive_config(self._session, want_reply, interval) # <<<<<<<<<<<<<< @@ -9413,7 +9695,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":713 + /* "ssh2/session.pyx":731 * keepalives. * :type interval: int""" * with nogil: # <<<<<<<<<<<<<< @@ -9432,7 +9714,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_74keepalive_config(struct __py } } - /* "ssh2/session.pyx":703 + /* "ssh2/session.pyx":721 * return PyKnownHost(self, known_hosts) * * def keepalive_config(self, bint want_reply, unsigned interval): # <<<<<<<<<<<<<< @@ -9447,7 +9729,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_74keepalive_config(struct __py return __pyx_r; } -/* "ssh2/session.pyx":716 +/* "ssh2/session.pyx":734 * c_ssh2.libssh2_keepalive_config(self._session, want_reply, interval) * * def keepalive_send(self): # <<<<<<<<<<<<<< @@ -9482,7 +9764,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("keepalive_send", 0); - /* "ssh2/session.pyx":722 + /* "ssh2/session.pyx":740 * * :rtype: int""" * cdef int seconds = 0 # <<<<<<<<<<<<<< @@ -9491,7 +9773,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ */ __pyx_v_seconds = 0; - /* "ssh2/session.pyx":723 + /* "ssh2/session.pyx":741 * :rtype: int""" * cdef int seconds = 0 * cdef int c_seconds = 0 # <<<<<<<<<<<<<< @@ -9500,7 +9782,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ */ __pyx_v_c_seconds = 0; - /* "ssh2/session.pyx":725 + /* "ssh2/session.pyx":743 * cdef int c_seconds = 0 * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -9515,7 +9797,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ #endif /*try:*/ { - /* "ssh2/session.pyx":726 + /* "ssh2/session.pyx":744 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_keepalive_send(self._session, &c_seconds) # <<<<<<<<<<<<<< @@ -9525,7 +9807,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":725 + /* "ssh2/session.pyx":743 * cdef int c_seconds = 0 * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -9544,27 +9826,30 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ } } - /* "ssh2/session.pyx":727 + /* "ssh2/session.pyx":745 * 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, 727, __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(1, 745, __pyx_L1_error) - /* "ssh2/session.pyx":728 + /* "ssh2/session.pyx":746 * rc = c_ssh2.libssh2_keepalive_send(self._session, &c_seconds) * handle_error_codes(rc) * return c_seconds # <<<<<<<<<<<<<< + * + * def supported_algs(self, MethodType method_type): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_c_seconds); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 728, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_c_seconds); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 746, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":716 + /* "ssh2/session.pyx":734 * c_ssh2.libssh2_keepalive_config(self._session, want_reply, interval) * * def keepalive_send(self): # <<<<<<<<<<<<<< @@ -9583,333 +9868,1009 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ return __pyx_r; } -/* "ssh2/session.pxd":22 - * cdef c_ssh2.LIBSSH2_SESSION *_session - * cdef int _sock - * cdef readonly object sock # <<<<<<<<<<<<<< - * cdef readonly object _kbd_callback - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_4ssh2_7session_7Session_4sock_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4ssh2_7session_7Session_4sock_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4ssh2_7session_7Session_4sock___get__(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_4ssh2_7session_7Session_4sock___get__(struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->sock); - __pyx_r = __pyx_v_self->sock; - goto __pyx_L0; - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "ssh2/session.pxd":23 - * cdef int _sock - * cdef readonly object sock - * cdef readonly object _kbd_callback # <<<<<<<<<<<<<< +/* "ssh2/session.pyx":748 + * return c_seconds + * + * def supported_algs(self, MethodType method_type): # <<<<<<<<<<<<<< + * """Get supportd algorithms for method type. + * */ /* Python wrapper */ -static PyObject *__pyx_pw_4ssh2_7session_7Session_13_kbd_callback_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4ssh2_7session_7Session_13_kbd_callback_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4ssh2_7session_7Session_79supported_algs(PyObject *__pyx_v_self, PyObject *__pyx_v_method_type); /*proto*/ +static char __pyx_doc_4ssh2_7session_7Session_78supported_algs[] = "Session.supported_algs(self, MethodType method_type)\nGet supportd algorithms for method type.\n\n :param method_type: Type of method to get\n :type method_type: :py:class:`MethodType`\n\n :returns: List of supported algorithms.\n :rtype: list(str)\n "; +static PyObject *__pyx_pw_4ssh2_7session_7Session_79supported_algs(PyObject *__pyx_v_self, PyObject *__pyx_v_method_type) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4ssh2_7session_7Session_13_kbd_callback___get__(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self)); + __Pyx_RefNannySetupContext("supported_algs (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_method_type), __pyx_ptype_4ssh2_7session_MethodType, 1, "method_type", 0))) __PYX_ERR(1, 748, __pyx_L1_error) + __pyx_r = __pyx_pf_4ssh2_7session_7Session_78supported_algs(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), ((struct __pyx_obj_4ssh2_7session_MethodType *)__pyx_v_method_type)); /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_4ssh2_7session_7Session_13_kbd_callback___get__(struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->_kbd_callback); - __pyx_r = __pyx_v_self->_kbd_callback; goto __pyx_L0; - - /* function exit code */ + __pyx_L1_error:; + __pyx_r = NULL; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - */ - -/* 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) { - 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)); - - /* 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_78supported_algs(struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self, struct __pyx_obj_4ssh2_7session_MethodType *__pyx_v_method_type) { + char const **__pyx_v_c_algs; + int __pyx_v_rc; + PyObject *__pyx_v_algs = NULL; + int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + char const *__pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); + __Pyx_RefNannySetupContext("supported_algs", 0); - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "ssh2/session.pyx":759 + * cdef const char **c_algs + * cdef int rc + * with nogil: # <<<<<<<<<<<<<< + * rc = c_ssh2.libssh2_session_supported_algs( + * self._session, method_type.value, &c_algs) */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(1, 2, __pyx_L1_error) + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): + /* "ssh2/session.pyx":760 + * cdef int rc + * with nogil: + * rc = c_ssh2.libssh2_session_supported_algs( # <<<<<<<<<<<<<< + * self._session, method_type.value, &c_algs) + * if rc < 0: */ + __pyx_v_rc = libssh2_session_supported_algs(__pyx_v_self->_session, __pyx_v_method_type->value, (&__pyx_v_c_algs)); + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ssh2.session.Session.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "ssh2/session.pyx":759 + * cdef const char **c_algs + * cdef int rc + * with nogil: # <<<<<<<<<<<<<< + * rc = c_ssh2.libssh2_session_supported_algs( + * self._session, method_type.value, &c_algs) */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } + } -/* 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) { - 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)); + /* "ssh2/session.pyx":762 + * rc = c_ssh2.libssh2_session_supported_algs( + * self._session, method_type.value, &c_algs) + * if rc < 0: # <<<<<<<<<<<<<< + * return handle_error_codes(rc) + * elif rc == 0: + */ + __pyx_t_1 = ((__pyx_v_rc < 0) != 0); + if (__pyx_t_1) { - /* function exit code */ - __Pyx_RefNannyFinishContext(); + /* "ssh2/session.pyx":763 + * self._session, method_type.value, &c_algs) + * if rc < 0: + * return handle_error_codes(rc) # <<<<<<<<<<<<<< + * elif rc == 0: + * return [] + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 763, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 763, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "ssh2/session.pyx":762 + * rc = c_ssh2.libssh2_session_supported_algs( + * self._session, method_type.value, &c_algs) + * if rc < 0: # <<<<<<<<<<<<<< + * return handle_error_codes(rc) + * elif rc == 0: + */ + } + + /* "ssh2/session.pyx":764 + * if rc < 0: + * return handle_error_codes(rc) + * elif rc == 0: # <<<<<<<<<<<<<< + * return [] + * try: + */ + __pyx_t_1 = ((__pyx_v_rc == 0) != 0); + if (__pyx_t_1) { + + /* "ssh2/session.pyx":765 + * return handle_error_codes(rc) + * elif rc == 0: + * return [] # <<<<<<<<<<<<<< + * try: + * algs = [to_str(c_algs[i]) for i in range(rc)] + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 765, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "ssh2/session.pyx":764 + * if rc < 0: + * return handle_error_codes(rc) + * elif rc == 0: # <<<<<<<<<<<<<< + * return [] + * try: + */ + } + + /* "ssh2/session.pyx":766 + * elif rc == 0: + * return [] + * try: # <<<<<<<<<<<<<< + * algs = [to_str(c_algs[i]) for i in range(rc)] + * finally: + */ + /*try:*/ { + + /* "ssh2/session.pyx":767 + * return [] + * try: + * algs = [to_str(c_algs[i]) for i in range(rc)] # <<<<<<<<<<<<<< + * finally: + * with nogil: + */ + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 767, __pyx_L8_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __pyx_v_rc; + __pyx_t_4 = __pyx_t_2; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + __pyx_t_6 = __pyx_f_4ssh2_5utils_to_str((__pyx_v_c_algs[__pyx_v_i])); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 767, __pyx_L8_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 767, __pyx_L8_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_v_algs = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + } + + /* "ssh2/session.pyx":769 + * algs = [to_str(c_algs[i]) for i in range(rc)] + * finally: + * with nogil: # <<<<<<<<<<<<<< + * c_ssh2.libssh2_free(self._session, c_algs) + * return algs + */ + /*finally:*/ { + /*normal exit:*/{ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + + /* "ssh2/session.pyx":770 + * finally: + * with nogil: + * c_ssh2.libssh2_free(self._session, c_algs) # <<<<<<<<<<<<<< + * return algs + * + */ + libssh2_free(__pyx_v_self->_session, __pyx_v_c_algs); + } + + /* "ssh2/session.pyx":769 + * algs = [to_str(c_algs[i]) for i in range(rc)] + * finally: + * with nogil: # <<<<<<<<<<<<<< + * c_ssh2.libssh2_free(self._session, c_algs) + * return algs + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L14; + } + __pyx_L14:; + } + } + goto __pyx_L9; + } + __pyx_L8_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_13); + __pyx_t_2 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_7 = __pyx_filename; + { + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + + /* "ssh2/session.pyx":770 + * finally: + * with nogil: + * c_ssh2.libssh2_free(self._session, c_algs) # <<<<<<<<<<<<<< + * return algs + * + */ + libssh2_free(__pyx_v_self->_session, __pyx_v_c_algs); + } + + /* "ssh2/session.pyx":769 + * algs = [to_str(c_algs[i]) for i in range(rc)] + * finally: + * with nogil: # <<<<<<<<<<<<<< + * c_ssh2.libssh2_free(self._session, c_algs) + * return algs + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L19; + } + __pyx_L19:; + } + } + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13); + } + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10); + __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; + __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_7; + goto __pyx_L1_error; + } + __pyx_L9:; + } + + /* "ssh2/session.pyx":771 + * with nogil: + * c_ssh2.libssh2_free(self._session, c_algs) + * return algs # <<<<<<<<<<<<<< + * + * def methods(self, MethodType method_type): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_algs); + __pyx_r = __pyx_v_algs; + goto __pyx_L0; + + /* "ssh2/session.pyx":748 + * return c_seconds + * + * def supported_algs(self, MethodType method_type): # <<<<<<<<<<<<<< + * """Get supportd algorithms for method type. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("ssh2.session.Session.supported_algs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_algs); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ssh2/session.pyx":773 + * return algs + * + * def methods(self, MethodType method_type): # <<<<<<<<<<<<<< + * """Get currently active algorithms for method type. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_4ssh2_7session_7Session_81methods(PyObject *__pyx_v_self, PyObject *__pyx_v_method_type); /*proto*/ +static char __pyx_doc_4ssh2_7session_7Session_80methods[] = "Session.methods(self, MethodType method_type)\nGet currently active algorithms for method type.\n\n :param method_type: Type of method to get\n :type method_type: :py:class:`MethodType`\n\n :rtype: str\n "; +static PyObject *__pyx_pw_4ssh2_7session_7Session_81methods(PyObject *__pyx_v_self, PyObject *__pyx_v_method_type) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("methods (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_method_type), __pyx_ptype_4ssh2_7session_MethodType, 1, "method_type", 0))) __PYX_ERR(1, 773, __pyx_L1_error) + __pyx_r = __pyx_pf_4ssh2_7session_7Session_80methods(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), ((struct __pyx_obj_4ssh2_7session_MethodType *)__pyx_v_method_type)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __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_80methods(struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self, struct __pyx_obj_4ssh2_7session_MethodType *__pyx_v_method_type) { + char const *__pyx_v_methods; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); + __Pyx_RefNannySetupContext("methods", 0); - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "ssh2/session.pyx":781 + * :rtype: str + * """ + * with nogil: # <<<<<<<<<<<<<< + * methods = c_ssh2.libssh2_session_methods( + * self._session, method_type.value) + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + + /* "ssh2/session.pyx":782 + * """ + * with nogil: + * methods = c_ssh2.libssh2_session_methods( # <<<<<<<<<<<<<< + * self._session, method_type.value) + * return to_str(methods) + */ + __pyx_v_methods = libssh2_session_methods(__pyx_v_self->_session, __pyx_v_method_type->value); + } + + /* "ssh2/session.pyx":781 + * :rtype: str + * """ + * with nogil: # <<<<<<<<<<<<<< + * methods = c_ssh2.libssh2_session_methods( + * self._session, method_type.value) + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } + } + + /* "ssh2/session.pyx":784 + * methods = c_ssh2.libssh2_session_methods( + * self._session, method_type.value) + * return to_str(methods) # <<<<<<<<<<<<<< + * + * def method_pref(self, MethodType method_type, prefs not None): */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_str(__pyx_v_methods); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 784, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "ssh2/session.pyx":773 + * return algs + * + * def methods(self, MethodType method_type): # <<<<<<<<<<<<<< + * """Get currently active algorithms for method type. + * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ssh2.session.Session.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("ssh2.session.Session.methods", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_tp_new_4ssh2_7session_Session(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_4ssh2_7session_Session *p; - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); +/* "ssh2/session.pyx":786 + * return to_str(methods) + * + * def method_pref(self, MethodType method_type, prefs not None): # <<<<<<<<<<<<<< + * """Set preference for session method. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_4ssh2_7session_7Session_83method_pref(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4ssh2_7session_7Session_82method_pref[] = "Session.method_pref(self, MethodType method_type, prefs)\nSet preference for session method.\n\n See :py:func:`Session.supported_algs` for supported algorithms\n for method type.\n\n :param method_type: A supported session method LIBSSH2_METHOD_*\n :type method_type: :py:class:`MethodType`\n :param prefs: Algorithm preference for method type provided.\n :type prefs: str\n\n :rtype: int\n :raises: :py:class:`ssh2.exceptions.MethodNotSupported`\n on unsupported method preference\n "; +static PyObject *__pyx_pw_4ssh2_7session_7Session_83method_pref(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_4ssh2_7session_MethodType *__pyx_v_method_type = 0; + PyObject *__pyx_v_prefs = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("method_pref (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_method_type,&__pyx_n_s_prefs,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + 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 (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_method_type)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prefs)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("method_pref", 1, 2, 2, 1); __PYX_ERR(1, 786, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "method_pref") < 0)) __PYX_ERR(1, 786, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_method_type = ((struct __pyx_obj_4ssh2_7session_MethodType *)values[0]); + __pyx_v_prefs = values[1]; } - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_4ssh2_7session_Session *)o); - p->sock = Py_None; Py_INCREF(Py_None); - p->_kbd_callback = Py_None; Py_INCREF(Py_None); - if (unlikely(__pyx_pw_4ssh2_7session_7Session_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad; - return o; - bad: - Py_DECREF(o); o = 0; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("method_pref", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 786, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("ssh2.session.Session.method_pref", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_method_type), __pyx_ptype_4ssh2_7session_MethodType, 1, "method_type", 0))) __PYX_ERR(1, 786, __pyx_L1_error) + if (unlikely(((PyObject *)__pyx_v_prefs) == Py_None)) { + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "prefs"); __PYX_ERR(1, 786, __pyx_L1_error) + } + __pyx_r = __pyx_pf_4ssh2_7session_7Session_82method_pref(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_method_type, __pyx_v_prefs); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static void __pyx_tp_dealloc_4ssh2_7session_Session(PyObject *o) { - struct __pyx_obj_4ssh2_7session_Session *p = (struct __pyx_obj_4ssh2_7session_Session *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; +static PyObject *__pyx_pf_4ssh2_7session_7Session_82method_pref(struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self, struct __pyx_obj_4ssh2_7session_MethodType *__pyx_v_method_type, PyObject *__pyx_v_prefs) { + PyObject *__pyx_v_b_prefs = 0; + char const *__pyx_v_c_prefs; + int __pyx_v_rc; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + char const *__pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("method_pref", 0); + + /* "ssh2/session.pyx":801 + * on unsupported method preference + * """ + * cdef bytes b_prefs = to_bytes(prefs) # <<<<<<<<<<<<<< + * cdef const char *c_prefs = b_prefs + * cdef int rc + */ + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_prefs); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 801, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_b_prefs = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "ssh2/session.pyx":802 + * """ + * cdef bytes b_prefs = to_bytes(prefs) + * cdef const char *c_prefs = b_prefs # <<<<<<<<<<<<<< + * cdef int rc + * with nogil: + */ + if (unlikely(__pyx_v_b_prefs == Py_None)) { + PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); + __PYX_ERR(1, 802, __pyx_L1_error) } - #endif - PyObject_GC_UnTrack(o); + __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_b_prefs); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 802, __pyx_L1_error) + __pyx_v_c_prefs = __pyx_t_2; + + /* "ssh2/session.pyx":804 + * cdef const char *c_prefs = b_prefs + * cdef int rc + * with nogil: # <<<<<<<<<<<<<< + * rc = c_ssh2.libssh2_session_method_pref( + * self._session, method_type.value, c_prefs) + */ { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); - __pyx_pw_4ssh2_7session_7Session_3__dealloc__(o); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); - PyErr_Restore(etype, eval, etb); + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + + /* "ssh2/session.pyx":805 + * cdef int rc + * with nogil: + * rc = c_ssh2.libssh2_session_method_pref( # <<<<<<<<<<<<<< + * self._session, method_type.value, c_prefs) + * handle_error_codes(rc) + */ + __pyx_v_rc = libssh2_session_method_pref(__pyx_v_self->_session, __pyx_v_method_type->value, __pyx_v_c_prefs); + } + + /* "ssh2/session.pyx":804 + * cdef const char *c_prefs = b_prefs + * cdef int rc + * with nogil: # <<<<<<<<<<<<<< + * rc = c_ssh2.libssh2_session_method_pref( + * self._session, method_type.value, c_prefs) + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } } - Py_CLEAR(p->sock); - Py_CLEAR(p->_kbd_callback); - (*Py_TYPE(o)->tp_free)(o); + + /* "ssh2/session.pyx":807 + * rc = c_ssh2.libssh2_session_method_pref( + * self._session, method_type.value, c_prefs) + * handle_error_codes(rc) # <<<<<<<<<<<<<< + * return rc + */ + __pyx_t_3 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 807, __pyx_L1_error) + + /* "ssh2/session.pyx":808 + * self._session, method_type.value, c_prefs) + * handle_error_codes(rc) + * return rc # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 808, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "ssh2/session.pyx":786 + * return to_str(methods) + * + * def method_pref(self, MethodType method_type, prefs not None): # <<<<<<<<<<<<<< + * """Set preference for session method. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("ssh2.session.Session.method_pref", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_b_prefs); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static int __pyx_tp_traverse_4ssh2_7session_Session(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4ssh2_7session_Session *p = (struct __pyx_obj_4ssh2_7session_Session *)o; - if (p->sock) { - e = (*v)(p->sock, a); if (e) return e; - } - if (p->_kbd_callback) { - e = (*v)(p->_kbd_callback, a); if (e) return e; - } - return 0; +/* "ssh2/session.pxd":22 + * cdef c_ssh2.LIBSSH2_SESSION *_session + * cdef int _sock + * cdef readonly object sock # <<<<<<<<<<<<<< + * cdef readonly object _kbd_callback + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_4ssh2_7session_7Session_4sock_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4ssh2_7session_7Session_4sock_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4ssh2_7session_7Session_4sock___get__(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static int __pyx_tp_clear_4ssh2_7session_Session(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_4ssh2_7session_Session *p = (struct __pyx_obj_4ssh2_7session_Session *)o; - tmp = ((PyObject*)p->sock); - p->sock = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->_kbd_callback); - p->_kbd_callback = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; +static PyObject *__pyx_pf_4ssh2_7session_7Session_4sock___get__(struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->sock); + __pyx_r = __pyx_v_self->sock; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static PyObject *__pyx_getprop_4ssh2_7session_7Session_sock(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4ssh2_7session_7Session_4sock_1__get__(o); +/* "ssh2/session.pxd":23 + * cdef int _sock + * cdef readonly object sock + * cdef readonly object _kbd_callback # <<<<<<<<<<<<<< + * + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_4ssh2_7session_7Session_13_kbd_callback_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4ssh2_7session_7Session_13_kbd_callback_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4ssh2_7session_7Session_13_kbd_callback___get__(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static PyObject *__pyx_getprop_4ssh2_7session_7Session__kbd_callback(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4ssh2_7session_7Session_13_kbd_callback_1__get__(o); +static PyObject *__pyx_pf_4ssh2_7session_7Session_13_kbd_callback___get__(struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_kbd_callback); + __pyx_r = __pyx_v_self->_kbd_callback; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static PyMethodDef __pyx_methods_4ssh2_7session_Session[] = { - {"disconnect", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_5disconnect, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_4disconnect}, - {"handshake", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_7handshake, METH_O, __pyx_doc_4ssh2_7session_7Session_6handshake}, - {"startup", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_9startup, METH_O, __pyx_doc_4ssh2_7session_7Session_8startup}, - {"set_blocking", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_11set_blocking, METH_O, __pyx_doc_4ssh2_7session_7Session_10set_blocking}, - {"get_blocking", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_13get_blocking, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_12get_blocking}, - {"set_timeout", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_15set_timeout, METH_O, __pyx_doc_4ssh2_7session_7Session_14set_timeout}, - {"get_timeout", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_17get_timeout, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_16get_timeout}, - {"userauth_authenticated", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_19userauth_authenticated, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_18userauth_authenticated}, - {"userauth_list", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_21userauth_list, METH_O, __pyx_doc_4ssh2_7session_7Session_20userauth_list}, - {"userauth_publickey_fromfile", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_23userauth_publickey_fromfile, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_22userauth_publickey_fromfile}, - {"userauth_publickey", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_25userauth_publickey, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_24userauth_publickey}, - {"userauth_hostbased_fromfile", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_27userauth_hostbased_fromfile, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_26userauth_hostbased_fromfile}, - {"userauth_publickey_frommemory", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_29userauth_publickey_frommemory, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_28userauth_publickey_frommemory}, - {"userauth_password", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_31userauth_password, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_30userauth_password}, - {"userauth_keyboardinteractive", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_33userauth_keyboardinteractive, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_32userauth_keyboardinteractive}, - {"agent_init", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_35agent_init, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_34agent_init}, - {"agent_auth", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_37agent_auth, METH_O, __pyx_doc_4ssh2_7session_7Session_36agent_auth}, - {"open_session", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_39open_session, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_38open_session}, - {"direct_tcpip_ex", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_41direct_tcpip_ex, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_40direct_tcpip_ex}, - {"direct_tcpip", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_43direct_tcpip, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_42direct_tcpip}, - {"block_directions", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_45block_directions, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_44block_directions}, - {"forward_listen", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_47forward_listen, METH_O, __pyx_doc_4ssh2_7session_7Session_46forward_listen}, - {"forward_listen_ex", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_49forward_listen_ex, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_48forward_listen_ex}, - {"sftp_init", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_51sftp_init, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_50sftp_init}, - {"last_error", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_53last_error, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_52last_error}, - {"last_errno", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_55last_errno, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_54last_errno}, - {"set_last_error", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_57set_last_error, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_56set_last_error}, - {"scp_recv", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_59scp_recv, METH_O, __pyx_doc_4ssh2_7session_7Session_58scp_recv}, - {"scp_recv2", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_61scp_recv2, METH_O, __pyx_doc_4ssh2_7session_7Session_60scp_recv2}, - {"scp_send", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_63scp_send, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_62scp_send}, - {"scp_send64", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_65scp_send64, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_64scp_send64}, - {"publickey_init", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_67publickey_init, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_66publickey_init}, - {"hostkey_hash", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_69hostkey_hash, METH_O, __pyx_doc_4ssh2_7session_7Session_68hostkey_hash}, - {"hostkey", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_71hostkey, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_70hostkey}, - {"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__}, - {0, 0, 0, 0} -}; +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ -static struct PyGetSetDef __pyx_getsets_4ssh2_7session_Session[] = { - {(char *)"sock", __pyx_getprop_4ssh2_7session_7Session_sock, 0, (char *)0, 0}, - {(char *)"_kbd_callback", __pyx_getprop_4ssh2_7session_7Session__kbd_callback, 0, (char *)0, 0}, - {0, 0, 0, 0, 0} -}; +/* Python wrapper */ +static PyObject *__pyx_pw_4ssh2_7session_7Session_85__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_4ssh2_7session_7Session_84__reduce_cython__[] = "Session.__reduce_cython__(self)"; +static PyObject *__pyx_pw_4ssh2_7session_7Session_85__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_84__reduce_cython__(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self)); -static PyTypeObject __pyx_type_4ssh2_7session_Session = { - PyVarObject_HEAD_INIT(0, 0) - "ssh2.session.Session", /*tp_name*/ - sizeof(struct __pyx_obj_4ssh2_7session_Session), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_4ssh2_7session_Session, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_4ssh2_7session_7Session_84__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("ssh2.session.Session.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_4ssh2_7session_7Session_87__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static char __pyx_doc_4ssh2_7session_7Session_86__setstate_cython__[] = "Session.__setstate_cython__(self, __pyx_state)"; +static PyObject *__pyx_pw_4ssh2_7session_7Session_87__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_86__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_86__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; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("ssh2.session.Session.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_tp_new_4ssh2_7session_Session(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4ssh2_7session_Session *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4ssh2_7session_Session *)o); + p->sock = Py_None; Py_INCREF(Py_None); + p->_kbd_callback = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4ssh2_7session_7Session_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_4ssh2_7session_Session(PyObject *o) { + struct __pyx_obj_4ssh2_7session_Session *p = (struct __pyx_obj_4ssh2_7session_Session *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_pw_4ssh2_7session_7Session_3__dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->sock); + Py_CLEAR(p->_kbd_callback); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_4ssh2_7session_Session(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4ssh2_7session_Session *p = (struct __pyx_obj_4ssh2_7session_Session *)o; + if (p->sock) { + e = (*v)(p->sock, a); if (e) return e; + } + if (p->_kbd_callback) { + e = (*v)(p->_kbd_callback, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4ssh2_7session_Session(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_4ssh2_7session_Session *p = (struct __pyx_obj_4ssh2_7session_Session *)o; + tmp = ((PyObject*)p->sock); + p->sock = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_kbd_callback); + p->_kbd_callback = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_4ssh2_7session_7Session_sock(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4ssh2_7session_7Session_4sock_1__get__(o); +} + +static PyObject *__pyx_getprop_4ssh2_7session_7Session__kbd_callback(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4ssh2_7session_7Session_13_kbd_callback_1__get__(o); +} + +static PyMethodDef __pyx_methods_4ssh2_7session_Session[] = { + {"disconnect", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_5disconnect, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_4disconnect}, + {"handshake", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_7handshake, METH_O, __pyx_doc_4ssh2_7session_7Session_6handshake}, + {"startup", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_9startup, METH_O, __pyx_doc_4ssh2_7session_7Session_8startup}, + {"set_blocking", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_11set_blocking, METH_O, __pyx_doc_4ssh2_7session_7Session_10set_blocking}, + {"get_blocking", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_13get_blocking, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_12get_blocking}, + {"set_timeout", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_15set_timeout, METH_O, __pyx_doc_4ssh2_7session_7Session_14set_timeout}, + {"get_timeout", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_17get_timeout, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_16get_timeout}, + {"userauth_authenticated", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_19userauth_authenticated, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_18userauth_authenticated}, + {"userauth_list", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_21userauth_list, METH_O, __pyx_doc_4ssh2_7session_7Session_20userauth_list}, + {"userauth_publickey_fromfile", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_23userauth_publickey_fromfile, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_22userauth_publickey_fromfile}, + {"userauth_publickey", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_25userauth_publickey, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_24userauth_publickey}, + {"userauth_hostbased_fromfile", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_27userauth_hostbased_fromfile, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_26userauth_hostbased_fromfile}, + {"userauth_publickey_frommemory", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_29userauth_publickey_frommemory, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_28userauth_publickey_frommemory}, + {"userauth_password", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_31userauth_password, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_30userauth_password}, + {"userauth_keyboardinteractive", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_33userauth_keyboardinteractive, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_32userauth_keyboardinteractive}, + {"agent_init", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_35agent_init, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_34agent_init}, + {"agent_auth", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_37agent_auth, METH_O, __pyx_doc_4ssh2_7session_7Session_36agent_auth}, + {"open_session", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_39open_session, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_38open_session}, + {"direct_tcpip_ex", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_41direct_tcpip_ex, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_40direct_tcpip_ex}, + {"direct_tcpip", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_43direct_tcpip, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_42direct_tcpip}, + {"block_directions", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_45block_directions, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_44block_directions}, + {"forward_listen", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_47forward_listen, METH_O, __pyx_doc_4ssh2_7session_7Session_46forward_listen}, + {"forward_listen_ex", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_49forward_listen_ex, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_48forward_listen_ex}, + {"sftp_init", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_51sftp_init, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_50sftp_init}, + {"last_error", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_53last_error, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_52last_error}, + {"last_errno", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_55last_errno, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_54last_errno}, + {"set_last_error", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_57set_last_error, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_56set_last_error}, + {"scp_recv", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_59scp_recv, METH_O, __pyx_doc_4ssh2_7session_7Session_58scp_recv}, + {"scp_recv2", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_61scp_recv2, METH_O, __pyx_doc_4ssh2_7session_7Session_60scp_recv2}, + {"scp_send", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_63scp_send, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_62scp_send}, + {"scp_send64", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_65scp_send64, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_64scp_send64}, + {"publickey_init", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_67publickey_init, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_66publickey_init}, + {"hostkey_hash", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_69hostkey_hash, METH_O, __pyx_doc_4ssh2_7session_7Session_68hostkey_hash}, + {"hostkey", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_71hostkey, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_70hostkey}, + {"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}, + {"supported_algs", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_79supported_algs, METH_O, __pyx_doc_4ssh2_7session_7Session_78supported_algs}, + {"methods", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_81methods, METH_O, __pyx_doc_4ssh2_7session_7Session_80methods}, + {"method_pref", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_7session_7Session_83method_pref, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_82method_pref}, + {"__reduce_cython__", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_85__reduce_cython__, METH_NOARGS, __pyx_doc_4ssh2_7session_7Session_84__reduce_cython__}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_4ssh2_7session_7Session_87__setstate_cython__, METH_O, __pyx_doc_4ssh2_7session_7Session_86__setstate_cython__}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_4ssh2_7session_Session[] = { + {(char *)"sock", __pyx_getprop_4ssh2_7session_7Session_sock, 0, (char *)0, 0}, + {(char *)"_kbd_callback", __pyx_getprop_4ssh2_7session_7Session__kbd_callback, 0, (char *)0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4ssh2_7session_Session = { + PyVarObject_HEAD_INIT(0, 0) + "ssh2.session.Session", /*tp_name*/ + sizeof(struct __pyx_obj_4ssh2_7session_Session), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4ssh2_7session_Session, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ @@ -9959,32 +10920,131 @@ static PyTypeObject __pyx_type_4ssh2_7session_Session = { #endif }; -static struct __pyx_obj_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive *__pyx_freelist_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive[8]; -static int __pyx_freecount_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive = 0; - -static PyObject *__pyx_tp_new_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_4ssh2_7session_MethodType(PyTypeObject *t, PyObject *a, PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive)))) { - o = (PyObject*)__pyx_freelist_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive[--__pyx_freecount_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive]; - memset(o, 0, sizeof(struct __pyx_obj_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } + if (unlikely(!o)) return 0; + if (unlikely(__pyx_pw_4ssh2_7session_10MethodType_1__cinit__(o, a, k) < 0)) goto bad; return o; + bad: + Py_DECREF(o); o = 0; + return NULL; } -static void __pyx_tp_dealloc_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive(PyObject *o) { - struct __pyx_obj_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive *p = (struct __pyx_obj_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_password); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive)))) { - __pyx_freelist_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive[__pyx_freecount_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive++] = ((struct __pyx_obj_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } +static void __pyx_tp_dealloc_4ssh2_7session_MethodType(PyObject *o) { + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_4ssh2_7session_MethodType[] = { + {"__reduce_cython__", (PyCFunction)__pyx_pw_4ssh2_7session_10MethodType_3__reduce_cython__, METH_NOARGS, __pyx_doc_4ssh2_7session_10MethodType_2__reduce_cython__}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_4ssh2_7session_10MethodType_5__setstate_cython__, METH_O, __pyx_doc_4ssh2_7session_10MethodType_4__setstate_cython__}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4ssh2_7session_MethodType = { + PyVarObject_HEAD_INIT(0, 0) + "ssh2.session.MethodType", /*tp_name*/ + sizeof(struct __pyx_obj_4ssh2_7session_MethodType), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4ssh2_7session_MethodType, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4ssh2_7session_MethodType, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_4ssh2_7session_MethodType, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif + #if PY_VERSION_HEX >= 0x030800b1 + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif +}; + +static struct __pyx_obj_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive *__pyx_freelist_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive[8]; +static int __pyx_freecount_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive = 0; + +static PyObject *__pyx_tp_new_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive)))) { + o = (PyObject*)__pyx_freelist_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive[--__pyx_freecount_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive]; + memset(o, 0, sizeof(struct __pyx_obj_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive)); + (void) PyObject_INIT(o, t); + PyObject_GC_Track(o); + } else { + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive(PyObject *o) { + struct __pyx_obj_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive *p = (struct __pyx_obj_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_password); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive)))) { + __pyx_freelist_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive[__pyx_freecount_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive++] = ((struct __pyx_obj_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive *)o); + } else { + (*Py_TYPE(o)->tp_free)(o); + } } static int __pyx_tp_traverse_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive(PyObject *o, visitproc v, void *a) { @@ -10120,7 +11180,6 @@ static struct PyModuleDef __pyx_moduledef = { #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0}, {&__pyx_n_s_ChannelError, __pyx_k_ChannelError, sizeof(__pyx_k_ChannelError), 0, 0, 1, 1}, {&__pyx_kp_s_Error_retrieving_server_host_key, __pyx_k_Error_retrieving_server_host_key, sizeof(__pyx_k_Error_retrieving_server_host_key), 0, 0, 1, 0}, {&__pyx_n_s_KnownHostError, __pyx_k_KnownHostError, sizeof(__pyx_k_KnownHostError), 0, 0, 1, 1}, @@ -10134,15 +11193,27 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_LIBSSH2_HOSTKEY_TYPE_ED25519, __pyx_k_LIBSSH2_HOSTKEY_TYPE_ED25519, sizeof(__pyx_k_LIBSSH2_HOSTKEY_TYPE_ED25519), 0, 0, 1, 1}, {&__pyx_n_s_LIBSSH2_HOSTKEY_TYPE_RSA, __pyx_k_LIBSSH2_HOSTKEY_TYPE_RSA, sizeof(__pyx_k_LIBSSH2_HOSTKEY_TYPE_RSA), 0, 0, 1, 1}, {&__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_METHOD_COMP_CS, __pyx_k_LIBSSH2_METHOD_COMP_CS, sizeof(__pyx_k_LIBSSH2_METHOD_COMP_CS), 0, 0, 1, 1}, + {&__pyx_n_s_LIBSSH2_METHOD_COMP_SC, __pyx_k_LIBSSH2_METHOD_COMP_SC, sizeof(__pyx_k_LIBSSH2_METHOD_COMP_SC), 0, 0, 1, 1}, + {&__pyx_n_s_LIBSSH2_METHOD_CRYPT_CS, __pyx_k_LIBSSH2_METHOD_CRYPT_CS, sizeof(__pyx_k_LIBSSH2_METHOD_CRYPT_CS), 0, 0, 1, 1}, + {&__pyx_n_s_LIBSSH2_METHOD_CRYPT_SC, __pyx_k_LIBSSH2_METHOD_CRYPT_SC, sizeof(__pyx_k_LIBSSH2_METHOD_CRYPT_SC), 0, 0, 1, 1}, + {&__pyx_n_s_LIBSSH2_METHOD_HOSTKEY, __pyx_k_LIBSSH2_METHOD_HOSTKEY, sizeof(__pyx_k_LIBSSH2_METHOD_HOSTKEY), 0, 0, 1, 1}, + {&__pyx_n_s_LIBSSH2_METHOD_KEX, __pyx_k_LIBSSH2_METHOD_KEX, sizeof(__pyx_k_LIBSSH2_METHOD_KEX), 0, 0, 1, 1}, + {&__pyx_n_s_LIBSSH2_METHOD_LANG_CS, __pyx_k_LIBSSH2_METHOD_LANG_CS, sizeof(__pyx_k_LIBSSH2_METHOD_LANG_CS), 0, 0, 1, 1}, + {&__pyx_n_s_LIBSSH2_METHOD_LANG_SC, __pyx_k_LIBSSH2_METHOD_LANG_SC, sizeof(__pyx_k_LIBSSH2_METHOD_LANG_SC), 0, 0, 1, 1}, + {&__pyx_n_s_LIBSSH2_METHOD_MAC_CS, __pyx_k_LIBSSH2_METHOD_MAC_CS, sizeof(__pyx_k_LIBSSH2_METHOD_MAC_CS), 0, 0, 1, 1}, + {&__pyx_n_s_LIBSSH2_METHOD_MAC_SC, __pyx_k_LIBSSH2_METHOD_MAC_SC, sizeof(__pyx_k_LIBSSH2_METHOD_MAC_SC), 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_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, + {&__pyx_n_s_MethodType, __pyx_k_MethodType, sizeof(__pyx_k_MethodType), 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}, {&__pyx_n_s_SessionHostKeyError, __pyx_k_SessionHostKeyError, sizeof(__pyx_k_SessionHostKeyError), 0, 0, 1, 1}, {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, - {&__pyx_kp_b__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 0, 0}, - {&__pyx_kp_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 0}, + {&__pyx_kp_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 0}, + {&__pyx_kp_b__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 0, 0, 0}, + {&__pyx_kp_s__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 0, 1, 0}, {&__pyx_n_s_atime, __pyx_k_atime, sizeof(__pyx_k_atime), 0, 0, 1, 1}, {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, {&__pyx_n_s_errcode, __pyx_k_errcode, sizeof(__pyx_k_errcode), 0, 0, 1, 1}, @@ -10154,6 +11225,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_method_type, __pyx_k_method_type, sizeof(__pyx_k_method_type), 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}, {&__pyx_n_s_mtime, __pyx_k_mtime, sizeof(__pyx_k_mtime), 0, 0, 1, 1}, @@ -10164,6 +11236,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_password, __pyx_k_password, sizeof(__pyx_k_password), 0, 0, 1, 1}, {&__pyx_n_s_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1}, {&__pyx_n_s_port, __pyx_k_port, sizeof(__pyx_k_port), 0, 0, 1, 1}, + {&__pyx_n_s_prefs, __pyx_k_prefs, sizeof(__pyx_k_prefs), 0, 0, 1, 1}, {&__pyx_n_s_privatekey, __pyx_k_privatekey, sizeof(__pyx_k_privatekey), 0, 0, 1, 1}, {&__pyx_n_s_privatekeyfiledata, __pyx_k_privatekeyfiledata, sizeof(__pyx_k_privatekeyfiledata), 0, 0, 1, 1}, {&__pyx_n_s_pubkeydata, __pyx_k_pubkeydata, sizeof(__pyx_k_pubkeydata), 0, 0, 1, 1}, @@ -10185,13 +11258,14 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, {&__pyx_n_s_userauth_keyboardinteractive_loc, __pyx_k_userauth_keyboardinteractive_loc, sizeof(__pyx_k_userauth_keyboardinteractive_loc), 0, 0, 1, 1}, {&__pyx_n_s_username, __pyx_k_username, sizeof(__pyx_k_username), 0, 0, 1, 1}, + {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1}, {&__pyx_n_s_want_reply, __pyx_k_want_reply, sizeof(__pyx_k_want_reply), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 80, __pyx_L1_error) - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 94, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 2, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(1, 98, __pyx_L1_error) + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 112, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -10201,14 +11275,33 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "ssh2/session.pyx":318 + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple_); + __Pyx_GIVEREF(__pyx_tuple_); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__2); + __Pyx_GIVEREF(__pyx_tuple__2); + + /* "ssh2/session.pyx":336 * cdef const char *_username = b_username * * def passwd(): # <<<<<<<<<<<<<< * return password * */ - __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_passwd, 318, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 318, __pyx_L1_error) + __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_passwd, 336, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(1, 336, __pyx_L1_error) /* "(tree fragment)":2 * def __reduce_cython__(self): @@ -10216,18 +11309,18 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__6); + __Pyx_GIVEREF(__pyx_tuple__6); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -10237,8 +11330,8 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { __pyx_umethod_PyString_Type_split.type = (PyObject*)&PyString_Type; - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(1, 1, __pyx_L1_error); + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(1, 1, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -10283,17 +11376,27 @@ 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, 86, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_4ssh2_7session_Session) < 0) __PYX_ERR(1, 104, __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, 86, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4ssh2_7session_Session) < 0) __PYX_ERR(0, 86, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Session, (PyObject *)&__pyx_type_4ssh2_7session_Session) < 0) __PYX_ERR(1, 104, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4ssh2_7session_Session) < 0) __PYX_ERR(1, 104, __pyx_L1_error) __pyx_ptype_4ssh2_7session_Session = &__pyx_type_4ssh2_7session_Session; - if (PyType_Ready(&__pyx_type_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive) < 0) __PYX_ERR(0, 305, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_4ssh2_7session_MethodType) < 0) __PYX_ERR(1, 65, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 + __pyx_type_4ssh2_7session_MethodType.tp_print = 0; + #endif + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4ssh2_7session_MethodType.tp_dictoffset && __pyx_type_4ssh2_7session_MethodType.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_4ssh2_7session_MethodType.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MethodType, (PyObject *)&__pyx_type_4ssh2_7session_MethodType) < 0) __PYX_ERR(1, 65, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4ssh2_7session_MethodType) < 0) __PYX_ERR(1, 65, __pyx_L1_error) + __pyx_ptype_4ssh2_7session_MethodType = &__pyx_type_4ssh2_7session_MethodType; + if (PyType_Ready(&__pyx_type_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive) < 0) __PYX_ERR(1, 323, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive.tp_print = 0; #endif @@ -10398,38 +11501,38 @@ static int __Pyx_modinit_function_import_code(void) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); /*--- Function import code ---*/ - __pyx_t_1 = PyImport_ImportModule("ssh2.agent"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule("ssh2.agent"); if (!__pyx_t_1) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction(__pyx_t_1, "PyAgent", (void (**)(void))&__pyx_f_4ssh2_5agent_PyAgent, "PyObject *(LIBSSH2_AGENT *, struct __pyx_obj_4ssh2_7session_Session *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_1, "agent_auth", (void (**)(void))&__pyx_f_4ssh2_5agent_agent_auth, "int (char *, LIBSSH2_AGENT *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_1, "init_connect_agent", (void (**)(void))&__pyx_f_4ssh2_5agent_init_connect_agent, "LIBSSH2_AGENT *(LIBSSH2_SESSION *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_1, "agent_init", (void (**)(void))&__pyx_f_4ssh2_5agent_agent_init, "LIBSSH2_AGENT *(LIBSSH2_SESSION *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportFunction(__pyx_t_1, "PyAgent", (void (**)(void))&__pyx_f_4ssh2_5agent_PyAgent, "PyObject *(LIBSSH2_AGENT *, struct __pyx_obj_4ssh2_7session_Session *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) + if (__Pyx_ImportFunction(__pyx_t_1, "agent_auth", (void (**)(void))&__pyx_f_4ssh2_5agent_agent_auth, "int (char *, LIBSSH2_AGENT *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) + if (__Pyx_ImportFunction(__pyx_t_1, "init_connect_agent", (void (**)(void))&__pyx_f_4ssh2_5agent_init_connect_agent, "LIBSSH2_AGENT *(LIBSSH2_SESSION *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) + if (__Pyx_ImportFunction(__pyx_t_1, "agent_init", (void (**)(void))&__pyx_f_4ssh2_5agent_agent_init, "LIBSSH2_AGENT *(LIBSSH2_SESSION *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule("ssh2.channel"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule("ssh2.channel"); if (!__pyx_t_1) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction(__pyx_t_1, "PyChannel", (void (**)(void))&__pyx_f_4ssh2_7channel_PyChannel, "PyObject *(LIBSSH2_CHANNEL *, struct __pyx_obj_4ssh2_7session_Session *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportFunction(__pyx_t_1, "PyChannel", (void (**)(void))&__pyx_f_4ssh2_7channel_PyChannel, "PyObject *(LIBSSH2_CHANNEL *, struct __pyx_obj_4ssh2_7session_Session *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule("ssh2.listener"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule("ssh2.listener"); if (!__pyx_t_1) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction(__pyx_t_1, "PyListener", (void (**)(void))&__pyx_f_4ssh2_8listener_PyListener, "PyObject *(LIBSSH2_LISTENER *, struct __pyx_obj_4ssh2_7session_Session *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportFunction(__pyx_t_1, "PyListener", (void (**)(void))&__pyx_f_4ssh2_8listener_PyListener, "PyObject *(LIBSSH2_LISTENER *, struct __pyx_obj_4ssh2_7session_Session *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule("ssh2.sftp"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule("ssh2.sftp"); if (!__pyx_t_1) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction(__pyx_t_1, "PySFTP", (void (**)(void))&__pyx_f_4ssh2_4sftp_PySFTP, "PyObject *(LIBSSH2_SFTP *, struct __pyx_obj_4ssh2_7session_Session *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportFunction(__pyx_t_1, "PySFTP", (void (**)(void))&__pyx_f_4ssh2_4sftp_PySFTP, "PyObject *(LIBSSH2_SFTP *, struct __pyx_obj_4ssh2_7session_Session *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule("ssh2.publickey"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule("ssh2.publickey"); if (!__pyx_t_1) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction(__pyx_t_1, "PyPublicKeySystem", (void (**)(void))&__pyx_f_4ssh2_9publickey_PyPublicKeySystem, "PyObject *(LIBSSH2_PUBLICKEY *, struct __pyx_obj_4ssh2_7session_Session *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportFunction(__pyx_t_1, "PyPublicKeySystem", (void (**)(void))&__pyx_f_4ssh2_9publickey_PyPublicKeySystem, "PyObject *(LIBSSH2_PUBLICKEY *, struct __pyx_obj_4ssh2_7session_Session *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule("ssh2.utils"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule("ssh2.utils"); if (!__pyx_t_1) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction(__pyx_t_1, "to_bytes", (void (**)(void))&__pyx_f_4ssh2_5utils_to_bytes, "PyObject *(PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_1, "to_str", (void (**)(void))&__pyx_f_4ssh2_5utils_to_str, "PyObject *(char *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_1, "handle_error_codes", (void (**)(void))&__pyx_f_4ssh2_5utils_handle_error_codes, "int (int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportFunction(__pyx_t_1, "to_bytes", (void (**)(void))&__pyx_f_4ssh2_5utils_to_bytes, "PyObject *(PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) + if (__Pyx_ImportFunction(__pyx_t_1, "to_str", (void (**)(void))&__pyx_f_4ssh2_5utils_to_str, "PyObject *(char *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) + if (__Pyx_ImportFunction(__pyx_t_1, "handle_error_codes", (void (**)(void))&__pyx_f_4ssh2_5utils_handle_error_codes, "int (int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule("ssh2.knownhost"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule("ssh2.knownhost"); if (!__pyx_t_1) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction(__pyx_t_1, "PyKnownHost", (void (**)(void))&__pyx_f_4ssh2_9knownhost_PyKnownHost, "struct __pyx_obj_4ssh2_9knownhost_KnownHost *(struct __pyx_obj_4ssh2_7session_Session *, LIBSSH2_KNOWNHOSTS *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportFunction(__pyx_t_1, "PyKnownHost", (void (**)(void))&__pyx_f_4ssh2_9knownhost_PyKnownHost, "struct __pyx_obj_4ssh2_9knownhost_KnownHost *(struct __pyx_obj_4ssh2_7session_Session *, LIBSSH2_KNOWNHOSTS *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -10558,30 +11661,30 @@ if (!__Pyx_RefNanny) { } #endif __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_session(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_check_binary_version() < 0) __PYX_ERR(1, 1, __pyx_L1_error) #ifdef __Pxy_PyFrame_Initialize_Offsets __Pxy_PyFrame_Initialize_Offsets(); #endif - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(1, 1, __pyx_L1_error) #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_CyFunction_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error) #endif #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_FusedFunction_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error) #endif #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_Coroutine_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error) #endif #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_Generator_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error) #endif #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_AsyncGen_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error) #endif #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error) #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -10600,46 +11703,46 @@ if (!__Pyx_RefNanny) { #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely(!__pyx_m)) __PYX_ERR(1, 1, __pyx_L1_error) #endif - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(1, 1, __pyx_L1_error) Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(1, 1, __pyx_L1_error) Py_INCREF(__pyx_b); - __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(1, 1, __pyx_L1_error) Py_INCREF(__pyx_cython_runtime); - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(1, 1, __pyx_L1_error); /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_InitGlobals() < 0) __PYX_ERR(1, 1, __pyx_L1_error) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(1, 1, __pyx_L1_error) #endif if (__pyx_module_is_main_ssh2__session) { - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(1, 1, __pyx_L1_error) } #if PY_MAJOR_VERSION >= 3 { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(1, 1, __pyx_L1_error) if (!PyDict_GetItemString(modules, "ssh2.session")) { - if (unlikely(PyDict_SetItemString(modules, "ssh2.session", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely(PyDict_SetItemString(modules, "ssh2.session", __pyx_m) < 0)) __PYX_ERR(1, 1, __pyx_L1_error) } } #endif /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(1, 1, __pyx_L1_error) /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(1, 1, __pyx_L1_error) /*--- Global type/function init code ---*/ (void)__Pyx_modinit_global_init_code(); (void)__Pyx_modinit_variable_export_code(); (void)__Pyx_modinit_function_export_code(); - if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(1, 1, __pyx_L1_error) + if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(1, 1, __pyx_L1_error) (void)__Pyx_modinit_variable_import_code(); - if (unlikely(__Pyx_modinit_function_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely(__Pyx_modinit_function_import_code() < 0)) __PYX_ERR(1, 1, __pyx_L1_error) /*--- Execution code ---*/ #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_patch_abc() < 0) __PYX_ERR(1, 1, __pyx_L1_error) #endif /* "ssh2/session.pyx":24 @@ -10649,7 +11752,7 @@ if (!__Pyx_RefNanny) { * PublicKeyInitError, ChannelError * from listener cimport PyListener */ - __pyx_t_1 = PyList_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error) + __pyx_t_1 = PyList_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_SessionHostKeyError); __Pyx_GIVEREF(__pyx_n_s_SessionHostKeyError); @@ -10663,24 +11766,24 @@ if (!__Pyx_RefNanny) { __Pyx_INCREF(__pyx_n_s_ChannelError); __Pyx_GIVEREF(__pyx_n_s_ChannelError); PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_s_ChannelError); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_exceptions, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error) + __pyx_t_2 = __Pyx_Import(__pyx_n_s_exceptions, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_SessionHostKeyError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error) + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_SessionHostKeyError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_SessionHostKeyError, __pyx_t_1) < 0) __PYX_ERR(0, 24, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_SessionHostKeyError, __pyx_t_1) < 0) __PYX_ERR(1, 24, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_KnownHostError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error) + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_KnownHostError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_KnownHostError, __pyx_t_1) < 0) __PYX_ERR(0, 24, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_KnownHostError, __pyx_t_1) < 0) __PYX_ERR(1, 24, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_PublicKeyInitError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error) + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_PublicKeyInitError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_PublicKeyInitError, __pyx_t_1) < 0) __PYX_ERR(0, 25, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_PublicKeyInitError, __pyx_t_1) < 0) __PYX_ERR(1, 25, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ChannelError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error) + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ChannelError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_ChannelError, __pyx_t_1) < 0) __PYX_ERR(0, 25, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ChannelError, __pyx_t_1) < 0) __PYX_ERR(1, 25, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -10691,9 +11794,9 @@ if (!__Pyx_RefNanny) { * LIBSSH2_SESSION_BLOCK_OUTBOUND = c_ssh2.LIBSSH2_SESSION_BLOCK_OUTBOUND * */ - __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_SESSION_BLOCK_INBOUND); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_SESSION_BLOCK_INBOUND); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_SESSION_BLOCK_INBOUND, __pyx_t_2) < 0) __PYX_ERR(0, 41, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_SESSION_BLOCK_INBOUND, __pyx_t_2) < 0) __PYX_ERR(1, 41, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "ssh2/session.pyx":42 @@ -10703,9 +11806,9 @@ if (!__Pyx_RefNanny) { * * LIBSSH2_HOSTKEY_HASH_MD5 = c_ssh2.LIBSSH2_HOSTKEY_HASH_MD5 */ - __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_SESSION_BLOCK_OUTBOUND); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_SESSION_BLOCK_OUTBOUND); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_SESSION_BLOCK_OUTBOUND, __pyx_t_2) < 0) __PYX_ERR(0, 42, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_SESSION_BLOCK_OUTBOUND, __pyx_t_2) < 0) __PYX_ERR(1, 42, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "ssh2/session.pyx":44 @@ -10715,9 +11818,9 @@ if (!__Pyx_RefNanny) { * LIBSSH2_HOSTKEY_HASH_SHA1 = c_ssh2.LIBSSH2_HOSTKEY_HASH_SHA1 * IF EMBEDDED_LIB: */ - __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_HOSTKEY_HASH_MD5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_HOSTKEY_HASH_MD5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_HASH_MD5, __pyx_t_2) < 0) __PYX_ERR(0, 44, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_HASH_MD5, __pyx_t_2) < 0) __PYX_ERR(1, 44, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "ssh2/session.pyx":45 @@ -10727,9 +11830,9 @@ if (!__Pyx_RefNanny) { * IF EMBEDDED_LIB: * LIBSSH2_HOSTKEY_HASH_SHA256 = c_ssh2.LIBSSH2_HOSTKEY_HASH_SHA256 */ - __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_HOSTKEY_HASH_SHA1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_HOSTKEY_HASH_SHA1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_HASH_SHA1, __pyx_t_2) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_HASH_SHA1, __pyx_t_2) < 0) __PYX_ERR(1, 45, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "ssh2/session.pyx":47 @@ -10739,9 +11842,9 @@ if (!__Pyx_RefNanny) { * LIBSSH2_HOSTKEY_TYPE_ECDSA_256 = c_ssh2.LIBSSH2_HOSTKEY_TYPE_ECDSA_256 * LIBSSH2_HOSTKEY_TYPE_ECDSA_384 = c_ssh2.LIBSSH2_HOSTKEY_TYPE_ECDSA_384 */ - __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_HOSTKEY_HASH_SHA256); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_HOSTKEY_HASH_SHA256); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_HASH_SHA256, __pyx_t_2) < 0) __PYX_ERR(0, 47, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_HASH_SHA256, __pyx_t_2) < 0) __PYX_ERR(1, 47, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "ssh2/session.pyx":48 @@ -10751,9 +11854,9 @@ if (!__Pyx_RefNanny) { * LIBSSH2_HOSTKEY_TYPE_ECDSA_384 = c_ssh2.LIBSSH2_HOSTKEY_TYPE_ECDSA_384 * LIBSSH2_HOSTKEY_TYPE_ECDSA_521 = c_ssh2.LIBSSH2_HOSTKEY_TYPE_ECDSA_521 */ - __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_HOSTKEY_TYPE_ECDSA_256); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_HOSTKEY_TYPE_ECDSA_256); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 48, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_TYPE_ECDSA_256, __pyx_t_2) < 0) __PYX_ERR(0, 48, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_TYPE_ECDSA_256, __pyx_t_2) < 0) __PYX_ERR(1, 48, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "ssh2/session.pyx":49 @@ -10763,9 +11866,9 @@ if (!__Pyx_RefNanny) { * LIBSSH2_HOSTKEY_TYPE_ECDSA_521 = c_ssh2.LIBSSH2_HOSTKEY_TYPE_ECDSA_521 * LIBSSH2_HOSTKEY_TYPE_ED25519 = c_ssh2.LIBSSH2_HOSTKEY_TYPE_ED25519 */ - __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_HOSTKEY_TYPE_ECDSA_384); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_HOSTKEY_TYPE_ECDSA_384); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_TYPE_ECDSA_384, __pyx_t_2) < 0) __PYX_ERR(0, 49, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_TYPE_ECDSA_384, __pyx_t_2) < 0) __PYX_ERR(1, 49, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "ssh2/session.pyx":50 @@ -10775,9 +11878,9 @@ if (!__Pyx_RefNanny) { * LIBSSH2_HOSTKEY_TYPE_ED25519 = c_ssh2.LIBSSH2_HOSTKEY_TYPE_ED25519 * ELSE: */ - __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_HOSTKEY_TYPE_ECDSA_521); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_HOSTKEY_TYPE_ECDSA_521); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_TYPE_ECDSA_521, __pyx_t_2) < 0) __PYX_ERR(0, 50, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_TYPE_ECDSA_521, __pyx_t_2) < 0) __PYX_ERR(1, 50, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "ssh2/session.pyx":51 @@ -10787,9 +11890,9 @@ if (!__Pyx_RefNanny) { * ELSE: * LIBSSH2_HOSTKEY_HASH_SHA256 = None */ - __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_HOSTKEY_TYPE_ED25519); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_HOSTKEY_TYPE_ED25519); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_TYPE_ED25519, __pyx_t_2) < 0) __PYX_ERR(0, 51, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_TYPE_ED25519, __pyx_t_2) < 0) __PYX_ERR(1, 51, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "ssh2/session.pyx":60 @@ -10799,9 +11902,9 @@ if (!__Pyx_RefNanny) { * LIBSSH2_HOSTKEY_TYPE_RSA = c_ssh2.LIBSSH2_HOSTKEY_TYPE_RSA * LIBSSH2_HOSTKEY_TYPE_DSS = c_ssh2.LIBSSH2_HOSTKEY_TYPE_DSS */ - __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_HOSTKEY_TYPE_UNKNOWN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_HOSTKEY_TYPE_UNKNOWN); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_TYPE_UNKNOWN, __pyx_t_2) < 0) __PYX_ERR(0, 60, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_TYPE_UNKNOWN, __pyx_t_2) < 0) __PYX_ERR(1, 60, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "ssh2/session.pyx":61 @@ -10811,9 +11914,9 @@ if (!__Pyx_RefNanny) { * LIBSSH2_HOSTKEY_TYPE_DSS = c_ssh2.LIBSSH2_HOSTKEY_TYPE_DSS * */ - __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_HOSTKEY_TYPE_RSA); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_HOSTKEY_TYPE_RSA); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_TYPE_RSA, __pyx_t_2) < 0) __PYX_ERR(0, 61, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_TYPE_RSA, __pyx_t_2) < 0) __PYX_ERR(1, 61, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "ssh2/session.pyx":62 @@ -10823,9 +11926,159 @@ if (!__Pyx_RefNanny) { * * */ - __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_HOSTKEY_TYPE_DSS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_HOSTKEY_TYPE_DSS); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_TYPE_DSS, __pyx_t_2) < 0) __PYX_ERR(1, 62, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "ssh2/session.pyx":71 + * + * IF EMBEDDED_LIB: + * LIBSSH2_METHOD_KEX = MethodType(c_ssh2.LIBSSH2_METHOD_KEX) # <<<<<<<<<<<<<< + * LIBSSH2_METHOD_HOSTKEY = MethodType(c_ssh2.LIBSSH2_METHOD_HOSTKEY) + * LIBSSH2_METHOD_CRYPT_CS = MethodType(c_ssh2.LIBSSH2_METHOD_CRYPT_CS) + */ + __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_METHOD_KEX); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 71, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 71, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_KEX, __pyx_t_1) < 0) __PYX_ERR(1, 71, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "ssh2/session.pyx":72 + * IF EMBEDDED_LIB: + * LIBSSH2_METHOD_KEX = MethodType(c_ssh2.LIBSSH2_METHOD_KEX) + * LIBSSH2_METHOD_HOSTKEY = MethodType(c_ssh2.LIBSSH2_METHOD_HOSTKEY) # <<<<<<<<<<<<<< + * LIBSSH2_METHOD_CRYPT_CS = MethodType(c_ssh2.LIBSSH2_METHOD_CRYPT_CS) + * LIBSSH2_METHOD_CRYPT_SC = MethodType(c_ssh2.LIBSSH2_METHOD_CRYPT_SC) + */ + __pyx_t_1 = __Pyx_PyInt_From_int(LIBSSH2_METHOD_HOSTKEY); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_HOSTKEY, __pyx_t_2) < 0) __PYX_ERR(1, 72, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "ssh2/session.pyx":73 + * LIBSSH2_METHOD_KEX = MethodType(c_ssh2.LIBSSH2_METHOD_KEX) + * LIBSSH2_METHOD_HOSTKEY = MethodType(c_ssh2.LIBSSH2_METHOD_HOSTKEY) + * LIBSSH2_METHOD_CRYPT_CS = MethodType(c_ssh2.LIBSSH2_METHOD_CRYPT_CS) # <<<<<<<<<<<<<< + * LIBSSH2_METHOD_CRYPT_SC = MethodType(c_ssh2.LIBSSH2_METHOD_CRYPT_SC) + * LIBSSH2_METHOD_MAC_CS = MethodType(c_ssh2.LIBSSH2_METHOD_MAC_CS) + */ + __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_METHOD_CRYPT_CS); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_CRYPT_CS, __pyx_t_1) < 0) __PYX_ERR(1, 73, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "ssh2/session.pyx":74 + * LIBSSH2_METHOD_HOSTKEY = MethodType(c_ssh2.LIBSSH2_METHOD_HOSTKEY) + * LIBSSH2_METHOD_CRYPT_CS = MethodType(c_ssh2.LIBSSH2_METHOD_CRYPT_CS) + * LIBSSH2_METHOD_CRYPT_SC = MethodType(c_ssh2.LIBSSH2_METHOD_CRYPT_SC) # <<<<<<<<<<<<<< + * LIBSSH2_METHOD_MAC_CS = MethodType(c_ssh2.LIBSSH2_METHOD_MAC_CS) + * LIBSSH2_METHOD_MAC_SC = MethodType(c_ssh2.LIBSSH2_METHOD_MAC_SC) + */ + __pyx_t_1 = __Pyx_PyInt_From_int(LIBSSH2_METHOD_CRYPT_SC); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 74, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 74, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_CRYPT_SC, __pyx_t_2) < 0) __PYX_ERR(1, 74, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "ssh2/session.pyx":75 + * LIBSSH2_METHOD_CRYPT_CS = MethodType(c_ssh2.LIBSSH2_METHOD_CRYPT_CS) + * LIBSSH2_METHOD_CRYPT_SC = MethodType(c_ssh2.LIBSSH2_METHOD_CRYPT_SC) + * LIBSSH2_METHOD_MAC_CS = MethodType(c_ssh2.LIBSSH2_METHOD_MAC_CS) # <<<<<<<<<<<<<< + * LIBSSH2_METHOD_MAC_SC = MethodType(c_ssh2.LIBSSH2_METHOD_MAC_SC) + * LIBSSH2_METHOD_COMP_CS = MethodType(c_ssh2.LIBSSH2_METHOD_COMP_CS) + */ + __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_METHOD_MAC_CS); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 75, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 75, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_MAC_CS, __pyx_t_1) < 0) __PYX_ERR(1, 75, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "ssh2/session.pyx":76 + * LIBSSH2_METHOD_CRYPT_SC = MethodType(c_ssh2.LIBSSH2_METHOD_CRYPT_SC) + * LIBSSH2_METHOD_MAC_CS = MethodType(c_ssh2.LIBSSH2_METHOD_MAC_CS) + * LIBSSH2_METHOD_MAC_SC = MethodType(c_ssh2.LIBSSH2_METHOD_MAC_SC) # <<<<<<<<<<<<<< + * LIBSSH2_METHOD_COMP_CS = MethodType(c_ssh2.LIBSSH2_METHOD_COMP_CS) + * LIBSSH2_METHOD_COMP_SC = MethodType(c_ssh2.LIBSSH2_METHOD_COMP_SC) + */ + __pyx_t_1 = __Pyx_PyInt_From_int(LIBSSH2_METHOD_MAC_SC); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 76, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 76, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_MAC_SC, __pyx_t_2) < 0) __PYX_ERR(1, 76, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "ssh2/session.pyx":77 + * LIBSSH2_METHOD_MAC_CS = MethodType(c_ssh2.LIBSSH2_METHOD_MAC_CS) + * LIBSSH2_METHOD_MAC_SC = MethodType(c_ssh2.LIBSSH2_METHOD_MAC_SC) + * LIBSSH2_METHOD_COMP_CS = MethodType(c_ssh2.LIBSSH2_METHOD_COMP_CS) # <<<<<<<<<<<<<< + * LIBSSH2_METHOD_COMP_SC = MethodType(c_ssh2.LIBSSH2_METHOD_COMP_SC) + * LIBSSH2_METHOD_LANG_CS = MethodType(c_ssh2.LIBSSH2_METHOD_LANG_CS) + */ + __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_METHOD_COMP_CS); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 77, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 77, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_COMP_CS, __pyx_t_1) < 0) __PYX_ERR(1, 77, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "ssh2/session.pyx":78 + * LIBSSH2_METHOD_MAC_SC = MethodType(c_ssh2.LIBSSH2_METHOD_MAC_SC) + * LIBSSH2_METHOD_COMP_CS = MethodType(c_ssh2.LIBSSH2_METHOD_COMP_CS) + * LIBSSH2_METHOD_COMP_SC = MethodType(c_ssh2.LIBSSH2_METHOD_COMP_SC) # <<<<<<<<<<<<<< + * LIBSSH2_METHOD_LANG_CS = MethodType(c_ssh2.LIBSSH2_METHOD_LANG_CS) + * LIBSSH2_METHOD_LANG_SC = MethodType(c_ssh2.LIBSSH2_METHOD_LANG_SC) + */ + __pyx_t_1 = __Pyx_PyInt_From_int(LIBSSH2_METHOD_COMP_SC); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_COMP_SC, __pyx_t_2) < 0) __PYX_ERR(1, 78, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "ssh2/session.pyx":79 + * LIBSSH2_METHOD_COMP_CS = MethodType(c_ssh2.LIBSSH2_METHOD_COMP_CS) + * LIBSSH2_METHOD_COMP_SC = MethodType(c_ssh2.LIBSSH2_METHOD_COMP_SC) + * LIBSSH2_METHOD_LANG_CS = MethodType(c_ssh2.LIBSSH2_METHOD_LANG_CS) # <<<<<<<<<<<<<< + * LIBSSH2_METHOD_LANG_SC = MethodType(c_ssh2.LIBSSH2_METHOD_LANG_SC) + * + */ + __pyx_t_2 = __Pyx_PyInt_From_int(LIBSSH2_METHOD_LANG_CS); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_LANG_CS, __pyx_t_1) < 0) __PYX_ERR(1, 79, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "ssh2/session.pyx":80 + * LIBSSH2_METHOD_COMP_SC = MethodType(c_ssh2.LIBSSH2_METHOD_COMP_SC) + * LIBSSH2_METHOD_LANG_CS = MethodType(c_ssh2.LIBSSH2_METHOD_LANG_CS) + * LIBSSH2_METHOD_LANG_SC = MethodType(c_ssh2.LIBSSH2_METHOD_LANG_SC) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = __Pyx_PyInt_From_int(LIBSSH2_METHOD_LANG_SC); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 80, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_TYPE_DSS, __pyx_t_2) < 0) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_LANG_SC, __pyx_t_2) < 0) __PYX_ERR(1, 80, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "ssh2/session.pyx":1 @@ -10833,9 +12086,9 @@ if (!__Pyx_RefNanny) { * # Copyright (C) 2017-2020 Panos Kittenis * # */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /*--- Wrapped vars code ---*/ @@ -10903,11 +12156,356 @@ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { #if PY_MAJOR_VERSION >= 3 "name '%U' is not defined", name); #else - "name '%.200s' is not defined", PyString_AS_STRING(name)); + "name '%.200s' is not defined", PyString_AS_STRING(name)); +#endif + } + 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, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +/* PyObjectCall */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = func->ob_type->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyErrFetchRestore */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} +#endif + +/* RaiseException */ +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { + __Pyx_PyThreadState_declare + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + if (PyType_Check(type)) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + } + __Pyx_PyThreadState_assign + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} +#else +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + int is_subclass = PyObject_IsSubclass(instance_class, type); + if (!is_subclass) { + instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; + } + } + } + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause) { + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { +#if CYTHON_COMPILING_IN_PYPY + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); +#else + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } #endif } - return result; +bad: + Py_XDECREF(owned_instance); + return; } +#endif /* PyFunctionFastCall */ #if CYTHON_FAST_PYCALL @@ -11028,26 +12626,6 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #endif #endif -/* PyObjectCall */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = func->ob_type->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - /* PyObjectCallMethO */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { @@ -11153,32 +12731,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObjec } #endif -/* RaiseArgTupleInvalid */ -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) -{ - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); -} - /* KeywordStringCheck */ static int __Pyx_CheckKeywordStrings( PyObject *kwdict, @@ -11216,195 +12768,79 @@ static int __Pyx_CheckKeywordStrings( "%s() got an unexpected keyword argument '%U'", function_name, key); #endif - return 0; -} - -/* UnpackUnboundCMethod */ -static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { - PyObject *method; - method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); - if (unlikely(!method)) - return -1; - target->method = method; -#if CYTHON_COMPILING_IN_CPYTHON - #if PY_MAJOR_VERSION >= 3 - if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) - #endif - { - PyMethodDescrObject *descr = (PyMethodDescrObject*) method; - target->func = descr->d_method->ml_meth; - target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS); - } -#endif - return 0; -} - -/* CallUnboundCMethod1 */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) { - if (likely(cfunc->func)) { - int flag = cfunc->flag; - if (flag == METH_O) { - return (*(cfunc->func))(self, arg); - } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) { - if (PY_VERSION_HEX >= 0x030700A0) { - return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1); - } else { - return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); - } - } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) { - return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); - } - } - return __Pyx__CallUnboundCMethod1(cfunc, self, arg); -} -#endif -static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){ - PyObject *args, *result = NULL; - if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; -#if CYTHON_COMPILING_IN_CPYTHON - if (cfunc->func && (cfunc->flag & METH_VARARGS)) { - args = PyTuple_New(1); - if (unlikely(!args)) goto bad; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - if (cfunc->flag & METH_KEYWORDS) - result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL); - else - result = (*cfunc->func)(self, args); - } else { - args = PyTuple_New(2); - if (unlikely(!args)) goto bad; - Py_INCREF(self); - PyTuple_SET_ITEM(args, 0, self); - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 1, arg); - result = __Pyx_PyObject_Call(cfunc->method, args, NULL); - } -#else - args = PyTuple_Pack(2, self, arg); - if (unlikely(!args)) goto bad; - result = __Pyx_PyObject_Call(cfunc->method, args, NULL); -#endif -bad: - Py_XDECREF(args); - 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 + return 0; +} + +/* UnpackUnboundCMethod */ +static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { + PyObject *method; + method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); + if (unlikely(!method)) + return -1; + target->method = method; +#if CYTHON_COMPILING_IN_CPYTHON + #if PY_MAJOR_VERSION >= 3 + if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) + #endif + { + PyMethodDescrObject *descr = (PyMethodDescrObject*) method; + target->func = descr->d_method->ml_meth; + target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS); + } +#endif + return 0; +} + +/* CallUnboundCMethod1 */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) { + if (likely(cfunc->func)) { + int flag = cfunc->flag; + if (flag == METH_O) { + return (*(cfunc->func))(self, arg); + } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) { + if (PY_VERSION_HEX >= 0x030700A0) { + return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1); + } else { + return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); + } + } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) { + return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); + } + } + return __Pyx__CallUnboundCMethod1(cfunc, self, arg); +} +#endif +static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){ + PyObject *args, *result = NULL; + if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_COMPILING_IN_CPYTHON + if (cfunc->func && (cfunc->flag & METH_VARARGS)) { + args = PyTuple_New(1); + if (unlikely(!args)) goto bad; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + if (cfunc->flag & METH_KEYWORDS) + result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL); + else + result = (*cfunc->func)(self, args); + } else { + args = PyTuple_New(2); + if (unlikely(!args)) goto bad; + Py_INCREF(self); + PyTuple_SET_ITEM(args, 0, self); + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 1, arg); + result = __Pyx_PyObject_Call(cfunc->method, args, NULL); + } +#else + args = PyTuple_Pack(2, self, arg); + if (unlikely(!args)) goto bad; + result = __Pyx_PyObject_Call(cfunc->method, args, NULL); +#endif bad: - return -1; + Py_XDECREF(args); + return result; } /* ArgTypeTest */ @@ -12089,30 +13525,6 @@ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qual return op; } -/* PyErrFetchRestore */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} -#endif - /* GetException */ #if CYTHON_FAST_THREAD_STATE static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) @@ -12339,165 +13751,6 @@ static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) return __Pyx_GetBuiltinName(name); } -/* RaiseException */ -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { - __Pyx_PyThreadState_declare - Py_XINCREF(type); - if (!value || value == Py_None) - value = NULL; - else - Py_INCREF(value); - if (!tb || tb == Py_None) - tb = NULL; - else { - Py_INCREF(tb); - if (!PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - } - if (PyType_Check(type)) { -#if CYTHON_COMPILING_IN_PYPY - if (!value) { - Py_INCREF(Py_None); - value = Py_None; - } -#endif - PyErr_NormalizeException(&type, &value, &tb); - } else { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - value = type; - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; - } - } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} -#else -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (PyExceptionClass_Check(type)) { - PyObject *instance_class = NULL; - if (value && PyExceptionInstance_Check(value)) { - instance_class = (PyObject*) Py_TYPE(value); - if (instance_class != type) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; - } - } - } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; - } - } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } - if (cause) { - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else if (PyExceptionClass_Check(cause)) { - fixed_cause = PyObject_CallObject(cause, NULL); - if (fixed_cause == NULL) - goto bad; - } else if (PyExceptionInstance_Check(cause)) { - fixed_cause = cause; - Py_INCREF(fixed_cause); - } else { - PyErr_SetString(PyExc_TypeError, - "exception causes must derive from " - "BaseException"); - goto bad; - } - PyException_SetCause(value, fixed_cause); - } - PyErr_SetObject(type, value); - if (tb) { -#if CYTHON_COMPILING_IN_PYPY - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); -#else - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); - } -#endif - } -bad: - Py_XDECREF(owned_instance); - return; -} -#endif - /* PyObjectCall2Args */ static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { PyObject *args, *result = NULL; diff --git a/ssh2/session.pxd b/ssh2/session.pxd index 31f423ad..0231dbdd 100644 --- a/ssh2/session.pxd +++ b/ssh2/session.pxd @@ -21,3 +21,7 @@ cdef class Session: cdef int _sock cdef readonly object sock cdef readonly object _kbd_callback + + +cdef class MethodType: + cdef int value diff --git a/ssh2/session.pyx b/ssh2/session.pyx index f7d8e0c5..c6c3ea04 100644 --- a/ssh2/session.pyx +++ b/ssh2/session.pyx @@ -62,6 +62,24 @@ LIBSSH2_HOSTKEY_TYPE_RSA = c_ssh2.LIBSSH2_HOSTKEY_TYPE_RSA LIBSSH2_HOSTKEY_TYPE_DSS = c_ssh2.LIBSSH2_HOSTKEY_TYPE_DSS +cdef class MethodType: + def __cinit__(self, value): + self.value = value + + +IF EMBEDDED_LIB: + LIBSSH2_METHOD_KEX = MethodType(c_ssh2.LIBSSH2_METHOD_KEX) + LIBSSH2_METHOD_HOSTKEY = MethodType(c_ssh2.LIBSSH2_METHOD_HOSTKEY) + LIBSSH2_METHOD_CRYPT_CS = MethodType(c_ssh2.LIBSSH2_METHOD_CRYPT_CS) + LIBSSH2_METHOD_CRYPT_SC = MethodType(c_ssh2.LIBSSH2_METHOD_CRYPT_SC) + LIBSSH2_METHOD_MAC_CS = MethodType(c_ssh2.LIBSSH2_METHOD_MAC_CS) + LIBSSH2_METHOD_MAC_SC = MethodType(c_ssh2.LIBSSH2_METHOD_MAC_SC) + LIBSSH2_METHOD_COMP_CS = MethodType(c_ssh2.LIBSSH2_METHOD_COMP_CS) + LIBSSH2_METHOD_COMP_SC = MethodType(c_ssh2.LIBSSH2_METHOD_COMP_SC) + LIBSSH2_METHOD_LANG_CS = MethodType(c_ssh2.LIBSSH2_METHOD_LANG_CS) + LIBSSH2_METHOD_LANG_SC = MethodType(c_ssh2.LIBSSH2_METHOD_LANG_SC) + + cdef void kbd_callback(const char *name, int name_len, const char *instruction, int instruction_len, int num_prompts, @@ -726,3 +744,65 @@ cdef class Session: rc = c_ssh2.libssh2_keepalive_send(self._session, &c_seconds) handle_error_codes(rc) return c_seconds + + def supported_algs(self, MethodType method_type): + """Get supportd algorithms for method type. + + :param method_type: Type of method to get + :type method_type: :py:class:`MethodType` + + :returns: List of supported algorithms. + :rtype: list(str) + """ + cdef const char **c_algs + cdef int rc + with nogil: + rc = c_ssh2.libssh2_session_supported_algs( + self._session, method_type.value, &c_algs) + if rc < 0: + return handle_error_codes(rc) + elif rc == 0: + return [] + try: + algs = [to_str(c_algs[i]) for i in range(rc)] + finally: + with nogil: + c_ssh2.libssh2_free(self._session, c_algs) + return algs + + def methods(self, MethodType method_type): + """Get currently active algorithms for method type. + + :param method_type: Type of method to get + :type method_type: :py:class:`MethodType` + + :rtype: str + """ + with nogil: + methods = c_ssh2.libssh2_session_methods( + self._session, method_type.value) + return to_str(methods) + + def method_pref(self, MethodType method_type, prefs not None): + """Set preference for session method. + + See :py:func:`Session.supported_algs` for supported algorithms + for method type. + + :param method_type: A supported session method LIBSSH2_METHOD_* + :type method_type: :py:class:`MethodType` + :param prefs: Algorithm preference for method type provided. + :type prefs: str + + :rtype: int + :raises: :py:class:`ssh2.exceptions.MethodNotSupported` + on unsupported method preference + """ + cdef bytes b_prefs = to_bytes(prefs) + cdef const char *c_prefs = b_prefs + cdef int rc + with nogil: + rc = c_ssh2.libssh2_session_method_pref( + self._session, method_type.value, c_prefs) + handle_error_codes(rc) + return rc diff --git a/ssh2/utils.c b/ssh2/utils.c index f3483d49..0d7696b4 100644 --- a/ssh2/utils.c +++ b/ssh2/utils.c @@ -837,6 +837,7 @@ static const char *__pyx_f[] = { /*--- Type declarations ---*/ struct __pyx_obj_4ssh2_7session_Session; +struct __pyx_obj_4ssh2_7session_MethodType; /* "session.pxd":19 * cimport c_ssh2 @@ -854,6 +855,18 @@ struct __pyx_obj_4ssh2_7session_Session { }; +/* "session.pxd":26 + * + * + * cdef class MethodType: # <<<<<<<<<<<<<< + * cdef int value + */ +struct __pyx_obj_4ssh2_7session_MethodType { + PyObject_HEAD + int value; +}; + + /* --- Runtime support code (head) --- */ /* Refnanny.proto */ #ifndef CYTHON_REFNANNY @@ -1182,6 +1195,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'ssh2.session' */ static PyTypeObject *__pyx_ptype_4ssh2_7session_Session = 0; +static PyTypeObject *__pyx_ptype_4ssh2_7session_MethodType = 0; /* Module declarations from 'ssh2.error_codes' */ @@ -1220,6 +1234,7 @@ static const char __pyx_k_FileError[] = "FileError"; static const char __pyx_k_SSH2Error[] = "SSH2Error"; static const char __pyx_k_ZlibError[] = "ZlibError"; static const char __pyx_k_ssh2_exit[] = "ssh2_exit"; +static const char __pyx_k_AllocError[] = "AllocError"; static const char __pyx_k_directions[] = "directions"; static const char __pyx_k_exceptions[] = "exceptions"; static const char __pyx_k_ssh2_utils[] = "ssh2.utils"; @@ -1237,6 +1252,8 @@ static const char __pyx_k_KnownHostError[] = "KnownHostError"; static const char __pyx_k_ssh2_utils_pyx[] = "ssh2/utils.pyx"; static const char __pyx_k_BannerRecvError[] = "BannerRecvError"; static const char __pyx_k_BannerSendError[] = "BannerSendError"; +static const char __pyx_k_InvalidMACError[] = "InvalidMACError"; +static const char __pyx_k_KexFailureError[] = "KexFailureError"; static const char __pyx_k_MethodNoneError[] = "MethodNoneError"; static const char __pyx_k_SocketRecvError[] = "SocketRecvError"; static const char __pyx_k_SocketSendError[] = "SocketSendError"; @@ -1265,10 +1282,13 @@ static const char __pyx_k_ChannelPacketExceeded[] = "ChannelPacketExceeded"; static const char __pyx_k_ChannelWindowExceeded[] = "ChannelWindowExceeded"; static const char __pyx_k_SocketDisconnectError[] = "SocketDisconnectError"; static const char __pyx_k_ChannelOutOfOrderError[] = "ChannelOutOfOrderError"; +static const char __pyx_k_ChannelWindowFullError[] = "ChannelWindowFullError"; static const char __pyx_k_Error_code_s_not_known[] = "Error code %s not known"; +static const char __pyx_k_KeyfileAuthFailedError[] = "KeyfileAuthFailedError"; static const char __pyx_k_PublicKeyProtocolError[] = "PublicKeyProtocolError"; static const char __pyx_k_PublickeyUnverifiedError[] = "PublickeyUnverifiedError"; static PyObject *__pyx_n_s_AgentProtocolError; +static PyObject *__pyx_n_s_AllocError; static PyObject *__pyx_n_s_AuthenticationError; static PyObject *__pyx_n_s_BadSocketError; static PyObject *__pyx_n_s_BadUseError; @@ -1283,6 +1303,7 @@ static PyObject *__pyx_n_s_ChannelPacketExceeded; static PyObject *__pyx_n_s_ChannelRequestDenied; static PyObject *__pyx_n_s_ChannelUnknownError; static PyObject *__pyx_n_s_ChannelWindowExceeded; +static PyObject *__pyx_n_s_ChannelWindowFullError; static PyObject *__pyx_n_s_CompressError; static PyObject *__pyx_n_s_DecryptError; static PyObject *__pyx_n_s_ENCODING; @@ -1291,9 +1312,12 @@ static PyObject *__pyx_kp_s_Error_code_s_not_known; static PyObject *__pyx_n_s_FileError; static PyObject *__pyx_n_s_HostkeyInitError; static PyObject *__pyx_n_s_HostkeySignError; +static PyObject *__pyx_n_s_InvalidMACError; static PyObject *__pyx_n_s_InvalidPollTypeError; static PyObject *__pyx_n_s_InvalidRequestError; +static PyObject *__pyx_n_s_KexFailureError; static PyObject *__pyx_n_s_KeyExchangeError; +static PyObject *__pyx_n_s_KeyfileAuthFailedError; static PyObject *__pyx_n_s_KnownHostError; static PyObject *__pyx_n_s_MethodNoneError; static PyObject *__pyx_n_s_MethodNotSupported; @@ -2726,8 +2750,8 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U * raise exceptions.BannerRecvError * elif errcode == error_codes._LIBSSH2_ERROR_BANNER_SEND: * raise exceptions.BannerSendError # <<<<<<<<<<<<<< - * elif errcode == error_codes._LIBSSH2_ERROR_KEY_EXCHANGE_FAILURE: - * raise exceptions.KeyExchangeError + * elif errcode == error_codes._LIBSSH2_ERROR_INVALID_MAC: + * raise exceptions.InvalidMACError */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -2743,21 +2767,21 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U * raise exceptions.BannerRecvError * elif errcode == error_codes._LIBSSH2_ERROR_BANNER_SEND: # <<<<<<<<<<<<<< * raise exceptions.BannerSendError - * elif errcode == error_codes._LIBSSH2_ERROR_KEY_EXCHANGE_FAILURE: + * elif errcode == error_codes._LIBSSH2_ERROR_INVALID_MAC: */ break; - case LIBSSH2_ERROR_KEY_EXCHANGE_FAILURE: + case LIBSSH2_ERROR_INVALID_MAC: /* "ssh2/utils.pyx":138 * raise exceptions.BannerSendError - * elif errcode == error_codes._LIBSSH2_ERROR_KEY_EXCHANGE_FAILURE: - * raise exceptions.KeyExchangeError # <<<<<<<<<<<<<< - * elif errcode == error_codes._LIBSSH2_ERROR_TIMEOUT: - * raise exceptions.Timeout + * elif errcode == error_codes._LIBSSH2_ERROR_INVALID_MAC: + * raise exceptions.InvalidMACError # <<<<<<<<<<<<<< + * elif errcode == error_codes._LIBSSH2_ERROR_KEX_FAILURE: + * raise exceptions.KexFailureError */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_KeyExchangeError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_InvalidMACError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); @@ -2767,6 +2791,110 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U /* "ssh2/utils.pyx":137 * elif errcode == error_codes._LIBSSH2_ERROR_BANNER_SEND: * raise exceptions.BannerSendError + * elif errcode == error_codes._LIBSSH2_ERROR_INVALID_MAC: # <<<<<<<<<<<<<< + * raise exceptions.InvalidMACError + * elif errcode == error_codes._LIBSSH2_ERROR_KEX_FAILURE: + */ + break; + case LIBSSH2_ERROR_KEX_FAILURE: + + /* "ssh2/utils.pyx":140 + * raise exceptions.InvalidMACError + * elif errcode == error_codes._LIBSSH2_ERROR_KEX_FAILURE: + * raise exceptions.KexFailureError # <<<<<<<<<<<<<< + * elif errcode == error_codes._LIBSSH2_ERROR_ALLOC: + * raise exceptions.AllocError + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 140, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_KexFailureError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 140, __pyx_L1_error) + + /* "ssh2/utils.pyx":139 + * elif errcode == error_codes._LIBSSH2_ERROR_INVALID_MAC: + * raise exceptions.InvalidMACError + * elif errcode == error_codes._LIBSSH2_ERROR_KEX_FAILURE: # <<<<<<<<<<<<<< + * raise exceptions.KexFailureError + * elif errcode == error_codes._LIBSSH2_ERROR_ALLOC: + */ + break; + case LIBSSH2_ERROR_ALLOC: + + /* "ssh2/utils.pyx":142 + * raise exceptions.KexFailureError + * elif errcode == error_codes._LIBSSH2_ERROR_ALLOC: + * raise exceptions.AllocError # <<<<<<<<<<<<<< + * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_SEND: + * raise exceptions.SocketSendError + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_AllocError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 142, __pyx_L1_error) + + /* "ssh2/utils.pyx":141 + * elif errcode == error_codes._LIBSSH2_ERROR_KEX_FAILURE: + * raise exceptions.KexFailureError + * elif errcode == error_codes._LIBSSH2_ERROR_ALLOC: # <<<<<<<<<<<<<< + * raise exceptions.AllocError + * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_SEND: + */ + break; + case LIBSSH2_ERROR_SOCKET_SEND: + + /* "ssh2/utils.pyx":144 + * raise exceptions.AllocError + * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_SEND: + * raise exceptions.SocketSendError # <<<<<<<<<<<<<< + * elif errcode == error_codes._LIBSSH2_ERROR_KEY_EXCHANGE_FAILURE: + * raise exceptions.KeyExchangeError + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_SocketSendError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 144, __pyx_L1_error) + + /* "ssh2/utils.pyx":143 + * elif errcode == error_codes._LIBSSH2_ERROR_ALLOC: + * raise exceptions.AllocError + * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_SEND: # <<<<<<<<<<<<<< + * raise exceptions.SocketSendError + * elif errcode == error_codes._LIBSSH2_ERROR_KEY_EXCHANGE_FAILURE: + */ + break; + case LIBSSH2_ERROR_KEY_EXCHANGE_FAILURE: + + /* "ssh2/utils.pyx":146 + * raise exceptions.SocketSendError + * elif errcode == error_codes._LIBSSH2_ERROR_KEY_EXCHANGE_FAILURE: + * raise exceptions.KeyExchangeError # <<<<<<<<<<<<<< + * elif errcode == error_codes._LIBSSH2_ERROR_TIMEOUT: + * raise exceptions.Timeout + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_KeyExchangeError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 146, __pyx_L1_error) + + /* "ssh2/utils.pyx":145 + * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_SEND: + * raise exceptions.SocketSendError * elif errcode == error_codes._LIBSSH2_ERROR_KEY_EXCHANGE_FAILURE: # <<<<<<<<<<<<<< * raise exceptions.KeyExchangeError * elif errcode == error_codes._LIBSSH2_ERROR_TIMEOUT: @@ -2774,23 +2902,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_TIMEOUT: - /* "ssh2/utils.pyx":140 + /* "ssh2/utils.pyx":148 * raise exceptions.KeyExchangeError * elif errcode == error_codes._LIBSSH2_ERROR_TIMEOUT: * raise exceptions.Timeout # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_HOSTKEY_INIT: * raise exceptions.HostkeyInitError */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 140, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Timeout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Timeout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 140, __pyx_L1_error) + __PYX_ERR(0, 148, __pyx_L1_error) - /* "ssh2/utils.pyx":139 + /* "ssh2/utils.pyx":147 * elif errcode == error_codes._LIBSSH2_ERROR_KEY_EXCHANGE_FAILURE: * raise exceptions.KeyExchangeError * elif errcode == error_codes._LIBSSH2_ERROR_TIMEOUT: # <<<<<<<<<<<<<< @@ -2800,23 +2928,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_HOSTKEY_INIT: - /* "ssh2/utils.pyx":142 + /* "ssh2/utils.pyx":150 * raise exceptions.Timeout * elif errcode == error_codes._LIBSSH2_ERROR_HOSTKEY_INIT: * raise exceptions.HostkeyInitError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_HOSTKEY_SIGN: * raise exceptions.HostkeySignError */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_HostkeyInitError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_HostkeyInitError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 142, __pyx_L1_error) + __PYX_ERR(0, 150, __pyx_L1_error) - /* "ssh2/utils.pyx":141 + /* "ssh2/utils.pyx":149 * elif errcode == error_codes._LIBSSH2_ERROR_TIMEOUT: * raise exceptions.Timeout * elif errcode == error_codes._LIBSSH2_ERROR_HOSTKEY_INIT: # <<<<<<<<<<<<<< @@ -2826,23 +2954,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_HOSTKEY_SIGN: - /* "ssh2/utils.pyx":144 + /* "ssh2/utils.pyx":152 * raise exceptions.HostkeyInitError * elif errcode == error_codes._LIBSSH2_ERROR_HOSTKEY_SIGN: * raise exceptions.HostkeySignError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_DECRYPT: * raise exceptions.DecryptError */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_HostkeySignError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_HostkeySignError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 144, __pyx_L1_error) + __PYX_ERR(0, 152, __pyx_L1_error) - /* "ssh2/utils.pyx":143 + /* "ssh2/utils.pyx":151 * elif errcode == error_codes._LIBSSH2_ERROR_HOSTKEY_INIT: * raise exceptions.HostkeyInitError * elif errcode == error_codes._LIBSSH2_ERROR_HOSTKEY_SIGN: # <<<<<<<<<<<<<< @@ -2852,23 +2980,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_DECRYPT: - /* "ssh2/utils.pyx":146 + /* "ssh2/utils.pyx":154 * raise exceptions.HostkeySignError * elif errcode == error_codes._LIBSSH2_ERROR_DECRYPT: * raise exceptions.DecryptError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_DISCONNECT: * raise exceptions.SocketDisconnectError */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_DecryptError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_DecryptError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 146, __pyx_L1_error) + __PYX_ERR(0, 154, __pyx_L1_error) - /* "ssh2/utils.pyx":145 + /* "ssh2/utils.pyx":153 * elif errcode == error_codes._LIBSSH2_ERROR_HOSTKEY_SIGN: * raise exceptions.HostkeySignError * elif errcode == error_codes._LIBSSH2_ERROR_DECRYPT: # <<<<<<<<<<<<<< @@ -2878,23 +3006,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_SOCKET_DISCONNECT: - /* "ssh2/utils.pyx":148 + /* "ssh2/utils.pyx":156 * raise exceptions.DecryptError * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_DISCONNECT: * raise exceptions.SocketDisconnectError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_PROTO: * raise exceptions.ProtocolError */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_SocketDisconnectError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_SocketDisconnectError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 148, __pyx_L1_error) + __PYX_ERR(0, 156, __pyx_L1_error) - /* "ssh2/utils.pyx":147 + /* "ssh2/utils.pyx":155 * elif errcode == error_codes._LIBSSH2_ERROR_DECRYPT: * raise exceptions.DecryptError * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_DISCONNECT: # <<<<<<<<<<<<<< @@ -2904,23 +3032,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_PROTO: - /* "ssh2/utils.pyx":150 + /* "ssh2/utils.pyx":158 * raise exceptions.SocketDisconnectError * elif errcode == error_codes._LIBSSH2_ERROR_PROTO: * raise exceptions.ProtocolError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_PASSWORD_EXPIRED: * raise exceptions.PasswordExpiredError */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 158, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ProtocolError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ProtocolError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 150, __pyx_L1_error) + __PYX_ERR(0, 158, __pyx_L1_error) - /* "ssh2/utils.pyx":149 + /* "ssh2/utils.pyx":157 * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_DISCONNECT: * raise exceptions.SocketDisconnectError * elif errcode == error_codes._LIBSSH2_ERROR_PROTO: # <<<<<<<<<<<<<< @@ -2930,23 +3058,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_PASSWORD_EXPIRED: - /* "ssh2/utils.pyx":152 + /* "ssh2/utils.pyx":160 * raise exceptions.ProtocolError * elif errcode == error_codes._LIBSSH2_ERROR_PASSWORD_EXPIRED: * raise exceptions.PasswordExpiredError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_FILE: * raise exceptions.FileError */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_PasswordExpiredError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 152, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_PasswordExpiredError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 152, __pyx_L1_error) + __PYX_ERR(0, 160, __pyx_L1_error) - /* "ssh2/utils.pyx":151 + /* "ssh2/utils.pyx":159 * elif errcode == error_codes._LIBSSH2_ERROR_PROTO: * raise exceptions.ProtocolError * elif errcode == error_codes._LIBSSH2_ERROR_PASSWORD_EXPIRED: # <<<<<<<<<<<<<< @@ -2956,23 +3084,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_FILE: - /* "ssh2/utils.pyx":154 + /* "ssh2/utils.pyx":162 * raise exceptions.PasswordExpiredError * elif errcode == error_codes._LIBSSH2_ERROR_FILE: * raise exceptions.FileError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_METHOD_NONE: * raise exceptions.MethodNoneError */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FileError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FileError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 154, __pyx_L1_error) + __PYX_ERR(0, 162, __pyx_L1_error) - /* "ssh2/utils.pyx":153 + /* "ssh2/utils.pyx":161 * elif errcode == error_codes._LIBSSH2_ERROR_PASSWORD_EXPIRED: * raise exceptions.PasswordExpiredError * elif errcode == error_codes._LIBSSH2_ERROR_FILE: # <<<<<<<<<<<<<< @@ -2982,23 +3110,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_METHOD_NONE: - /* "ssh2/utils.pyx":156 + /* "ssh2/utils.pyx":164 * raise exceptions.FileError * elif errcode == error_codes._LIBSSH2_ERROR_METHOD_NONE: * raise exceptions.MethodNoneError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_AUTHENTICATION_FAILED: * raise exceptions.AuthenticationError */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_MethodNoneError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_MethodNoneError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 156, __pyx_L1_error) + __PYX_ERR(0, 164, __pyx_L1_error) - /* "ssh2/utils.pyx":155 + /* "ssh2/utils.pyx":163 * elif errcode == error_codes._LIBSSH2_ERROR_FILE: * raise exceptions.FileError * elif errcode == error_codes._LIBSSH2_ERROR_METHOD_NONE: # <<<<<<<<<<<<<< @@ -3008,23 +3136,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_AUTHENTICATION_FAILED: - /* "ssh2/utils.pyx":158 + /* "ssh2/utils.pyx":166 * raise exceptions.MethodNoneError * elif errcode == error_codes._LIBSSH2_ERROR_AUTHENTICATION_FAILED: * raise exceptions.AuthenticationError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED: * raise exceptions.PublickeyUnverifiedError */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_AuthenticationError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_AuthenticationError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 158, __pyx_L1_error) + __PYX_ERR(0, 166, __pyx_L1_error) - /* "ssh2/utils.pyx":157 + /* "ssh2/utils.pyx":165 * elif errcode == error_codes._LIBSSH2_ERROR_METHOD_NONE: * raise exceptions.MethodNoneError * elif errcode == error_codes._LIBSSH2_ERROR_AUTHENTICATION_FAILED: # <<<<<<<<<<<<<< @@ -3034,23 +3162,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED: - /* "ssh2/utils.pyx":160 + /* "ssh2/utils.pyx":168 * raise exceptions.AuthenticationError * elif errcode == error_codes._LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED: * raise exceptions.PublickeyUnverifiedError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_OUTOFORDER: * raise exceptions.ChannelOutOfOrderError */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_PublickeyUnverifiedError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 160, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_PublickeyUnverifiedError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 160, __pyx_L1_error) + __PYX_ERR(0, 168, __pyx_L1_error) - /* "ssh2/utils.pyx":159 + /* "ssh2/utils.pyx":167 * elif errcode == error_codes._LIBSSH2_ERROR_AUTHENTICATION_FAILED: * raise exceptions.AuthenticationError * elif errcode == error_codes._LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED: # <<<<<<<<<<<<<< @@ -3060,23 +3188,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_CHANNEL_OUTOFORDER: - /* "ssh2/utils.pyx":162 + /* "ssh2/utils.pyx":170 * raise exceptions.PublickeyUnverifiedError * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_OUTOFORDER: * raise exceptions.ChannelOutOfOrderError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_FAILURE: * raise exceptions.ChannelFailure */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ChannelOutOfOrderError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ChannelOutOfOrderError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 162, __pyx_L1_error) + __PYX_ERR(0, 170, __pyx_L1_error) - /* "ssh2/utils.pyx":161 + /* "ssh2/utils.pyx":169 * elif errcode == error_codes._LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED: * raise exceptions.PublickeyUnverifiedError * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_OUTOFORDER: # <<<<<<<<<<<<<< @@ -3086,23 +3214,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_CHANNEL_FAILURE: - /* "ssh2/utils.pyx":164 + /* "ssh2/utils.pyx":172 * raise exceptions.ChannelOutOfOrderError * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_FAILURE: * raise exceptions.ChannelFailure # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_REQUEST_DENIED: * raise exceptions.ChannelRequestDenied */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 164, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ChannelFailure); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 164, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ChannelFailure); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 164, __pyx_L1_error) + __PYX_ERR(0, 172, __pyx_L1_error) - /* "ssh2/utils.pyx":163 + /* "ssh2/utils.pyx":171 * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_OUTOFORDER: * raise exceptions.ChannelOutOfOrderError * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_FAILURE: # <<<<<<<<<<<<<< @@ -3112,23 +3240,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_CHANNEL_REQUEST_DENIED: - /* "ssh2/utils.pyx":166 + /* "ssh2/utils.pyx":174 * raise exceptions.ChannelFailure * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_REQUEST_DENIED: * raise exceptions.ChannelRequestDenied # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_UNKNOWN: * raise exceptions.ChannelUnknownError */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ChannelRequestDenied); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ChannelRequestDenied); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 166, __pyx_L1_error) + __PYX_ERR(0, 174, __pyx_L1_error) - /* "ssh2/utils.pyx":165 + /* "ssh2/utils.pyx":173 * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_FAILURE: * raise exceptions.ChannelFailure * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_REQUEST_DENIED: # <<<<<<<<<<<<<< @@ -3138,23 +3266,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_CHANNEL_UNKNOWN: - /* "ssh2/utils.pyx":168 + /* "ssh2/utils.pyx":176 * raise exceptions.ChannelRequestDenied * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_UNKNOWN: * raise exceptions.ChannelUnknownError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_WINDOW_EXCEEDED: * raise exceptions.ChannelWindowExceeded */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ChannelUnknownError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ChannelUnknownError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 176, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 168, __pyx_L1_error) + __PYX_ERR(0, 176, __pyx_L1_error) - /* "ssh2/utils.pyx":167 + /* "ssh2/utils.pyx":175 * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_REQUEST_DENIED: * raise exceptions.ChannelRequestDenied * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_UNKNOWN: # <<<<<<<<<<<<<< @@ -3164,23 +3292,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_CHANNEL_WINDOW_EXCEEDED: - /* "ssh2/utils.pyx":170 + /* "ssh2/utils.pyx":178 * raise exceptions.ChannelUnknownError * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_WINDOW_EXCEEDED: * raise exceptions.ChannelWindowExceeded # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_PACKET_EXCEEDED: * raise exceptions.ChannelPacketExceeded */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ChannelWindowExceeded); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ChannelWindowExceeded); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 170, __pyx_L1_error) + __PYX_ERR(0, 178, __pyx_L1_error) - /* "ssh2/utils.pyx":169 + /* "ssh2/utils.pyx":177 * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_UNKNOWN: * raise exceptions.ChannelUnknownError * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_WINDOW_EXCEEDED: # <<<<<<<<<<<<<< @@ -3190,23 +3318,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_CHANNEL_PACKET_EXCEEDED: - /* "ssh2/utils.pyx":172 + /* "ssh2/utils.pyx":180 * raise exceptions.ChannelWindowExceeded * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_PACKET_EXCEEDED: * raise exceptions.ChannelPacketExceeded # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_CLOSED: * raise exceptions.ChannelClosedError */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ChannelPacketExceeded); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ChannelPacketExceeded); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 172, __pyx_L1_error) + __PYX_ERR(0, 180, __pyx_L1_error) - /* "ssh2/utils.pyx":171 + /* "ssh2/utils.pyx":179 * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_WINDOW_EXCEEDED: * raise exceptions.ChannelWindowExceeded * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_PACKET_EXCEEDED: # <<<<<<<<<<<<<< @@ -3216,23 +3344,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_CHANNEL_CLOSED: - /* "ssh2/utils.pyx":174 + /* "ssh2/utils.pyx":182 * raise exceptions.ChannelPacketExceeded * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_CLOSED: * raise exceptions.ChannelClosedError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_EOF_SENT: * raise exceptions.ChannelEOFSentError */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ChannelClosedError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ChannelClosedError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 174, __pyx_L1_error) + __PYX_ERR(0, 182, __pyx_L1_error) - /* "ssh2/utils.pyx":173 + /* "ssh2/utils.pyx":181 * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_PACKET_EXCEEDED: * raise exceptions.ChannelPacketExceeded * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_CLOSED: # <<<<<<<<<<<<<< @@ -3242,23 +3370,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_CHANNEL_EOF_SENT: - /* "ssh2/utils.pyx":176 + /* "ssh2/utils.pyx":184 * raise exceptions.ChannelClosedError * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_EOF_SENT: * raise exceptions.ChannelEOFSentError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_SCP_PROTOCOL: * raise exceptions.SCPProtocolError */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ChannelEOFSentError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 176, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ChannelEOFSentError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 184, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 176, __pyx_L1_error) + __PYX_ERR(0, 184, __pyx_L1_error) - /* "ssh2/utils.pyx":175 + /* "ssh2/utils.pyx":183 * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_CLOSED: * raise exceptions.ChannelClosedError * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_EOF_SENT: # <<<<<<<<<<<<<< @@ -3268,23 +3396,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_SCP_PROTOCOL: - /* "ssh2/utils.pyx":178 + /* "ssh2/utils.pyx":186 * raise exceptions.ChannelEOFSentError * elif errcode == error_codes._LIBSSH2_ERROR_SCP_PROTOCOL: * raise exceptions.SCPProtocolError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_ZLIB: * raise exceptions.ZlibError */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_SCPProtocolError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_SCPProtocolError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 178, __pyx_L1_error) + __PYX_ERR(0, 186, __pyx_L1_error) - /* "ssh2/utils.pyx":177 + /* "ssh2/utils.pyx":185 * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_EOF_SENT: * raise exceptions.ChannelEOFSentError * elif errcode == error_codes._LIBSSH2_ERROR_SCP_PROTOCOL: # <<<<<<<<<<<<<< @@ -3294,23 +3422,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_ZLIB: - /* "ssh2/utils.pyx":180 + /* "ssh2/utils.pyx":188 * raise exceptions.SCPProtocolError * elif errcode == error_codes._LIBSSH2_ERROR_ZLIB: * raise exceptions.ZlibError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_TIMEOUT: * raise exceptions.SocketTimeout */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 188, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ZlibError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ZlibError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 188, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 180, __pyx_L1_error) + __PYX_ERR(0, 188, __pyx_L1_error) - /* "ssh2/utils.pyx":179 + /* "ssh2/utils.pyx":187 * elif errcode == error_codes._LIBSSH2_ERROR_SCP_PROTOCOL: * raise exceptions.SCPProtocolError * elif errcode == error_codes._LIBSSH2_ERROR_ZLIB: # <<<<<<<<<<<<<< @@ -3320,23 +3448,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_SOCKET_TIMEOUT: - /* "ssh2/utils.pyx":182 + /* "ssh2/utils.pyx":190 * raise exceptions.ZlibError * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_TIMEOUT: * raise exceptions.SocketTimeout # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_SFTP_PROTOCOL: * raise exceptions.SFTPProtocolError */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_SocketTimeout); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_SocketTimeout); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 182, __pyx_L1_error) + __PYX_ERR(0, 190, __pyx_L1_error) - /* "ssh2/utils.pyx":181 + /* "ssh2/utils.pyx":189 * elif errcode == error_codes._LIBSSH2_ERROR_ZLIB: * raise exceptions.ZlibError * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_TIMEOUT: # <<<<<<<<<<<<<< @@ -3346,23 +3474,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_SFTP_PROTOCOL: - /* "ssh2/utils.pyx":184 + /* "ssh2/utils.pyx":192 * raise exceptions.SocketTimeout * elif errcode == error_codes._LIBSSH2_ERROR_SFTP_PROTOCOL: * raise exceptions.SFTPProtocolError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_REQUEST_DENIED: * raise exceptions.RequestDeniedError */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_SFTPProtocolError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 184, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_SFTPProtocolError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 184, __pyx_L1_error) + __PYX_ERR(0, 192, __pyx_L1_error) - /* "ssh2/utils.pyx":183 + /* "ssh2/utils.pyx":191 * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_TIMEOUT: * raise exceptions.SocketTimeout * elif errcode == error_codes._LIBSSH2_ERROR_SFTP_PROTOCOL: # <<<<<<<<<<<<<< @@ -3372,23 +3500,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_REQUEST_DENIED: - /* "ssh2/utils.pyx":186 + /* "ssh2/utils.pyx":194 * raise exceptions.SFTPProtocolError * elif errcode == error_codes._LIBSSH2_ERROR_REQUEST_DENIED: * raise exceptions.RequestDeniedError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_METHOD_NOT_SUPPORTED: * raise exceptions.MethodNotSupported */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_RequestDeniedError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_RequestDeniedError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 186, __pyx_L1_error) + __PYX_ERR(0, 194, __pyx_L1_error) - /* "ssh2/utils.pyx":185 + /* "ssh2/utils.pyx":193 * elif errcode == error_codes._LIBSSH2_ERROR_SFTP_PROTOCOL: * raise exceptions.SFTPProtocolError * elif errcode == error_codes._LIBSSH2_ERROR_REQUEST_DENIED: # <<<<<<<<<<<<<< @@ -3398,23 +3526,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_METHOD_NOT_SUPPORTED: - /* "ssh2/utils.pyx":188 + /* "ssh2/utils.pyx":196 * raise exceptions.RequestDeniedError * elif errcode == error_codes._LIBSSH2_ERROR_METHOD_NOT_SUPPORTED: * raise exceptions.MethodNotSupported # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_INVAL: * raise exceptions.InvalidRequestError */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 188, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_MethodNotSupported); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 188, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_MethodNotSupported); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 188, __pyx_L1_error) + __PYX_ERR(0, 196, __pyx_L1_error) - /* "ssh2/utils.pyx":187 + /* "ssh2/utils.pyx":195 * elif errcode == error_codes._LIBSSH2_ERROR_REQUEST_DENIED: * raise exceptions.RequestDeniedError * elif errcode == error_codes._LIBSSH2_ERROR_METHOD_NOT_SUPPORTED: # <<<<<<<<<<<<<< @@ -3424,23 +3552,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_INVAL: - /* "ssh2/utils.pyx":190 + /* "ssh2/utils.pyx":198 * raise exceptions.MethodNotSupported * elif errcode == error_codes._LIBSSH2_ERROR_INVAL: * raise exceptions.InvalidRequestError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_INVALID_POLL_TYPE: * raise exceptions.InvalidPollTypeError */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 190, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 198, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_InvalidRequestError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_InvalidRequestError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 190, __pyx_L1_error) + __PYX_ERR(0, 198, __pyx_L1_error) - /* "ssh2/utils.pyx":189 + /* "ssh2/utils.pyx":197 * elif errcode == error_codes._LIBSSH2_ERROR_METHOD_NOT_SUPPORTED: * raise exceptions.MethodNotSupported * elif errcode == error_codes._LIBSSH2_ERROR_INVAL: # <<<<<<<<<<<<<< @@ -3450,23 +3578,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_INVALID_POLL_TYPE: - /* "ssh2/utils.pyx":192 + /* "ssh2/utils.pyx":200 * raise exceptions.InvalidRequestError * elif errcode == error_codes._LIBSSH2_ERROR_INVALID_POLL_TYPE: * raise exceptions.InvalidPollTypeError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_PUBLICKEY_PROTOCOL: * raise exceptions.PublicKeyProtocolError */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_InvalidPollTypeError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_InvalidPollTypeError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 192, __pyx_L1_error) + __PYX_ERR(0, 200, __pyx_L1_error) - /* "ssh2/utils.pyx":191 + /* "ssh2/utils.pyx":199 * elif errcode == error_codes._LIBSSH2_ERROR_INVAL: * raise exceptions.InvalidRequestError * elif errcode == error_codes._LIBSSH2_ERROR_INVALID_POLL_TYPE: # <<<<<<<<<<<<<< @@ -3476,23 +3604,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_PUBLICKEY_PROTOCOL: - /* "ssh2/utils.pyx":194 + /* "ssh2/utils.pyx":202 * raise exceptions.InvalidPollTypeError * elif errcode == error_codes._LIBSSH2_ERROR_PUBLICKEY_PROTOCOL: * raise exceptions.PublicKeyProtocolError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_BUFFER_TOO_SMALL: * raise exceptions.BufferTooSmallError */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_PublicKeyProtocolError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_PublicKeyProtocolError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 194, __pyx_L1_error) + __PYX_ERR(0, 202, __pyx_L1_error) - /* "ssh2/utils.pyx":193 + /* "ssh2/utils.pyx":201 * elif errcode == error_codes._LIBSSH2_ERROR_INVALID_POLL_TYPE: * raise exceptions.InvalidPollTypeError * elif errcode == error_codes._LIBSSH2_ERROR_PUBLICKEY_PROTOCOL: # <<<<<<<<<<<<<< @@ -3502,23 +3630,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_BUFFER_TOO_SMALL: - /* "ssh2/utils.pyx":196 + /* "ssh2/utils.pyx":204 * raise exceptions.PublicKeyProtocolError * elif errcode == error_codes._LIBSSH2_ERROR_BUFFER_TOO_SMALL: * raise exceptions.BufferTooSmallError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_BAD_USE: * raise exceptions.BadUseError */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 196, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_BufferTooSmallError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_BufferTooSmallError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 196, __pyx_L1_error) + __PYX_ERR(0, 204, __pyx_L1_error) - /* "ssh2/utils.pyx":195 + /* "ssh2/utils.pyx":203 * elif errcode == error_codes._LIBSSH2_ERROR_PUBLICKEY_PROTOCOL: * raise exceptions.PublicKeyProtocolError * elif errcode == error_codes._LIBSSH2_ERROR_BUFFER_TOO_SMALL: # <<<<<<<<<<<<<< @@ -3528,23 +3656,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_BAD_USE: - /* "ssh2/utils.pyx":198 + /* "ssh2/utils.pyx":206 * raise exceptions.BufferTooSmallError * elif errcode == error_codes._LIBSSH2_ERROR_BAD_USE: * raise exceptions.BadUseError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_COMPRESS: * raise exceptions.CompressError */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 198, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_BadUseError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_BadUseError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 198, __pyx_L1_error) + __PYX_ERR(0, 206, __pyx_L1_error) - /* "ssh2/utils.pyx":197 + /* "ssh2/utils.pyx":205 * elif errcode == error_codes._LIBSSH2_ERROR_BUFFER_TOO_SMALL: * raise exceptions.BufferTooSmallError * elif errcode == error_codes._LIBSSH2_ERROR_BAD_USE: # <<<<<<<<<<<<<< @@ -3554,23 +3682,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_COMPRESS: - /* "ssh2/utils.pyx":200 + /* "ssh2/utils.pyx":208 * raise exceptions.BadUseError * elif errcode == error_codes._LIBSSH2_ERROR_COMPRESS: * raise exceptions.CompressError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_OUT_OF_BOUNDARY: * raise exceptions.OutOfBoundaryError */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_CompressError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 200, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_CompressError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 200, __pyx_L1_error) + __PYX_ERR(0, 208, __pyx_L1_error) - /* "ssh2/utils.pyx":199 + /* "ssh2/utils.pyx":207 * elif errcode == error_codes._LIBSSH2_ERROR_BAD_USE: * raise exceptions.BadUseError * elif errcode == error_codes._LIBSSH2_ERROR_COMPRESS: # <<<<<<<<<<<<<< @@ -3580,23 +3708,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_OUT_OF_BOUNDARY: - /* "ssh2/utils.pyx":202 + /* "ssh2/utils.pyx":210 * raise exceptions.CompressError * elif errcode == error_codes._LIBSSH2_ERROR_OUT_OF_BOUNDARY: * raise exceptions.OutOfBoundaryError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_AGENT_PROTOCOL: * raise exceptions.AgentProtocolError */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 202, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_OutOfBoundaryError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_OutOfBoundaryError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 202, __pyx_L1_error) + __PYX_ERR(0, 210, __pyx_L1_error) - /* "ssh2/utils.pyx":201 + /* "ssh2/utils.pyx":209 * elif errcode == error_codes._LIBSSH2_ERROR_COMPRESS: * raise exceptions.CompressError * elif errcode == error_codes._LIBSSH2_ERROR_OUT_OF_BOUNDARY: # <<<<<<<<<<<<<< @@ -3606,23 +3734,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_AGENT_PROTOCOL: - /* "ssh2/utils.pyx":204 + /* "ssh2/utils.pyx":212 * raise exceptions.OutOfBoundaryError * elif errcode == error_codes._LIBSSH2_ERROR_AGENT_PROTOCOL: * raise exceptions.AgentProtocolError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_RECV: * raise exceptions.SocketRecvError */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_AgentProtocolError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_AgentProtocolError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 204, __pyx_L1_error) + __PYX_ERR(0, 212, __pyx_L1_error) - /* "ssh2/utils.pyx":203 + /* "ssh2/utils.pyx":211 * elif errcode == error_codes._LIBSSH2_ERROR_OUT_OF_BOUNDARY: * raise exceptions.OutOfBoundaryError * elif errcode == error_codes._LIBSSH2_ERROR_AGENT_PROTOCOL: # <<<<<<<<<<<<<< @@ -3632,77 +3760,51 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_SOCKET_RECV: - /* "ssh2/utils.pyx":206 + /* "ssh2/utils.pyx":214 * raise exceptions.AgentProtocolError * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_RECV: * raise exceptions.SocketRecvError # <<<<<<<<<<<<<< - * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_SEND: - * raise exceptions.SocketSendError + * elif errcode == error_codes._LIBSSH2_ERROR_ENCRYPT: + * raise exceptions.EncryptError */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_SocketRecvError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_SocketRecvError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 206, __pyx_L1_error) + __PYX_ERR(0, 214, __pyx_L1_error) - /* "ssh2/utils.pyx":205 + /* "ssh2/utils.pyx":213 * elif errcode == error_codes._LIBSSH2_ERROR_AGENT_PROTOCOL: * raise exceptions.AgentProtocolError * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_RECV: # <<<<<<<<<<<<<< * raise exceptions.SocketRecvError - * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_SEND: + * elif errcode == error_codes._LIBSSH2_ERROR_ENCRYPT: */ break; - case LIBSSH2_ERROR_SOCKET_SEND: + case LIBSSH2_ERROR_ENCRYPT: - /* "ssh2/utils.pyx":208 + /* "ssh2/utils.pyx":216 * raise exceptions.SocketRecvError - * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_SEND: - * raise exceptions.SocketSendError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_ENCRYPT: - * raise exceptions.EncryptError + * raise exceptions.EncryptError # <<<<<<<<<<<<<< + * elif errcode == error_codes._LIBSSH2_ERROR_BAD_SOCKET: + * raise exceptions.BadSocketError */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_SocketSendError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_EncryptError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 208, __pyx_L1_error) + __PYX_ERR(0, 216, __pyx_L1_error) - /* "ssh2/utils.pyx":207 + /* "ssh2/utils.pyx":215 * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_RECV: * raise exceptions.SocketRecvError - * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_SEND: # <<<<<<<<<<<<<< - * raise exceptions.SocketSendError - * elif errcode == error_codes._LIBSSH2_ERROR_ENCRYPT: - */ - break; - case LIBSSH2_ERROR_ENCRYPT: - - /* "ssh2/utils.pyx":210 - * raise exceptions.SocketSendError - * elif errcode == error_codes._LIBSSH2_ERROR_ENCRYPT: - * raise exceptions.EncryptError # <<<<<<<<<<<<<< - * elif errcode == error_codes._LIBSSH2_ERROR_BAD_SOCKET: - * raise exceptions.BadSocketError - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_EncryptError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 210, __pyx_L1_error) - - /* "ssh2/utils.pyx":209 - * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_SEND: - * raise exceptions.SocketSendError * elif errcode == error_codes._LIBSSH2_ERROR_ENCRYPT: # <<<<<<<<<<<<<< * raise exceptions.EncryptError * elif errcode == error_codes._LIBSSH2_ERROR_BAD_SOCKET: @@ -3710,23 +3812,23 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_BAD_SOCKET: - /* "ssh2/utils.pyx":212 + /* "ssh2/utils.pyx":218 * raise exceptions.EncryptError * elif errcode == error_codes._LIBSSH2_ERROR_BAD_SOCKET: * raise exceptions.BadSocketError # <<<<<<<<<<<<<< * elif errcode == error_codes._LIBSSH2_ERROR_KNOWN_HOSTS: * raise exceptions.KnownHostError */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_BadSocketError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_BadSocketError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 212, __pyx_L1_error) + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 218, __pyx_L1_error) - /* "ssh2/utils.pyx":211 + /* "ssh2/utils.pyx":217 * elif errcode == error_codes._LIBSSH2_ERROR_ENCRYPT: * raise exceptions.EncryptError * elif errcode == error_codes._LIBSSH2_ERROR_BAD_SOCKET: # <<<<<<<<<<<<<< @@ -3736,33 +3838,85 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U break; case LIBSSH2_ERROR_KNOWN_HOSTS: - /* "ssh2/utils.pyx":214 + /* "ssh2/utils.pyx":220 * raise exceptions.BadSocketError * elif errcode == error_codes._LIBSSH2_ERROR_KNOWN_HOSTS: * raise exceptions.KnownHostError # <<<<<<<<<<<<<< - * else: - * # Switch default + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_WINDOW_FULL: + * raise exceptions.ChannelWindowFullError */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_KnownHostError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_KnownHostError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 220, __pyx_L1_error) - /* "ssh2/utils.pyx":213 + /* "ssh2/utils.pyx":219 * elif errcode == error_codes._LIBSSH2_ERROR_BAD_SOCKET: * raise exceptions.BadSocketError * elif errcode == error_codes._LIBSSH2_ERROR_KNOWN_HOSTS: # <<<<<<<<<<<<<< * raise exceptions.KnownHostError + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_WINDOW_FULL: + */ + break; + case LIBSSH2_ERROR_CHANNEL_WINDOW_FULL: + + /* "ssh2/utils.pyx":222 + * raise exceptions.KnownHostError + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_WINDOW_FULL: + * raise exceptions.ChannelWindowFullError # <<<<<<<<<<<<<< + * elif errcode == error_codes._LIBSSH2_ERROR_KEYFILE_AUTH_FAILED: + * raise exceptions.KeyfileAuthFailedError + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ChannelWindowFullError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 222, __pyx_L1_error) + + /* "ssh2/utils.pyx":221 + * elif errcode == error_codes._LIBSSH2_ERROR_KNOWN_HOSTS: + * raise exceptions.KnownHostError + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_WINDOW_FULL: # <<<<<<<<<<<<<< + * raise exceptions.ChannelWindowFullError + * elif errcode == error_codes._LIBSSH2_ERROR_KEYFILE_AUTH_FAILED: + */ + break; + case LIBSSH2_ERROR_KEYFILE_AUTH_FAILED: + + /* "ssh2/utils.pyx":224 + * raise exceptions.ChannelWindowFullError + * elif errcode == error_codes._LIBSSH2_ERROR_KEYFILE_AUTH_FAILED: + * raise exceptions.KeyfileAuthFailedError # <<<<<<<<<<<<<< + * else: + * # Switch default + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_KeyfileAuthFailedError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 224, __pyx_L1_error) + + /* "ssh2/utils.pyx":223 + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_WINDOW_FULL: + * raise exceptions.ChannelWindowFullError + * elif errcode == error_codes._LIBSSH2_ERROR_KEYFILE_AUTH_FAILED: # <<<<<<<<<<<<<< + * raise exceptions.KeyfileAuthFailedError * else: */ break; default: - /* "ssh2/utils.pyx":217 + /* "ssh2/utils.pyx":227 * else: * # Switch default * if errcode < 0: # <<<<<<<<<<<<<< @@ -3772,19 +3926,19 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U __pyx_t_3 = ((__pyx_v_errcode < 0) != 0); if (unlikely(__pyx_t_3)) { - /* "ssh2/utils.pyx":218 + /* "ssh2/utils.pyx":228 * # Switch default * if errcode < 0: * raise exceptions.UnknownError("Error code %s not known", errcode) # <<<<<<<<<<<<<< * return errcode */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 218, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_UnknownError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 218, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_UnknownError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_errcode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 218, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_errcode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = NULL; __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { @@ -3799,24 +3953,24 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_s_Error_code_s_not_known, __pyx_t_2}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __pyx_L1_error) + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_s_Error_code_s_not_known, __pyx_t_1}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_s_Error_code_s_not_known, __pyx_t_2}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __pyx_L1_error) + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_s_Error_code_s_not_known, __pyx_t_1}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else #endif { - __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 218, __pyx_L1_error) + __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (__pyx_t_5) { __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; @@ -3824,19 +3978,19 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U __Pyx_INCREF(__pyx_kp_s_Error_code_s_not_known); __Pyx_GIVEREF(__pyx_kp_s_Error_code_s_not_known); PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_Error_code_s_not_known); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 218, __pyx_L1_error) + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 228, __pyx_L1_error) - /* "ssh2/utils.pyx":217 + /* "ssh2/utils.pyx":227 * else: * # Switch default * if errcode < 0: # <<<<<<<<<<<<<< @@ -3845,7 +3999,7 @@ static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_U */ } - /* "ssh2/utils.pyx":219 + /* "ssh2/utils.pyx":229 * if errcode < 0: * raise exceptions.UnknownError("Error code %s not known", errcode) * return errcode # <<<<<<<<<<<<<< @@ -3980,6 +4134,7 @@ static struct PyModuleDef __pyx_moduledef = { static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_AgentProtocolError, __pyx_k_AgentProtocolError, sizeof(__pyx_k_AgentProtocolError), 0, 0, 1, 1}, + {&__pyx_n_s_AllocError, __pyx_k_AllocError, sizeof(__pyx_k_AllocError), 0, 0, 1, 1}, {&__pyx_n_s_AuthenticationError, __pyx_k_AuthenticationError, sizeof(__pyx_k_AuthenticationError), 0, 0, 1, 1}, {&__pyx_n_s_BadSocketError, __pyx_k_BadSocketError, sizeof(__pyx_k_BadSocketError), 0, 0, 1, 1}, {&__pyx_n_s_BadUseError, __pyx_k_BadUseError, sizeof(__pyx_k_BadUseError), 0, 0, 1, 1}, @@ -3994,6 +4149,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_ChannelRequestDenied, __pyx_k_ChannelRequestDenied, sizeof(__pyx_k_ChannelRequestDenied), 0, 0, 1, 1}, {&__pyx_n_s_ChannelUnknownError, __pyx_k_ChannelUnknownError, sizeof(__pyx_k_ChannelUnknownError), 0, 0, 1, 1}, {&__pyx_n_s_ChannelWindowExceeded, __pyx_k_ChannelWindowExceeded, sizeof(__pyx_k_ChannelWindowExceeded), 0, 0, 1, 1}, + {&__pyx_n_s_ChannelWindowFullError, __pyx_k_ChannelWindowFullError, sizeof(__pyx_k_ChannelWindowFullError), 0, 0, 1, 1}, {&__pyx_n_s_CompressError, __pyx_k_CompressError, sizeof(__pyx_k_CompressError), 0, 0, 1, 1}, {&__pyx_n_s_DecryptError, __pyx_k_DecryptError, sizeof(__pyx_k_DecryptError), 0, 0, 1, 1}, {&__pyx_n_s_ENCODING, __pyx_k_ENCODING, sizeof(__pyx_k_ENCODING), 0, 0, 1, 1}, @@ -4002,9 +4158,12 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_FileError, __pyx_k_FileError, sizeof(__pyx_k_FileError), 0, 0, 1, 1}, {&__pyx_n_s_HostkeyInitError, __pyx_k_HostkeyInitError, sizeof(__pyx_k_HostkeyInitError), 0, 0, 1, 1}, {&__pyx_n_s_HostkeySignError, __pyx_k_HostkeySignError, sizeof(__pyx_k_HostkeySignError), 0, 0, 1, 1}, + {&__pyx_n_s_InvalidMACError, __pyx_k_InvalidMACError, sizeof(__pyx_k_InvalidMACError), 0, 0, 1, 1}, {&__pyx_n_s_InvalidPollTypeError, __pyx_k_InvalidPollTypeError, sizeof(__pyx_k_InvalidPollTypeError), 0, 0, 1, 1}, {&__pyx_n_s_InvalidRequestError, __pyx_k_InvalidRequestError, sizeof(__pyx_k_InvalidRequestError), 0, 0, 1, 1}, + {&__pyx_n_s_KexFailureError, __pyx_k_KexFailureError, sizeof(__pyx_k_KexFailureError), 0, 0, 1, 1}, {&__pyx_n_s_KeyExchangeError, __pyx_k_KeyExchangeError, sizeof(__pyx_k_KeyExchangeError), 0, 0, 1, 1}, + {&__pyx_n_s_KeyfileAuthFailedError, __pyx_k_KeyfileAuthFailedError, sizeof(__pyx_k_KeyfileAuthFailedError), 0, 0, 1, 1}, {&__pyx_n_s_KnownHostError, __pyx_k_KnownHostError, sizeof(__pyx_k_KnownHostError), 0, 0, 1, 1}, {&__pyx_n_s_MethodNoneError, __pyx_k_MethodNoneError, sizeof(__pyx_k_MethodNoneError), 0, 0, 1, 1}, {&__pyx_n_s_MethodNotSupported, __pyx_k_MethodNotSupported, sizeof(__pyx_k_MethodNotSupported), 0, 0, 1, 1}, @@ -4188,6 +4347,8 @@ static int __Pyx_modinit_type_import_code(void) { __Pyx_GOTREF(__pyx_t_1); __pyx_ptype_4ssh2_7session_Session = __Pyx_ImportType(__pyx_t_1, "ssh2.session", "Session", sizeof(struct __pyx_obj_4ssh2_7session_Session), __Pyx_ImportType_CheckSize_Warn); if (!__pyx_ptype_4ssh2_7session_Session) __PYX_ERR(1, 19, __pyx_L1_error) + __pyx_ptype_4ssh2_7session_MethodType = __Pyx_ImportType(__pyx_t_1, "ssh2.session", "MethodType", sizeof(struct __pyx_obj_4ssh2_7session_MethodType), __Pyx_ImportType_CheckSize_Warn); + if (!__pyx_ptype_4ssh2_7session_MethodType) __PYX_ERR(1, 26, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; diff --git a/ssh2/utils.pyx b/ssh2/utils.pyx index 052e18ea..ff2f4d63 100644 --- a/ssh2/utils.pyx +++ b/ssh2/utils.pyx @@ -134,6 +134,14 @@ cpdef int handle_error_codes(int errcode) except -1: raise exceptions.BannerRecvError elif errcode == error_codes._LIBSSH2_ERROR_BANNER_SEND: raise exceptions.BannerSendError + elif errcode == error_codes._LIBSSH2_ERROR_INVALID_MAC: + raise exceptions.InvalidMACError + elif errcode == error_codes._LIBSSH2_ERROR_KEX_FAILURE: + raise exceptions.KexFailureError + elif errcode == error_codes._LIBSSH2_ERROR_ALLOC: + raise exceptions.AllocError + elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_SEND: + raise exceptions.SocketSendError elif errcode == error_codes._LIBSSH2_ERROR_KEY_EXCHANGE_FAILURE: raise exceptions.KeyExchangeError elif errcode == error_codes._LIBSSH2_ERROR_TIMEOUT: @@ -204,14 +212,16 @@ cpdef int handle_error_codes(int errcode) except -1: raise exceptions.AgentProtocolError elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_RECV: raise exceptions.SocketRecvError - elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_SEND: - raise exceptions.SocketSendError elif errcode == error_codes._LIBSSH2_ERROR_ENCRYPT: raise exceptions.EncryptError elif errcode == error_codes._LIBSSH2_ERROR_BAD_SOCKET: raise exceptions.BadSocketError elif errcode == error_codes._LIBSSH2_ERROR_KNOWN_HOSTS: raise exceptions.KnownHostError + elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_WINDOW_FULL: + raise exceptions.ChannelWindowFullError + elif errcode == error_codes._LIBSSH2_ERROR_KEYFILE_AUTH_FAILED: + raise exceptions.KeyfileAuthFailedError else: # Switch default if errcode < 0: diff --git a/tests/test_session.py b/tests/test_session.py index 50d35a1a..226375d4 100644 --- a/tests/test_session.py +++ b/tests/test_session.py @@ -4,13 +4,13 @@ from .base_test import SSH2TestCase from ssh2.session import Session, LIBSSH2_HOSTKEY_HASH_MD5, \ - LIBSSH2_HOSTKEY_HASH_SHA1 + LIBSSH2_HOSTKEY_HASH_SHA1, LIBSSH2_METHOD_KEX, LIBSSH2_METHOD_CRYPT_CS from ssh2.sftp import SFTP from ssh2.channel import Channel from ssh2.error_codes import LIBSSH2_ERROR_EAGAIN from ssh2.exceptions import AuthenticationError, AgentAuthenticationError, \ SCPProtocolError, RequestDeniedError, InvalidRequestError, \ - SocketSendError, FileError, PublickeyUnverifiedError + SocketSendError, FileError, PublickeyUnverifiedError, MethodNotSupported from ssh2.utils import wait_socket from ssh2.listener import Listener @@ -299,3 +299,19 @@ def test_publickey_frommemory_passphrase(self): self.user, pkey, passphrase="this still works when passphrase not required") self.assertEqual(ret_val, 0) + + def test_methods(self): + methods = self.session.methods(LIBSSH2_METHOD_KEX) + self.assertTrue(len(methods) > 0) + methods = self.session.methods(LIBSSH2_METHOD_CRYPT_CS) + self.assertEqual(self.session.method_pref(LIBSSH2_METHOD_CRYPT_CS, methods), 0) + algs = self.session.supported_algs(LIBSSH2_METHOD_CRYPT_CS) + self.assertTrue(len(algs) > 0) + alg = algs[0] + self.assertEqual(self.session.method_pref(LIBSSH2_METHOD_CRYPT_CS, alg), 0) + + def test_invalid_methods(self): + self.assertRaises( + MethodNotSupported, + self.session.method_pref, LIBSSH2_METHOD_CRYPT_CS, 'invalid algorithm') + self.assertRaises(TypeError, self.session.method_pref, 0, 'fake')