diff --git a/Changelog.rst b/Changelog.rst index e7cc47f5..01b1ddc4 100644 --- a/Changelog.rst +++ b/Changelog.rst @@ -1,6 +1,19 @@ Change Log ============= +1.1.3 +++++++ + +Changes +-------- + +* ``ssh2.utils.version()`` now returns a string. + +Fixes +------- + + + 1.1.2 ++++++ diff --git a/requirements_dev.txt b/requirements_dev.txt index 90c5d967..e290749e 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,6 +1,9 @@ cython -flake8 +flake8>=3.0.0 +flake8-annotations +flake-type-annotations-plugin jinja2 pytest pytest-rerunfailures +mypy -r doc/requirements.txt diff --git a/setup.py b/setup.py index 5d6d9a8b..f3f2f863 100644 --- a/setup.py +++ b/setup.py @@ -45,6 +45,7 @@ _comp_args = ["-O2"] if not ON_WINDOWS else None cython_directives = {'embedsignature': True, + 'embedsignature.format': 'python', 'boundscheck': False, 'optimize.use_switch': True, 'wraparound': False, @@ -82,7 +83,13 @@ if ext.name == 'ssh2.utils': ext.sources.append('ssh2/ext/find_eol.c') -package_data = {'ssh2': ['*.pxd', 'libssh2.so*']} +package_data = { + 'ssh2': [ + '*.pxd', + 'libssh2.so*', + 'py.typed', + ] +} if ON_WINDOWS: package_data['ssh2'].extend([ diff --git a/ssh2/agent.c b/ssh2/agent.c index 6f7c64c8..d2402509 100644 --- a/ssh2/agent.c +++ b/ssh2/agent.c @@ -1,4 +1,4 @@ -/* Generated by Cython 3.0.11 */ +/* Generated by Cython 3.0.12 */ /* BEGIN: Cython Metadata { @@ -55,10 +55,10 @@ END: Cython Metadata */ #else #define __PYX_EXTRA_ABI_MODULE_NAME "" #endif -#define CYTHON_ABI "3_0_11" __PYX_EXTRA_ABI_MODULE_NAME +#define CYTHON_ABI "3_0_12" __PYX_EXTRA_ABI_MODULE_NAME #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." -#define CYTHON_HEX_VERSION 0x03000BF0 +#define CYTHON_HEX_VERSION 0x03000CF0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -1530,6 +1530,18 @@ struct __pyx_obj_4ssh2_7session_Session; struct __pyx_obj_4ssh2_7session_MethodType; struct __pyx_obj_4ssh2_4pkey_PublicKey; struct __pyx_obj_4ssh2_5agent_Agent; +struct __pyx_ctuple_int__and_int; +typedef struct __pyx_ctuple_int__and_int __pyx_ctuple_int__and_int; + +/* "utils.pxd":24 + * cdef object to_str_len(char *c_str, int length) + * cpdef int handle_error_codes(int errcode) except -1 + * cpdef (int, int) find_eol(bytes buf: bytes, Py_ssize_t pos: Py_ssize_t) # <<<<<<<<<<<<<< + */ +struct __pyx_ctuple_int__and_int { + int f0; + int f1; +}; /* "session.pxd":19 * from . cimport c_ssh2 @@ -1730,9 +1742,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, P /* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); -/* ErrOccurredWithGIL.proto */ -static CYTHON_INLINE int __Pyx_ErrOccurredWithGIL(void); - /* PyDictVersioning.proto */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) @@ -1795,7 +1804,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #if !CYTHON_VECTORCALL #if PY_VERSION_HEX >= 0x03080000 #include "frameobject.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif @@ -1917,11 +1926,6 @@ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, __Pyx__ArgTypeTest(obj, type, name, exact)) static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); -/* WriteUnraisableException.proto */ -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename, - int full_traceback, int nogil); - /* KeywordStringCheck.proto */ static int __Pyx_CheckKeywordStrings(PyObject *kw, const char* function_name, int kw_allowed); @@ -1994,22 +1998,22 @@ static int __Pyx_setup_reduce(PyObject* type_obj); #endif /* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_11 -#define __PYX_HAVE_RT_ImportType_proto_3_0_11 +#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_12 +#define __PYX_HAVE_RT_ImportType_proto_3_0_12 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #include #endif #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L -#define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) alignof(s) +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_12(s) alignof(s) #else -#define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) sizeof(void*) +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_12(s) sizeof(void*) #endif -enum __Pyx_ImportType_CheckSize_3_0_11 { - __Pyx_ImportType_CheckSize_Error_3_0_11 = 0, - __Pyx_ImportType_CheckSize_Warn_3_0_11 = 1, - __Pyx_ImportType_CheckSize_Ignore_3_0_11 = 2 +enum __Pyx_ImportType_CheckSize_3_0_12 { + __Pyx_ImportType_CheckSize_Error_3_0_12 = 0, + __Pyx_ImportType_CheckSize_Warn_3_0_12 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_0_12 = 2 }; -static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size); +static PyTypeObject *__Pyx_ImportType_3_0_12(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_12 check_size); #endif /* Import.proto */ @@ -2241,7 +2245,7 @@ static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig); /* FunctionImport.proto */ -static int __Pyx_ImportFunction_3_0_11(PyObject *module, const char *funcname, void (**f)(void), const char *sig); +static int __Pyx_ImportFunction_3_0_12(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); @@ -2940,7 +2944,7 @@ static int __pyx_f_4ssh2_5agent_agent_auth(char *__pyx_v__username, LIBSSH2_AGEN * with gil: * raise AgentListIdentitiesError( */ - __pyx_f_4ssh2_5agent_clear_agent(__pyx_v_agent); if (unlikely(__Pyx_ErrOccurredWithGIL())) __PYX_ERR(1, 31, __pyx_L1_error) + __pyx_f_4ssh2_5agent_clear_agent(__pyx_v_agent); /* "ssh2/agent.pyx":32 * if c_ssh2.libssh2_agent_list_identities(agent) != 0: @@ -3148,7 +3152,7 @@ static int __pyx_f_4ssh2_5agent_agent_auth(char *__pyx_v__username, LIBSSH2_AGEN * return 0 * prev = identity */ - __pyx_f_4ssh2_5agent_clear_agent(__pyx_v_agent); if (unlikely(__Pyx_ErrOccurredWithGIL())) __PYX_ERR(1, 43, __pyx_L1_error) + __pyx_f_4ssh2_5agent_clear_agent(__pyx_v_agent); /* "ssh2/agent.pyx":44 * agent, _username, identity) == 0: @@ -3268,7 +3272,7 @@ static int __pyx_f_4ssh2_5agent_auth_identity(char const *__pyx_v_username, LIBS * elif rc < 0: * clear_agent(agent) */ - __pyx_f_4ssh2_5agent_clear_agent(__pyx_v_agent); if (unlikely(__Pyx_ErrOccurredWithGIL())) __PYX_ERR(1, 57, __pyx_L1_error) + __pyx_f_4ssh2_5agent_clear_agent(__pyx_v_agent); /* "ssh2/agent.pyx":56 * rc = c_ssh2.libssh2_agent_get_identity( @@ -3297,7 +3301,7 @@ static int __pyx_f_4ssh2_5agent_auth_identity(char const *__pyx_v_username, LIBS * with gil: * raise AgentGetIdentityError( */ - __pyx_f_4ssh2_5agent_clear_agent(__pyx_v_agent); if (unlikely(__Pyx_ErrOccurredWithGIL())) __PYX_ERR(1, 59, __pyx_L1_error) + __pyx_f_4ssh2_5agent_clear_agent(__pyx_v_agent); /* "ssh2/agent.pyx":60 * elif rc < 0: @@ -3745,7 +3749,7 @@ static LIBSSH2_AGENT *__pyx_f_4ssh2_5agent_init_connect_agent(LIBSSH2_SESSION *_ /* "ssh2/agent.pyx":88 * * - * cdef void clear_agent(c_ssh2.LIBSSH2_AGENT *agent) nogil: # <<<<<<<<<<<<<< + * cdef void clear_agent(c_ssh2.LIBSSH2_AGENT *agent) noexcept nogil: # <<<<<<<<<<<<<< * c_ssh2.libssh2_agent_disconnect(agent) * c_ssh2.libssh2_agent_free(agent) */ @@ -3754,7 +3758,7 @@ static void __pyx_f_4ssh2_5agent_clear_agent(LIBSSH2_AGENT *__pyx_v_agent) { /* "ssh2/agent.pyx":89 * - * cdef void clear_agent(c_ssh2.LIBSSH2_AGENT *agent) nogil: + * cdef void clear_agent(c_ssh2.LIBSSH2_AGENT *agent) noexcept nogil: * c_ssh2.libssh2_agent_disconnect(agent) # <<<<<<<<<<<<<< * c_ssh2.libssh2_agent_free(agent) * @@ -3762,7 +3766,7 @@ static void __pyx_f_4ssh2_5agent_clear_agent(LIBSSH2_AGENT *__pyx_v_agent) { (void)(libssh2_agent_disconnect(__pyx_v_agent)); /* "ssh2/agent.pyx":90 - * cdef void clear_agent(c_ssh2.LIBSSH2_AGENT *agent) nogil: + * cdef void clear_agent(c_ssh2.LIBSSH2_AGENT *agent) noexcept nogil: * c_ssh2.libssh2_agent_disconnect(agent) * c_ssh2.libssh2_agent_free(agent) # <<<<<<<<<<<<<< * @@ -3773,7 +3777,7 @@ static void __pyx_f_4ssh2_5agent_clear_agent(LIBSSH2_AGENT *__pyx_v_agent) { /* "ssh2/agent.pyx":88 * * - * cdef void clear_agent(c_ssh2.LIBSSH2_AGENT *agent) nogil: # <<<<<<<<<<<<<< + * cdef void clear_agent(c_ssh2.LIBSSH2_AGENT *agent) noexcept nogil: # <<<<<<<<<<<<<< * c_ssh2.libssh2_agent_disconnect(agent) * c_ssh2.libssh2_agent_free(agent) */ @@ -4037,9 +4041,6 @@ static void __pyx_pw_4ssh2_5agent_5Agent_3__dealloc__(PyObject *__pyx_v_self) { static void __pyx_pf_4ssh2_5agent_5Agent_2__dealloc__(struct __pyx_obj_4ssh2_5agent_Agent *__pyx_v_self) { int __pyx_t_1; int __pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; /* "ssh2/agent.pyx":107 * @@ -4072,7 +4073,7 @@ static void __pyx_pf_4ssh2_5agent_5Agent_2__dealloc__(struct __pyx_obj_4ssh2_5ag * self._agent = NULL * */ - __pyx_f_4ssh2_5agent_clear_agent(__pyx_v_self->_agent); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 108, __pyx_L1_error) + __pyx_f_4ssh2_5agent_clear_agent(__pyx_v_self->_agent); /* "ssh2/agent.pyx":107 * @@ -4101,10 +4102,6 @@ static void __pyx_pf_4ssh2_5agent_5Agent_2__dealloc__(struct __pyx_obj_4ssh2_5ag */ /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_WriteUnraisable("ssh2.agent.Agent.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __pyx_L0:; } /* "ssh2/agent.pyx":111 @@ -4123,7 +4120,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_5agent_5Agent_4list_identities, "Agent.list_identities(self)\nThis method is a no-op - use\n :py:func:`ssh2.agent.Agent.get_identities()` to list and retrieve\n identities."); +PyDoc_STRVAR(__pyx_doc_4ssh2_5agent_5Agent_4list_identities, "list_identities(self)\nThis method is a no-op - use\n :py:func:`ssh2.agent.Agent.get_identities()` to list and retrieve\n identities."); static PyMethodDef __pyx_mdef_4ssh2_5agent_5Agent_5list_identities = {"list_identities", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_5agent_5Agent_5list_identities, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_5agent_5Agent_4list_identities}; static PyObject *__pyx_pw_4ssh2_5agent_5Agent_5list_identities(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -4185,7 +4182,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_5agent_5Agent_6get_identities, "Agent.get_identities(self)\nList and get identities from agent\n\n :rtype: list(:py:class:`ssh2.pkey.PublicKey`)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_5agent_5Agent_6get_identities, "get_identities(self)\nList and get identities from agent\n\n :rtype: list(:py:class:`ssh2.pkey.PublicKey`)"); static PyMethodDef __pyx_mdef_4ssh2_5agent_5Agent_7get_identities = {"get_identities", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_5agent_5Agent_7get_identities, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_5agent_5Agent_6get_identities}; static PyObject *__pyx_pw_4ssh2_5agent_5Agent_7get_identities(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -4411,7 +4408,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_5agent_5Agent_8userauth, "Agent.userauth(self, username, PublicKey pkey)\nPerform user authentication with specific public key\n\n :param username: User name to authenticate as\n :type username: str\n :param pkey: Public key to authenticate with\n :type pkey: :py:class:`ssh2.pkey.PublicKey`\n\n :raises: :py:class:`ssh2.exceptions.AgentAuthenticationError` on errors\n authenticating.\n\n :rtype: int"); +PyDoc_STRVAR(__pyx_doc_4ssh2_5agent_5Agent_8userauth, "userauth(self, username, pkey: PublicKey)\nPerform user authentication with specific public key\n\n :param username: User name to authenticate as\n :type username: str\n :param pkey: Public key to authenticate with\n :type pkey: :py:class:`ssh2.pkey.PublicKey`\n\n :raises: :py:class:`ssh2.exceptions.AgentAuthenticationError` on errors\n authenticating.\n\n :rtype: int"); static PyMethodDef __pyx_mdef_4ssh2_5agent_5Agent_9userauth = {"userauth", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_5agent_5Agent_9userauth, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_5agent_5Agent_8userauth}; static PyObject *__pyx_pw_4ssh2_5agent_5Agent_9userauth(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -4771,7 +4768,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_5agent_5Agent_10disconnect, "Agent.disconnect(self)\nDisconnect from agent.\n\n :rtype: int"); +PyDoc_STRVAR(__pyx_doc_4ssh2_5agent_5Agent_10disconnect, "disconnect(self)\nDisconnect from agent.\n\n :rtype: int"); static PyMethodDef __pyx_mdef_4ssh2_5agent_5Agent_11disconnect = {"disconnect", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_5agent_5Agent_11disconnect, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_5agent_5Agent_10disconnect}; static PyObject *__pyx_pw_4ssh2_5agent_5Agent_11disconnect(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -4909,7 +4906,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_5agent_5Agent_12connect, "Agent.connect(self)\nConnect to agent.\n\n :raises: :py:class:`ssh2.exceptions.AgentConnectionError` on errors\n connecting to agent.\n\n :rtype: int"); +PyDoc_STRVAR(__pyx_doc_4ssh2_5agent_5Agent_12connect, "connect(self)\nConnect to agent.\n\n :raises: :py:class:`ssh2.exceptions.AgentConnectionError` on errors\n connecting to agent.\n\n :rtype: int"); static PyMethodDef __pyx_mdef_4ssh2_5agent_5Agent_13connect = {"connect", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_5agent_5Agent_13connect, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_5agent_5Agent_12connect}; static PyObject *__pyx_pw_4ssh2_5agent_5Agent_13connect(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -5071,7 +5068,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_5agent_5Agent_14get_identity_path, "Agent.get_identity_path(self)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_5agent_5Agent_14get_identity_path, "get_identity_path(self)"); static PyMethodDef __pyx_mdef_4ssh2_5agent_5Agent_15get_identity_path = {"get_identity_path", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_5agent_5Agent_15get_identity_path, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_5agent_5Agent_14get_identity_path}; static PyObject *__pyx_pw_4ssh2_5agent_5Agent_15get_identity_path(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -5261,7 +5258,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_5agent_5Agent_16set_identity_path, "Agent.set_identity_path(self, path)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_5agent_5Agent_16set_identity_path, "set_identity_path(self, path)"); static PyMethodDef __pyx_mdef_4ssh2_5agent_5Agent_17set_identity_path = {"set_identity_path", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_5agent_5Agent_17set_identity_path, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_5agent_5Agent_16set_identity_path}; static PyObject *__pyx_pw_4ssh2_5agent_5Agent_17set_identity_path(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -5475,7 +5472,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_5agent_5Agent_18__reduce_cython__, "Agent.__reduce_cython__(self)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_5agent_5Agent_18__reduce_cython__, "__reduce_cython__(self)"); static PyMethodDef __pyx_mdef_4ssh2_5agent_5Agent_19__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_5agent_5Agent_19__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_5agent_5Agent_18__reduce_cython__}; static PyObject *__pyx_pw_4ssh2_5agent_5Agent_19__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -5556,7 +5553,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_5agent_5Agent_20__setstate_cython__, "Agent.__setstate_cython__(self, __pyx_state)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_5agent_5Agent_20__setstate_cython__, "__setstate_cython__(self, __pyx_state)"); static PyMethodDef __pyx_mdef_4ssh2_5agent_5Agent_21__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_5agent_5Agent_21__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_5agent_5Agent_20__setstate_cython__}; static PyObject *__pyx_pw_4ssh2_5agent_5Agent_21__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6174,12 +6171,12 @@ static int __Pyx_modinit_type_import_code(void) { /*--- Type import code ---*/ __pyx_t_1 = PyImport_ImportModule("ssh2.session"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_4ssh2_7session_Session = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.session", "Session", sizeof(struct __pyx_obj_4ssh2_7session_Session), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_7session_Session),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_7session_Session) __PYX_ERR(2, 19, __pyx_L1_error) - __pyx_ptype_4ssh2_7session_MethodType = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.session", "MethodType", sizeof(struct __pyx_obj_4ssh2_7session_MethodType), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_7session_MethodType),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_7session_MethodType) __PYX_ERR(2, 26, __pyx_L1_error) + __pyx_ptype_4ssh2_7session_Session = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.session", "Session", sizeof(struct __pyx_obj_4ssh2_7session_Session), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_7session_Session),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_7session_Session) __PYX_ERR(2, 19, __pyx_L1_error) + __pyx_ptype_4ssh2_7session_MethodType = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.session", "MethodType", sizeof(struct __pyx_obj_4ssh2_7session_MethodType), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_7session_MethodType),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_7session_MethodType) __PYX_ERR(2, 26, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyImport_ImportModule("ssh2.pkey"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_4ssh2_4pkey_PublicKey = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.pkey", "PublicKey", sizeof(struct __pyx_obj_4ssh2_4pkey_PublicKey), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_4pkey_PublicKey),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_4pkey_PublicKey) __PYX_ERR(3, 23, __pyx_L1_error) + __pyx_ptype_4ssh2_4pkey_PublicKey = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.pkey", "PublicKey", sizeof(struct __pyx_obj_4ssh2_4pkey_PublicKey), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_4pkey_PublicKey),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_4pkey_PublicKey) __PYX_ERR(3, 23, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -6207,11 +6204,11 @@ static int __Pyx_modinit_function_import_code(void) { /*--- Function import code ---*/ __pyx_t_1 = PyImport_ImportModule("ssh2.pkey"); if (!__pyx_t_1) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction_3_0_11(__pyx_t_1, "PyPublicKey", (void (**)(void))&__pyx_f_4ssh2_4pkey_PyPublicKey, "PyObject *(struct libssh2_agent_publickey *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) + if (__Pyx_ImportFunction_3_0_12(__pyx_t_1, "PyPublicKey", (void (**)(void))&__pyx_f_4ssh2_4pkey_PyPublicKey, "PyObject *(struct libssh2_agent_publickey *)") < 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(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction_3_0_11(__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_3_0_12(__pyx_t_1, "to_bytes", (void (**)(void))&__pyx_f_4ssh2_5utils_to_bytes, "PyObject *(PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -6899,19 +6896,6 @@ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { return result; } -/* ErrOccurredWithGIL */ -static CYTHON_INLINE int __Pyx_ErrOccurredWithGIL(void) { - int err; - #ifdef WITH_THREAD - PyGILState_STATE _save = PyGILState_Ensure(); - #endif - err = !!PyErr_Occurred(); - #ifdef WITH_THREAD - PyGILState_Release(_save); - #endif - return err; -} - /* PyDictVersioning */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { @@ -7841,50 +7825,6 @@ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *nam return 0; } -/* WriteUnraisableException */ -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename, - int full_traceback, int nogil) { - PyObject *old_exc, *old_val, *old_tb; - PyObject *ctx; - __Pyx_PyThreadState_declare -#ifdef WITH_THREAD - PyGILState_STATE state; - if (nogil) - state = PyGILState_Ensure(); - else state = (PyGILState_STATE)0; -#endif - CYTHON_UNUSED_VAR(clineno); - CYTHON_UNUSED_VAR(lineno); - CYTHON_UNUSED_VAR(filename); - CYTHON_MAYBE_UNUSED_VAR(nogil); - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); - if (full_traceback) { - Py_XINCREF(old_exc); - Py_XINCREF(old_val); - Py_XINCREF(old_tb); - __Pyx_ErrRestore(old_exc, old_val, old_tb); - PyErr_PrintEx(0); - } - #if PY_MAJOR_VERSION < 3 - ctx = PyString_FromString(name); - #else - ctx = PyUnicode_FromString(name); - #endif - __Pyx_ErrRestore(old_exc, old_val, old_tb); - if (!ctx) { - PyErr_WriteUnraisable(Py_None); - } else { - PyErr_WriteUnraisable(ctx); - Py_DECREF(ctx); - } -#ifdef WITH_THREAD - if (nogil) - PyGILState_Release(state); -#endif -} - /* KeywordStringCheck */ static int __Pyx_CheckKeywordStrings( PyObject *kw, @@ -8492,10 +8432,10 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { #endif /* TypeImport */ -#ifndef __PYX_HAVE_RT_ImportType_3_0_11 -#define __PYX_HAVE_RT_ImportType_3_0_11 -static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *module_name, const char *class_name, - size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size) +#ifndef __PYX_HAVE_RT_ImportType_3_0_12 +#define __PYX_HAVE_RT_ImportType_3_0_12 +static PyTypeObject *__Pyx_ImportType_3_0_12(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_12 check_size) { PyObject *result = 0; char warning[200]; @@ -8549,7 +8489,7 @@ static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *modul module_name, class_name, size, basicsize+itemsize); goto bad; } - if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_11 && + if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_12 && ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " @@ -8557,7 +8497,7 @@ static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *modul module_name, class_name, size, basicsize, basicsize+itemsize); goto bad; } - else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_11 && (size_t)basicsize > size) { + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_12 && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", @@ -9981,7 +9921,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { #include "compile.h" #include "frameobject.h" #include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif @@ -11080,9 +11020,9 @@ static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *s } /* FunctionImport */ -#ifndef __PYX_HAVE_RT_ImportFunction_3_0_11 -#define __PYX_HAVE_RT_ImportFunction_3_0_11 -static int __Pyx_ImportFunction_3_0_11(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { +#ifndef __PYX_HAVE_RT_ImportFunction_3_0_12 +#define __PYX_HAVE_RT_ImportFunction_3_0_12 +static int __Pyx_ImportFunction_3_0_12(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { PyObject *d = 0; PyObject *cobj = 0; union { diff --git a/ssh2/agent.pxd b/ssh2/agent.pxd index f47c40da..cc7800d4 100644 --- a/ssh2/agent.pxd +++ b/ssh2/agent.pxd @@ -31,7 +31,7 @@ cdef int auth_identity(const char *username, c_ssh2.libssh2_agent_publickey **identity, c_ssh2.libssh2_agent_publickey *prev) except -1 nogil -cdef void clear_agent(c_ssh2.LIBSSH2_AGENT *agent) nogil +cdef void clear_agent(c_ssh2.LIBSSH2_AGENT *agent) noexcept nogil cdef int agent_auth(char * _username, c_ssh2.LIBSSH2_AGENT * agent) except 1 nogil diff --git a/ssh2/agent.pyx b/ssh2/agent.pyx index 73589a85..cf30f865 100644 --- a/ssh2/agent.pyx +++ b/ssh2/agent.pyx @@ -85,7 +85,7 @@ cdef c_ssh2.LIBSSH2_AGENT * init_connect_agent( return agent -cdef void clear_agent(c_ssh2.LIBSSH2_AGENT *agent) nogil: +cdef void clear_agent(c_ssh2.LIBSSH2_AGENT *agent) noexcept nogil: c_ssh2.libssh2_agent_disconnect(agent) c_ssh2.libssh2_agent_free(agent) diff --git a/ssh2/channel.c b/ssh2/channel.c index 3da14a8c..e5a6a0cb 100644 --- a/ssh2/channel.c +++ b/ssh2/channel.c @@ -1,4 +1,4 @@ -/* Generated by Cython 3.0.11 */ +/* Generated by Cython 3.0.12 */ /* BEGIN: Cython Metadata { @@ -55,10 +55,10 @@ END: Cython Metadata */ #else #define __PYX_EXTRA_ABI_MODULE_NAME "" #endif -#define CYTHON_ABI "3_0_11" __PYX_EXTRA_ABI_MODULE_NAME +#define CYTHON_ABI "3_0_12" __PYX_EXTRA_ABI_MODULE_NAME #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." -#define CYTHON_HEX_VERSION 0x03000BF0 +#define CYTHON_HEX_VERSION 0x03000CF0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -1533,6 +1533,18 @@ struct __pyx_obj_4ssh2_7session_Session; struct __pyx_obj_4ssh2_7session_MethodType; struct __pyx_obj_4ssh2_4sftp_SFTP; struct __pyx_obj_4ssh2_7channel_Channel; +struct __pyx_ctuple_int__and_int; +typedef struct __pyx_ctuple_int__and_int __pyx_ctuple_int__and_int; + +/* "utils.pxd":24 + * cdef object to_str_len(char *c_str, int length) + * cpdef int handle_error_codes(int errcode) except -1 + * cpdef (int, int) find_eol(bytes buf: bytes, Py_ssize_t pos: Py_ssize_t) # <<<<<<<<<<<<<< + */ +struct __pyx_ctuple_int__and_int { + int f0; + int f1; +}; /* "session.pxd":19 * from . cimport c_ssh2 @@ -1886,7 +1898,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #if !CYTHON_VECTORCALL #if PY_VERSION_HEX >= 0x03080000 #include "frameobject.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif @@ -1955,22 +1967,22 @@ static int __Pyx_setup_reduce(PyObject* type_obj); #endif /* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_11 -#define __PYX_HAVE_RT_ImportType_proto_3_0_11 +#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_12 +#define __PYX_HAVE_RT_ImportType_proto_3_0_12 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #include #endif #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L -#define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) alignof(s) +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_12(s) alignof(s) #else -#define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) sizeof(void*) +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_12(s) sizeof(void*) #endif -enum __Pyx_ImportType_CheckSize_3_0_11 { - __Pyx_ImportType_CheckSize_Error_3_0_11 = 0, - __Pyx_ImportType_CheckSize_Warn_3_0_11 = 1, - __Pyx_ImportType_CheckSize_Ignore_3_0_11 = 2 +enum __Pyx_ImportType_CheckSize_3_0_12 { + __Pyx_ImportType_CheckSize_Error_3_0_12 = 0, + __Pyx_ImportType_CheckSize_Warn_3_0_12 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_0_12 = 2 }; -static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size); +static PyTypeObject *__Pyx_ImportType_3_0_12(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_12 check_size); #endif /* Import.proto */ @@ -2237,7 +2249,7 @@ static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig); /* FunctionImport.proto */ -static int __Pyx_ImportFunction_3_0_11(PyObject *module, const char *funcname, void (**f)(void), const char *sig); +static int __Pyx_ImportFunction_3_0_12(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); @@ -3940,7 +3952,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_4pty, "Channel.pty(self, term=u'vt100')\nRequest a PTY (physical terminal emulation) on the channel.\n\n :param term: Terminal type to emulate.\n :type term: str\n "); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_4pty, "pty(self, term=u'vt100')\nRequest a PTY (physical terminal emulation) on the channel.\n\n :param term: Terminal type to emulate.\n :type term: str\n "); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_5pty = {"pty", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_5pty, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_4pty}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_5pty(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -4168,7 +4180,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_6execute, "Channel.execute(self, command)\nExecute command.\n\n :param command: Command to execute\n :type command: str\n\n :raises: :py:class:`ssh2.exceptions.ChannelError` on errors executing\n command\n\n :rtype: int\n "); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_6execute, "execute(self, command)\nExecute command.\n\n :param command: Command to execute\n :type command: str\n\n :raises: :py:class:`ssh2.exceptions.ChannelError` on errors executing\n command\n\n :rtype: int\n "); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_7execute = {"execute", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_7execute, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_6execute}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_7execute(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -4400,7 +4412,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_8subsystem, "Channel.subsystem(self, subsystem)\nRequest subsystem from channel.\n\n :param subsystem: Name of subsystem\n :type subsystem: str"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_8subsystem, "subsystem(self, subsystem)\nRequest subsystem from channel.\n\n :param subsystem: Name of subsystem\n :type subsystem: str"); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_9subsystem = {"subsystem", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_9subsystem, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_8subsystem}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_9subsystem(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -4632,7 +4644,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_10shell, "Channel.shell(self)\nRequest interactive shell from channel.\n\n :raises: :py:class:`ssh2.exceptions.ChannelError` on errors requesting\n interactive shell.\n "); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_10shell, "shell(self)\nRequest interactive shell from channel.\n\n :raises: :py:class:`ssh2.exceptions.ChannelError` on errors requesting\n interactive shell.\n "); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_11shell = {"shell", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_11shell, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_10shell}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_11shell(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -4772,7 +4784,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_12read, "Channel.read(self, size_t size=1024)\nRead the stdout stream.\n Returns return code and output buffer tuple.\n\n Return code is the size of the buffer when positive.\n Negative values are error codes.\n\n :param size: Max buffer size to read.\n :type size: int\n\n :rtype: (int, bytes)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_12read, "read(self, size: int = 1024)\nRead the stdout stream.\n Returns return code and output buffer tuple.\n\n Return code is the size of the buffer when positive.\n Negative values are error codes.\n\n :param size: Max buffer size to read.\n :type size: int\n\n :rtype: (int, bytes)"); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_13read = {"read", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_13read, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_12read}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_13read(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -4940,7 +4952,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_14read_ex, "Channel.read_ex(self, size_t size=1024, int stream_id=0)\nRead the stream with given id.\n Returns return code and output buffer tuple.\n\n Return code is the size of the buffer when positive.\n Negative values are error codes.\n\n :param size: Max buffer size to read.\n :type size: int\n\n :rtype: (int, bytes)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_14read_ex, "read_ex(self, size: int = 1024, stream_id: int = 0)\nRead the stream with given id.\n Returns return code and output buffer tuple.\n\n Return code is the size of the buffer when positive.\n Negative values are error codes.\n\n :param size: Max buffer size to read.\n :type size: int\n\n :rtype: (int, bytes)"); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_15read_ex = {"read_ex", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_15read_ex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_14read_ex}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_15read_ex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -5361,7 +5373,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_16read_stderr, "Channel.read_stderr(self, size_t size=1024)\nRead the stderr stream.\n Returns return code and output buffer tuple.\n\n Return code is the size of the buffer when positive.\n Negative values are error codes.\n\n :rtype: (int, bytes)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_16read_stderr, "read_stderr(self, size: int = 1024)\nRead the stderr stream.\n Returns return code and output buffer tuple.\n\n Return code is the size of the buffer when positive.\n Negative values are error codes.\n\n :rtype: (int, bytes)"); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_17read_stderr = {"read_stderr", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_17read_stderr, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_16read_stderr}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_17read_stderr(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -5548,7 +5560,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_18eof, "Channel.eof(self)\nGet channel EOF status.\n\n :rtype: bool"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_18eof, "eof(self)\nGet channel EOF status.\n\n :rtype: bool"); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_19eof = {"eof", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_19eof, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_18eof}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_19eof(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -5691,7 +5703,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_20send_eof, "Channel.send_eof(self)\nTell the remote host that no further data will be sent on the\n specified channel. Processes typically interpret this as a closed stdin\n descriptor.\n\n Returns 0 on success or negative on failure.\n It returns ``LIBSSH2_ERROR_EAGAIN`` when it would otherwise block.\n\n :rtype: int\n "); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_20send_eof, "send_eof(self)\nTell the remote host that no further data will be sent on the\n specified channel. Processes typically interpret this as a closed stdin\n descriptor.\n\n Returns 0 on success or negative on failure.\n It returns ``LIBSSH2_ERROR_EAGAIN`` when it would otherwise block.\n\n :rtype: int\n "); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_21send_eof = {"send_eof", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_21send_eof, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_20send_eof}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_21send_eof(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -5831,7 +5843,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_22wait_eof, "Channel.wait_eof(self)\nWait for the remote end to acknowledge an EOF request.\n\n Returns 0 on success or negative on failure. It returns\n :py:class:`ssh2.error_codes.LIBSSH2_ERROR_EAGAIN` when it\n would otherwise block.\n\n :rtype: int\n "); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_22wait_eof, "wait_eof(self)\nWait for the remote end to acknowledge an EOF request.\n\n Returns 0 on success or negative on failure. It returns\n :py:class:`ssh2.error_codes.LIBSSH2_ERROR_EAGAIN` when it\n would otherwise block.\n\n :rtype: int\n "); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_23wait_eof = {"wait_eof", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_23wait_eof, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_22wait_eof}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_23wait_eof(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -5971,7 +5983,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_24close, "Channel.close(self)\nClose channel. Typically done to be able to get exit status."); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_24close, "close(self)\nClose channel. Typically done to be able to get exit status."); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_25close = {"close", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_25close, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_24close}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_25close(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6111,7 +6123,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_26flush, "Channel.flush(self)\nFlush stdout stream"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_26flush, "flush(self)\nFlush stdout stream"); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_27flush = {"flush", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_27flush, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_26flush}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_27flush(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6251,7 +6263,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_28flush_ex, "Channel.flush_ex(self, int stream_id)\nFlush stream with id"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_28flush_ex, "flush_ex(self, stream_id: int)\nFlush stream with id"); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_29flush_ex = {"flush_ex", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_29flush_ex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_28flush_ex}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_29flush_ex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6446,7 +6458,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_30flush_stderr, "Channel.flush_stderr(self)\nFlush stderr stream"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_30flush_stderr, "flush_stderr(self)\nFlush stderr stream"); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_31flush_stderr = {"flush_stderr", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_31flush_stderr, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_30flush_stderr}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_31flush_stderr(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6586,7 +6598,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_32wait_closed, "Channel.wait_closed(self)\nWait for server to acknowledge channel close command."); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_32wait_closed, "wait_closed(self)\nWait for server to acknowledge channel close command."); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_33wait_closed = {"wait_closed", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_33wait_closed, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_32wait_closed}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_33wait_closed(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6726,7 +6738,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_34get_exit_status, "Channel.get_exit_status(self)\nGet exit status of command.\n\n Note that ``0`` is also failure code for this function.\n\n Best used in non-blocking mode to avoid it being impossible to tell if\n ``0`` indicates failure or an actual exit status of ``0``.\n\n Exceptions are raised as with all functions in case of an SSH2Error.\n\n :rtype: int\n "); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_34get_exit_status, "get_exit_status(self)\nGet exit status of command.\n\n Note that ``0`` is also failure code for this function.\n\n Best used in non-blocking mode to avoid it being impossible to tell if\n ``0`` indicates failure or an actual exit status of ``0``.\n\n Exceptions are raised as with all functions in case of an SSH2Error.\n\n :rtype: int\n "); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_35get_exit_status = {"get_exit_status", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_35get_exit_status, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_34get_exit_status}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_35get_exit_status(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6874,7 +6886,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_36get_exit_signal, "Channel.get_exit_signal(self)\nGet exit signal, message and language tag, if any, for command.\n\n Returns (`returncode``, ``exit signal``, ``error message``,\n ``language tag``) tuple.\n\n :rtype: tuple(int, bytes, bytes, bytes)\n "); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_36get_exit_signal, "get_exit_signal(self)\nGet exit signal, message and language tag, if any, for command.\n\n Returns (`returncode``, ``exit signal``, ``error message``,\n ``language tag``) tuple.\n\n :rtype: tuple(int, bytes, bytes, bytes)\n "); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_37get_exit_signal = {"get_exit_signal", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_37get_exit_signal, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_36get_exit_signal}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_37get_exit_signal(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -7342,7 +7354,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_38setenv, "Channel.setenv(self, varname, value)\nSet environment variable on channel.\n\n :param varname: Name of variable to set.\n :type varname: str\n :param value: Value of variable.\n :type value: str\n\n :rtype: int"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_38setenv, "setenv(self, varname, value)\nSet environment variable on channel.\n\n :param varname: Name of variable to set.\n :type varname: str\n :param value: Value of variable.\n :type value: str\n\n :rtype: int"); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_39setenv = {"setenv", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_39setenv, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_38setenv}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_39setenv(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -7621,7 +7633,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_40window_read_ex, "Channel.window_read_ex(self, unsigned long read_avail, unsigned long window_size_initial)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_40window_read_ex, "window_read_ex(self, read_avail: int, window_size_initial: int)"); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_41window_read_ex = {"window_read_ex", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_41window_read_ex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_40window_read_ex}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_41window_read_ex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -7831,7 +7843,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_42window_read, "Channel.window_read(self)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_42window_read, "window_read(self)"); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_43window_read = {"window_read", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_43window_read, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_42window_read}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_43window_read(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -7971,7 +7983,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_44window_write_ex, "Channel.window_write_ex(self, unsigned long window_size_initial)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_44window_write_ex, "window_write_ex(self, window_size_initial: int)"); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_45window_write_ex = {"window_write_ex", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_45window_write_ex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_44window_write_ex}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_45window_write_ex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -8166,7 +8178,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_46window_write, "Channel.window_write(self)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_46window_write, "window_write(self)"); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_47window_write = {"window_write", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_47window_write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_46window_write}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_47window_write(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -8306,7 +8318,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_48receive_window_adjust, "Channel.receive_window_adjust(self, unsigned long adjustment, unsigned long force)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_48receive_window_adjust, "receive_window_adjust(self, adjustment: int, force: int)"); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_49receive_window_adjust = {"receive_window_adjust", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_49receive_window_adjust, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_48receive_window_adjust}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_49receive_window_adjust(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -8516,7 +8528,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_50receive_window_adjust2, "Channel.receive_window_adjust2(self, unsigned long adjustment, unsigned long force)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_50receive_window_adjust2, "receive_window_adjust2(self, adjustment: int, force: int)"); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_51receive_window_adjust2 = {"receive_window_adjust2", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_51receive_window_adjust2, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_50receive_window_adjust2}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_51receive_window_adjust2(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -8736,7 +8748,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_52write, "Channel.write(self, buf)\nWrite buffer to stdin.\n\n Returns tuple of (``return_code``, ``bytes_written``).\n\n In blocking mode ``bytes_written`` will always equal ``len(buf)`` if no\n errors have occurred which would raise exception.\n\n In non-blocking mode ``return_code`` can be LIBSSH2_ERROR_EAGAIN and\n ``bytes_written`` *can be less than* ``len(buf)``.\n\n Clients should resume from that point on next call to ``write``, ie\n ``buf[bytes_written_in_last_call:]``.\n\n .. note::\n While this function handles unicode strings for ``buf``\n argument, ``bytes_written`` offset will always be for the *bytes*\n representation thereof as returned by the C function calls which only\n handle byte strings.\n\n :param buf: Buffer to write\n :type buf: str\n\n :rtype: tuple(int, int)\n "); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_52write, "write(self, buf)\nWrite buffer to stdin.\n\n Returns tuple of (``return_code``, ``bytes_written``).\n\n In blocking mode ``bytes_written`` will always equal ``len(buf)`` if no\n errors have occurred which would raise exception.\n\n In non-blocking mode ``return_code`` can be LIBSSH2_ERROR_EAGAIN and\n ``bytes_written`` *can be less than* ``len(buf)``.\n\n Clients should resume from that point on next call to the function, ie\n ``buf[bytes_written_in_last_call:]``.\n\n .. note::\n While this function handles unicode strings for ``buf``\n argument, ``bytes_written`` offset will always be for the *bytes*\n representation thereof as returned by the C function calls which only\n handle byte strings.\n\n :param buf: Buffer to write\n :type buf: str\n\n :rtype: tuple(int, int)\n "); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_53write = {"write", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_53write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_52write}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_53write(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -9180,7 +9192,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_54write_ex, "Channel.write_ex(self, int stream_id, buf)\nWrite buffer to specified stream id.\n\n Returns tuple of (``return_code``, ``bytes_written``).\n\n In blocking mode ``bytes_written`` will always equal ``len(buf)`` if no\n errors have occurred which would raise exception.\n\n In non-blocking mode ``return_code`` can be LIBSSH2_ERROR_EAGAIN and\n ``bytes_written`` *can be less than* ``len(buf)``.\n\n Clients should resume from that point on next call to the function, ie\n ``buf[bytes_written_in_last_call:]``.\n\n .. note::\n While this function handles unicode strings for ``buf``\n argument, ``bytes_written`` offset will always be for the *bytes*\n representation thereof as returned by the C function calls which only\n handle byte strings.\n\n :param stream_id: Id of stream to write to\n :type stream_id: int\n :param buf: Buffer to write\n :type buf: str\n\n :rtype: tuple(int, int)\n "); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_54write_ex, "write_ex(self, stream_id: int, buf)\nWrite buffer to specified stream id.\n\n Returns tuple of (``return_code``, ``bytes_written``).\n\n In blocking mode ``bytes_written`` will always equal ``len(buf)`` if no\n errors have occurred which would raise exception.\n\n In non-blocking mode ``return_code`` can be LIBSSH2_ERROR_EAGAIN and\n ``bytes_written`` *can be less than* ``len(buf)``.\n\n Clients should resume from that point on next call to the function, ie\n ``buf[bytes_written_in_last_call:]``.\n\n .. note::\n While this function handles unicode strings for ``buf``\n argument, ``bytes_written`` offset will always be for the *bytes*\n representation thereof as returned by the C function calls which only\n handle byte strings.\n\n :param stream_id: Id of stream to write to\n :type stream_id: int\n :param buf: Buffer to write\n :type buf: str\n\n :rtype: tuple(int, int)\n "); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_55write_ex = {"write_ex", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_55write_ex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_54write_ex}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_55write_ex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -9639,7 +9651,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_56write_stderr, "Channel.write_stderr(self, buf)\nWrite buffer to stderr.\n\n Returns tuple of (``return_code``, ``bytes_written``).\n\n In blocking mode ``bytes_written`` will always equal ``len(buf)`` if no\n errors have occurred which would raise exception.\n\n In non-blocking mode ``return_code`` can be LIBSSH2_ERROR_EAGAIN and\n ``bytes_written`` *can be less than* ``len(buf)``.\n\n Clients should resume from that point on next call to ``write``, ie\n ``buf[bytes_written_in_last_call:]``.\n\n .. note::\n While this function handles unicode strings for ``buf``\n argument, ``bytes_written`` offset will always be for the *bytes*\n representation thereof as returned by the C function calls which only\n handle byte strings.\n\n :param buf: Buffer to write\n :type buf: str\n\n :rtype: tuple(int, int)\n "); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_56write_stderr, "write_stderr(self, buf)\nWrite buffer to stderr.\n\n Returns tuple of (``return_code``, ``bytes_written``).\n\n In blocking mode ``bytes_written`` will always equal ``len(buf)`` if no\n errors have occurred which would raise exception.\n\n In non-blocking mode ``return_code`` can be LIBSSH2_ERROR_EAGAIN and\n ``bytes_written`` *can be less than* ``len(buf)``.\n\n Clients should resume from that point on next call to ``write``, ie\n ``buf[bytes_written_in_last_call:]``.\n\n .. note::\n While this function handles unicode strings for ``buf``\n argument, ``bytes_written`` offset will always be for the *bytes*\n representation thereof as returned by the C function calls which only\n handle byte strings.\n\n :param buf: Buffer to write\n :type buf: str\n\n :rtype: tuple(int, int)\n "); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_57write_stderr = {"write_stderr", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_57write_stderr, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_56write_stderr}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_57write_stderr(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -10083,7 +10095,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_58x11_req, "Channel.x11_req(self, int screen_number)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_58x11_req, "x11_req(self, screen_number: int)"); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_59x11_req = {"x11_req", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_59x11_req, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_58x11_req}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_59x11_req(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -10278,7 +10290,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_60x11_req_ex, "Channel.x11_req_ex(self, int single_connection, const char *auth_proto, const char *auth_cookie, int screen_number)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_60x11_req_ex, "x11_req_ex(self, single_connection: int, auth_proto: bytes, auth_cookie: bytes, screen_number: int)"); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_61x11_req_ex = {"x11_req_ex", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_61x11_req_ex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_60x11_req_ex}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_61x11_req_ex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -10518,7 +10530,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_62process_startup, "Channel.process_startup(self, request, message=None)\nStartup process on server for request with message.\n\n Request is a supported SSH subsystem and clients would typically use\n one of execute/shell/subsystem functions depending on request type.\n\n :param request: Request type (exec/shell/subsystem).\n :type request: str\n :param message: Request message. Content depends on request type\n and can be ``None``.\n :type message: str or ``None``\n "); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_62process_startup, "process_startup(self, request, message=None)\nStartup process on server for request with message.\n\n Request is a supported SSH subsystem and clients would typically use\n one of execute/shell/subsystem functions depending on request type.\n\n :param request: Request type (exec/shell/subsystem).\n :type request: str\n :param message: Request message. Content depends on request type\n and can be ``None``.\n :type message: str or ``None``\n "); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_63process_startup = {"process_startup", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_63process_startup, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_62process_startup}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_63process_startup(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -10867,7 +10879,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_64poll_channel_read, "Channel.poll_channel_read(self, int extended)\nDeprecated - use session.block_directions and socket polling\n instead"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_64poll_channel_read, "poll_channel_read(self, extended: int)\nDeprecated - use session.block_directions and socket polling\n instead"); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_65poll_channel_read = {"poll_channel_read", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_65poll_channel_read, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_64poll_channel_read}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_65poll_channel_read(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -11062,7 +11074,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_66handle_extended_data, "Channel.handle_extended_data(self, int ignore_mode)\nDeprecated, use handle_extended_data2"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_66handle_extended_data, "handle_extended_data(self, ignore_mode: int)\nDeprecated, use handle_extended_data2"); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_67handle_extended_data = {"handle_extended_data", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_67handle_extended_data, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_66handle_extended_data}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_67handle_extended_data(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -11232,7 +11244,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_68handle_extended_data2, "Channel.handle_extended_data2(self, int ignore_mode)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_68handle_extended_data2, "handle_extended_data2(self, ignore_mode: int)"); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_69handle_extended_data2 = {"handle_extended_data2", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_69handle_extended_data2, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_68handle_extended_data2}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_69handle_extended_data2(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -11427,7 +11439,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_70ignore_extended_data, "Channel.ignore_extended_data(self, int ignore_mode)\nDeprecated, use handle_extended_data2"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_70ignore_extended_data, "ignore_extended_data(self, ignore_mode: int)\nDeprecated, use handle_extended_data2"); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_71ignore_extended_data = {"ignore_extended_data", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_71ignore_extended_data, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_70ignore_extended_data}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_71ignore_extended_data(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -11597,7 +11609,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_72request_auth_agent, "Channel.request_auth_agent(self)\nRequest SSH agent authentication forwarding on channel."); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_72request_auth_agent, "request_auth_agent(self)\nRequest SSH agent authentication forwarding on channel."); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_73request_auth_agent = {"request_auth_agent", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_73request_auth_agent, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_72request_auth_agent}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_73request_auth_agent(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -11732,7 +11744,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_74__reduce_cython__, "Channel.__reduce_cython__(self)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_74__reduce_cython__, "__reduce_cython__(self)"); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_75__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_75__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_74__reduce_cython__}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_75__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -11813,7 +11825,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_76__setstate_cython__, "Channel.__setstate_cython__(self, __pyx_state)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7channel_7Channel_76__setstate_cython__, "__setstate_cython__(self, __pyx_state)"); static PyMethodDef __pyx_mdef_4ssh2_7channel_7Channel_77__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7channel_7Channel_77__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7channel_7Channel_76__setstate_cython__}; static PyObject *__pyx_pw_4ssh2_7channel_7Channel_77__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -12870,12 +12882,12 @@ static int __Pyx_modinit_type_import_code(void) { /*--- Type import code ---*/ __pyx_t_1 = PyImport_ImportModule("ssh2.session"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_4ssh2_7session_Session = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.session", "Session", sizeof(struct __pyx_obj_4ssh2_7session_Session), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_7session_Session),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_7session_Session) __PYX_ERR(2, 19, __pyx_L1_error) - __pyx_ptype_4ssh2_7session_MethodType = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.session", "MethodType", sizeof(struct __pyx_obj_4ssh2_7session_MethodType), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_7session_MethodType),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_7session_MethodType) __PYX_ERR(2, 26, __pyx_L1_error) + __pyx_ptype_4ssh2_7session_Session = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.session", "Session", sizeof(struct __pyx_obj_4ssh2_7session_Session), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_7session_Session),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_7session_Session) __PYX_ERR(2, 19, __pyx_L1_error) + __pyx_ptype_4ssh2_7session_MethodType = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.session", "MethodType", sizeof(struct __pyx_obj_4ssh2_7session_MethodType), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_7session_MethodType),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_7session_MethodType) __PYX_ERR(2, 26, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyImport_ImportModule("ssh2.sftp"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_4ssh2_4sftp_SFTP = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.sftp", "SFTP", sizeof(struct __pyx_obj_4ssh2_4sftp_SFTP), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_4sftp_SFTP),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_4sftp_SFTP) __PYX_ERR(3, 26, __pyx_L1_error) + __pyx_ptype_4ssh2_4sftp_SFTP = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.sftp", "SFTP", sizeof(struct __pyx_obj_4ssh2_4sftp_SFTP), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_4sftp_SFTP),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_4sftp_SFTP) __PYX_ERR(3, 26, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -12903,8 +12915,8 @@ static int __Pyx_modinit_function_import_code(void) { /*--- Function import code ---*/ __pyx_t_1 = PyImport_ImportModule("ssh2.utils"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction_3_0_11(__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_3_0_11(__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_3_0_12(__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_3_0_12(__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) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -15631,10 +15643,10 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { #endif /* TypeImport */ -#ifndef __PYX_HAVE_RT_ImportType_3_0_11 -#define __PYX_HAVE_RT_ImportType_3_0_11 -static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *module_name, const char *class_name, - size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size) +#ifndef __PYX_HAVE_RT_ImportType_3_0_12 +#define __PYX_HAVE_RT_ImportType_3_0_12 +static PyTypeObject *__Pyx_ImportType_3_0_12(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_12 check_size) { PyObject *result = 0; char warning[200]; @@ -15688,7 +15700,7 @@ static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *modul module_name, class_name, size, basicsize+itemsize); goto bad; } - if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_11 && + if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_12 && ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " @@ -15696,7 +15708,7 @@ static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *modul module_name, class_name, size, basicsize, basicsize+itemsize); goto bad; } - else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_11 && (size_t)basicsize > size) { + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_12 && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", @@ -17146,7 +17158,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { #include "compile.h" #include "frameobject.h" #include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif @@ -18850,9 +18862,9 @@ static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *s } /* FunctionImport */ -#ifndef __PYX_HAVE_RT_ImportFunction_3_0_11 -#define __PYX_HAVE_RT_ImportFunction_3_0_11 -static int __Pyx_ImportFunction_3_0_11(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { +#ifndef __PYX_HAVE_RT_ImportFunction_3_0_12 +#define __PYX_HAVE_RT_ImportFunction_3_0_12 +static int __Pyx_ImportFunction_3_0_12(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { PyObject *d = 0; PyObject *cobj = 0; union { diff --git a/ssh2/channel.pyx b/ssh2/channel.pyx index 5691a3a2..5568cc22 100644 --- a/ssh2/channel.pyx +++ b/ssh2/channel.pyx @@ -361,7 +361,7 @@ cdef class Channel: In non-blocking mode ``return_code`` can be LIBSSH2_ERROR_EAGAIN and ``bytes_written`` *can be less than* ``len(buf)``. - Clients should resume from that point on next call to ``write``, ie + Clients should resume from that point on next call to the function, ie ``buf[bytes_written_in_last_call:]``. .. note:: diff --git a/ssh2/error_codes.c b/ssh2/error_codes.c index f7c06227..3c9e032c 100644 --- a/ssh2/error_codes.c +++ b/ssh2/error_codes.c @@ -1,4 +1,4 @@ -/* Generated by Cython 3.0.11 */ +/* Generated by Cython 3.0.12 */ /* BEGIN: Cython Metadata { @@ -54,10 +54,10 @@ END: Cython Metadata */ #else #define __PYX_EXTRA_ABI_MODULE_NAME "" #endif -#define CYTHON_ABI "3_0_11" __PYX_EXTRA_ABI_MODULE_NAME +#define CYTHON_ABI "3_0_12" __PYX_EXTRA_ABI_MODULE_NAME #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." -#define CYTHON_HEX_VERSION 0x03000BF0 +#define CYTHON_HEX_VERSION 0x03000CF0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -3639,7 +3639,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { #include "compile.h" #include "frameobject.h" #include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif diff --git a/ssh2/exceptions.c b/ssh2/exceptions.c index 5221bf76..370123f6 100644 --- a/ssh2/exceptions.c +++ b/ssh2/exceptions.c @@ -1,4 +1,4 @@ -/* Generated by Cython 3.0.11 */ +/* Generated by Cython 3.0.12 */ /* BEGIN: Cython Metadata { @@ -51,10 +51,10 @@ END: Cython Metadata */ #else #define __PYX_EXTRA_ABI_MODULE_NAME "" #endif -#define CYTHON_ABI "3_0_11" __PYX_EXTRA_ABI_MODULE_NAME +#define CYTHON_ABI "3_0_12" __PYX_EXTRA_ABI_MODULE_NAME #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." -#define CYTHON_HEX_VERSION 0x03000BF0 +#define CYTHON_HEX_VERSION 0x03000CF0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -1599,7 +1599,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #if !CYTHON_VECTORCALL #if PY_VERSION_HEX >= 0x03080000 #include "frameobject.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif @@ -6736,7 +6736,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { #include "compile.h" #include "frameobject.h" #include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif diff --git a/ssh2/extras.c b/ssh2/extras.c new file mode 100644 index 00000000..954ba208 --- /dev/null +++ b/ssh2/extras.c @@ -0,0 +1,7695 @@ +/* Generated by Cython 3.0.12 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "extra_compile_args": [ + "-O2" + ], + "include_dirs": [ + "libssh2/include" + ], + "libraries": [ + "ssh2" + ], + "library_dirs": [ + "/home/zefrer/Projects/ssh2-python/build_dir/src" + ], + "name": "ssh2.extras", + "runtime_library_dirs": [ + "$ORIGIN/." + ], + "sources": [ + "ssh2/extras.pyx" + ] + }, + "module_name": "ssh2.extras" +} +END: Cython Metadata */ + +#ifndef PY_SSIZE_T_CLEAN +#define PY_SSIZE_T_CLEAN +#endif /* PY_SSIZE_T_CLEAN */ +#if defined(CYTHON_LIMITED_API) && 0 + #ifndef Py_LIMITED_API + #if CYTHON_LIMITED_API+0 > 0x03030000 + #define Py_LIMITED_API CYTHON_LIMITED_API + #else + #define Py_LIMITED_API 0x03030000 + #endif + #endif +#endif + +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) + #error Cython requires Python 2.7+ or Python 3.3+. +#else +#if defined(CYTHON_LIMITED_API) && CYTHON_LIMITED_API +#define __PYX_EXTRA_ABI_MODULE_NAME "limited" +#else +#define __PYX_EXTRA_ABI_MODULE_NAME "" +#endif +#define CYTHON_ABI "3_0_12" __PYX_EXTRA_ABI_MODULE_NAME +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." +#define CYTHON_HEX_VERSION 0x03000CF0 +#define CYTHON_FUTURE_DIVISION 1 +#include +#ifndef offsetof + #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#define __PYX_COMMA , +#ifndef HAVE_LONG_LONG + #define HAVE_LONG_LONG +#endif +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX +#if defined(GRAALVM_PYTHON) + /* For very preliminary testing purposes. Most variables are set the same as PyPy. + The existence of this section does not imply that anything works or is even tested */ + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 1 + #define CYTHON_COMPILING_IN_NOGIL 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif + #undef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 0 +#elif defined(PYPY_VERSION) + #define CYTHON_COMPILING_IN_PYPY 1 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif + #if PY_VERSION_HEX < 0x03090000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif + #undef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 0 +#elif defined(CYTHON_LIMITED_API) + #ifdef Py_LIMITED_API + #undef __PYX_LIMITED_VERSION_HEX + #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API + #endif + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 1 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 + #undef CYTHON_CLINE_IN_TRACEBACK + #define CYTHON_CLINE_IN_TRACEBACK 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 1 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #endif + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 1 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #endif + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif + #undef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 0 +#elif defined(Py_GIL_DISABLED) || defined(Py_NOGIL) + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 1 + #ifndef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #ifndef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #ifndef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 1 + #endif + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 + #endif + #ifndef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 0 + #endif +#else + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 + #ifndef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #ifndef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 1 + #endif + #if PY_MAJOR_VERSION < 3 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #ifndef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 1 + #endif + #ifndef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 1 + #endif + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #elif !defined(CYTHON_USE_UNICODE_WRITER) + #define CYTHON_USE_UNICODE_WRITER 1 + #endif + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #ifndef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 1 + #endif + #ifndef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) + #endif + #ifndef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 1 + #endif + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #if PY_VERSION_HEX < 0x030400a1 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #elif !defined(CYTHON_USE_TP_FINALIZE) + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #if PY_VERSION_HEX < 0x030600B1 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #elif !defined(CYTHON_USE_DICT_VERSIONS) + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5) + #endif + #if PY_VERSION_HEX < 0x030700A3 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #elif !defined(CYTHON_USE_EXC_INFO_STACK) + #define CYTHON_USE_EXC_INFO_STACK 1 + #endif + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 + #endif + #ifndef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 1 + #endif +#endif +#if !defined(CYTHON_FAST_PYCCALL) +#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) +#endif +#if !defined(CYTHON_VECTORCALL) +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) +#endif +#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_MAJOR_VERSION < 3 + #include "longintrepr.h" + #endif + #undef SHIFT + #undef BASE + #undef MASK + #ifdef SIZEOF_VOID_P + enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; + #endif +#endif +#ifndef __has_attribute + #define __has_attribute(x) 0 +#endif +#ifndef __has_cpp_attribute + #define __has_cpp_attribute(x) 0 +#endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) && _MSC_VER >= 1400 + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif +#ifndef CYTHON_UNUSED + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(maybe_unused) + #define CYTHON_UNUSED [[maybe_unused]] + #endif + #endif + #endif +#endif +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_UNUSED_VAR +# if defined(__cplusplus) + template void CYTHON_UNUSED_VAR( const T& ) { } +# else +# define CYTHON_UNUSED_VAR(x) (void)(x) +# endif +#endif +#ifndef CYTHON_MAYBE_UNUSED_VAR + #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) +#endif +#ifndef CYTHON_NCP_UNUSED +# if CYTHON_COMPILING_IN_CPYTHON +# define CYTHON_NCP_UNUSED +# else +# define CYTHON_NCP_UNUSED CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_USE_CPP_STD_MOVE + #if defined(__cplusplus) && (\ + __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) + #define CYTHON_USE_CPP_STD_MOVE 1 + #else + #define CYTHON_USE_CPP_STD_MOVE 0 + #endif +#endif +#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) +#ifdef _MSC_VER + #ifndef _MSC_STDINT_H_ + #if _MSC_VER < 1300 + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; + #else + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + #endif + #endif + #if _MSC_VER < 1300 + #ifdef _WIN64 + typedef unsigned long long __pyx_uintptr_t; + #else + typedef unsigned int __pyx_uintptr_t; + #endif + #else + #ifdef _WIN64 + typedef unsigned __int64 __pyx_uintptr_t; + #else + typedef unsigned __int32 __pyx_uintptr_t; + #endif + #endif +#else + #include + typedef uintptr_t __pyx_uintptr_t; +#endif +#ifndef CYTHON_FALLTHROUGH + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_attribute(fallthrough) + #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) + #else + #define CYTHON_FALLTHROUGH + #endif + #endif + #if defined(__clang__) && defined(__apple_build_version__) + #if __apple_build_version__ < 7000000 + #undef CYTHON_FALLTHROUGH + #define CYTHON_FALLTHROUGH + #endif + #endif +#endif +#ifdef __cplusplus + template + struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; + #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) +#else + #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) +#endif +#if CYTHON_COMPILING_IN_PYPY == 1 + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) + +#ifndef CYTHON_INLINE + #if defined(__clang__) + #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) + #elif defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +#define __PYX_BUILD_PY_SSIZE_T "n" +#define CYTHON_FORMAT_SSIZE_T "z" +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_DefaultClassType PyClass_Type + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_DefaultClassType PyType_Type +#if CYTHON_COMPILING_IN_LIMITED_API + static CYTHON_INLINE PyObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyObject *exception_table = NULL; + PyObject *types_module=NULL, *code_type=NULL, *result=NULL; + #if __PYX_LIMITED_VERSION_HEX < 0x030B0000 + PyObject *version_info; + PyObject *py_minor_version = NULL; + #endif + long minor_version = 0; + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000 + minor_version = 11; + #else + if (!(version_info = PySys_GetObject("version_info"))) goto end; + if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; + minor_version = PyLong_AsLong(py_minor_version); + Py_DECREF(py_minor_version); + if (minor_version == -1 && PyErr_Occurred()) goto end; + #endif + if (!(types_module = PyImport_ImportModule("types"))) goto end; + if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end; + if (minor_version <= 7) { + (void)p; + result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOO", a, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else if (minor_version <= 10) { + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOO", a,p, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else { + if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end; + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOO", a,p, k, l, s, f, code, + c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell); + } + end: + Py_XDECREF(code_type); + Py_XDECREF(exception_table); + Py_XDECREF(types_module); + if (type) { + PyErr_Restore(type, value, traceback); + } + return result; + } + #ifndef CO_OPTIMIZED + #define CO_OPTIMIZED 0x0001 + #endif + #ifndef CO_NEWLOCALS + #define CO_NEWLOCALS 0x0002 + #endif + #ifndef CO_VARARGS + #define CO_VARARGS 0x0004 + #endif + #ifndef CO_VARKEYWORDS + #define CO_VARKEYWORDS 0x0008 + #endif + #ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x0200 + #endif + #ifndef CO_GENERATOR + #define CO_GENERATOR 0x0020 + #endif + #ifndef CO_COROUTINE + #define CO_COROUTINE 0x0080 + #endif +#elif PY_VERSION_HEX >= 0x030B0000 + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyCodeObject *result; + PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0); + if (!empty_bytes) return NULL; + result = + #if PY_VERSION_HEX >= 0x030C0000 + PyUnstable_Code_NewWithPosOnlyArgs + #else + PyCode_NewWithPosOnlyArgs + #endif + (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, empty_bytes); + Py_DECREF(empty_bytes); + return result; + } +#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#else + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +#endif +#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) + #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) +#else + #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) + #define __Pyx_Py_Is(x, y) Py_Is(x, y) +#else + #define __Pyx_Py_Is(x, y) ((x) == (y)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) + #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) +#else + #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) + #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) +#else + #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) + #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) +#else + #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) +#endif +#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) +#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) +#else + #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) +#endif +#ifndef CO_COROUTINE + #define CO_COROUTINE 0x80 +#endif +#ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 +#endif +#ifndef Py_TPFLAGS_CHECKTYPES + #define Py_TPFLAGS_CHECKTYPES 0 +#endif +#ifndef Py_TPFLAGS_HAVE_INDEX + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#ifndef Py_TPFLAGS_HAVE_NEWBUFFER + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#ifndef Py_TPFLAGS_HAVE_FINALIZE + #define Py_TPFLAGS_HAVE_FINALIZE 0 +#endif +#ifndef Py_TPFLAGS_SEQUENCE + #define Py_TPFLAGS_SEQUENCE 0 +#endif +#ifndef Py_TPFLAGS_MAPPING + #define Py_TPFLAGS_MAPPING 0 +#endif +#ifndef METH_STACKLESS + #define METH_STACKLESS 0 +#endif +#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) + #ifndef METH_FASTCALL + #define METH_FASTCALL 0x80 + #endif + typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); + typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, + Py_ssize_t nargs, PyObject *kwnames); +#else + #if PY_VERSION_HEX >= 0x030d00A4 + # define __Pyx_PyCFunctionFast PyCFunctionFast + # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords + #else + # define __Pyx_PyCFunctionFast _PyCFunctionFast + # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords + #endif +#endif +#if CYTHON_METH_FASTCALL + #define __Pyx_METH_FASTCALL METH_FASTCALL + #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast + #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords +#else + #define __Pyx_METH_FASTCALL METH_VARARGS + #define __Pyx_PyCFunction_FastCall PyCFunction + #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords +#endif +#if CYTHON_VECTORCALL + #define __pyx_vectorcallfunc vectorcallfunc + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET + #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) +#elif CYTHON_BACKPORT_VECTORCALL + typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, + size_t nargsf, PyObject *kwnames); + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if PY_MAJOR_VERSION >= 0x030900B1 +#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func) +#else +#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func) +#endif +#define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func) +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth) +#elif !CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func) +#endif +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags) +static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) { + return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self; +} +#endif +static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void *cfunc) { +#if CYTHON_COMPILING_IN_LIMITED_API + return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc; +#else + return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; +#endif +} +#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc) +#if __PYX_LIMITED_VERSION_HEX < 0x030900B1 + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) + typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); +#else + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) + #define __Pyx_PyCMethod PyCMethod +#endif +#ifndef METH_METHOD + #define METH_METHOD 0x200 +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) + #define PyObject_Malloc(s) PyMem_Malloc(s) + #define PyObject_Free(p) PyMem_Free(p) + #define PyObject_Realloc(p) PyMem_Realloc(p) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) +#else + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyThreadState_Current PyThreadState_Get() +#elif !CYTHON_FAST_THREAD_STATE + #define __Pyx_PyThreadState_Current PyThreadState_GET() +#elif PY_VERSION_HEX >= 0x030d00A1 + #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked() +#elif PY_VERSION_HEX >= 0x03060000 + #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() +#elif PY_VERSION_HEX >= 0x03000000 + #define __Pyx_PyThreadState_Current PyThreadState_GET() +#else + #define __Pyx_PyThreadState_Current _PyThreadState_Current +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op) +{ + void *result; + result = PyModule_GetState(op); + if (!result) + Py_FatalError("Couldn't find the module state"); + return result; +} +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) +#endif +#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) +#include "pythread.h" +#define Py_tss_NEEDS_INIT 0 +typedef int Py_tss_t; +static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { + *key = PyThread_create_key(); + return 0; +} +static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { + Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); + *key = Py_tss_NEEDS_INIT; + return key; +} +static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { + PyObject_Free(key); +} +static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { + return *key != Py_tss_NEEDS_INIT; +} +static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { + PyThread_delete_key(*key); + *key = Py_tss_NEEDS_INIT; +} +static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { + return PyThread_set_key_value(*key, value); +} +static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { + return PyThread_get_key_value(*key); +} +#endif +#if PY_MAJOR_VERSION < 3 + #if CYTHON_COMPILING_IN_PYPY + #if PYPY_VERSION_NUM < 0x07030600 + #if defined(__cplusplus) && __cplusplus >= 201402L + [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] + #elif defined(__GNUC__) || defined(__clang__) + __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) + #elif defined(_MSC_VER) + __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) + #endif + static CYTHON_INLINE int PyGILState_Check(void) { + return 0; + } + #else // PYPY_VERSION_NUM < 0x07030600 + #endif // PYPY_VERSION_NUM < 0x07030600 + #else + static CYTHON_INLINE int PyGILState_Check(void) { + PyThreadState * tstate = _PyThreadState_Current; + return tstate && (tstate == PyGILState_GetThisThreadState()); + } + #endif +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 || defined(_PyDict_NewPresized) +#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) +#else +#define __Pyx_PyDict_NewPresized(n) PyDict_New() +#endif +#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && PY_VERSION_HEX < 0x030d0000 && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { + PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); + if (res == NULL) PyErr_Clear(); + return res; +} +#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) +#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#else +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { +#if CYTHON_COMPILING_IN_PYPY + return PyDict_GetItem(dict, name); +#else + PyDictEntry *ep; + PyDictObject *mp = (PyDictObject*) dict; + long hash = ((PyStringObject *) name)->ob_shash; + assert(hash != -1); + ep = (mp->ma_lookup)(mp, name, hash); + if (ep == NULL) { + return NULL; + } + return ep->me_value; +#endif +} +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#endif +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) + #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) + #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) +#else + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) + #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v) +#else + #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v) +#endif +#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 +#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ + PyTypeObject *type = Py_TYPE((PyObject*)obj);\ + assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ + PyObject_GC_Del(obj);\ + Py_DECREF(type);\ +} +#else +#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) + #define __Pyx_PyUnicode_DATA(u) ((void*)u) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) +#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_READY(op) (0) + #else + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #endif + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) + #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) + #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) + #else + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) + #else + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) + #endif + #endif +#else + #define CYTHON_PEP393_ENABLED 0 + #define PyUnicode_1BYTE_KIND 1 + #define PyUnicode_2BYTE_KIND 2 + #define PyUnicode_4BYTE_KIND 4 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) + #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) +#endif +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) +#else + #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ + PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) +#endif +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) + #undef PyUnicode_Contains + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) + #endif + #if !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) + #endif + #if !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) + #endif +#endif +#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) +#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) +#else + #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) +#endif +#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) + #define PyObject_ASCII(o) PyObject_Repr(o) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#ifndef PyObject_Unicode + #define PyObject_Unicode PyObject_Str +#endif +#endif +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) + #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) +#else + #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) + #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) +#endif +#if CYTHON_COMPILING_IN_CPYTHON + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#else + #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) +#endif +#if PY_VERSION_HEX >= 0x030900A4 + #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) +#else + #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) +#endif +#if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) + #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o) +#else + #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) + #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) + #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o) +#endif +#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1 + #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) +#else + static CYTHON_INLINE PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { + PyObject *module = PyImport_AddModule(name); + Py_XINCREF(module); + return module; + } +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define __Pyx_Py3Int_Check(op) PyLong_Check(op) + #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask + #define PyNumber_Int PyNumber_Long +#else + #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) + #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif +#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY + #ifndef PyUnicode_InternFromString + #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) + #endif +#endif +#if PY_VERSION_HEX < 0x030200A4 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t +#endif +#if CYTHON_USE_ASYNC_SLOTS + #if PY_VERSION_HEX >= 0x030500B1 + #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods + #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) + #else + #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) + #endif +#else + #define __Pyx_PyType_AsAsync(obj) NULL +#endif +#ifndef __Pyx_PyAsyncMethodsStruct + typedef struct { + unaryfunc am_await; + unaryfunc am_aiter; + unaryfunc am_anext; + } __Pyx_PyAsyncMethodsStruct; +#endif + +#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) + #if !defined(_USE_MATH_DEFINES) + #define _USE_MATH_DEFINES + #endif +#endif +#include +#ifdef NAN +#define __PYX_NAN() ((float) NAN) +#else +static CYTHON_INLINE float __PYX_NAN() { + float value; + memset(&value, 0xFF, sizeof(value)); + return value; +} +#endif +#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) +#define __Pyx_truncl trunc +#else +#define __Pyx_truncl truncl +#endif + +#define __PYX_MARK_ERR_POS(f_index, lineno) \ + { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; } +#define __PYX_ERR(f_index, lineno, Ln_error) \ + { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } + +#ifdef CYTHON_EXTERN_C + #undef __PYX_EXTERN_C + #define __PYX_EXTERN_C CYTHON_EXTERN_C +#elif defined(__PYX_EXTERN_C) + #ifdef _MSC_VER + #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") + #else + #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. + #endif +#else + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#define __PYX_HAVE__ssh2__extras +#define __PYX_HAVE_API__ssh2__extras +/* Early includes */ +#include "libssh2.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; + const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8) +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#define __Pyx_uchar_cast(c) ((unsigned char)c) +#define __Pyx_long_cast(x) ((long)x) +#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ + (sizeof(type) < sizeof(Py_ssize_t)) ||\ + (sizeof(type) > sizeof(Py_ssize_t) &&\ + likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX) &&\ + (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ + v == (type)PY_SSIZE_T_MIN))) ||\ + (sizeof(type) == sizeof(Py_ssize_t) &&\ + (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX))) ) +static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { + return (size_t) i < (size_t) limit; +} +#if defined (__cplusplus) && __cplusplus >= 201103L + #include + #define __Pyx_sst_abs(value) std::abs(value) +#elif SIZEOF_INT >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) abs(value) +#elif SIZEOF_LONG >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) labs(value) +#elif defined (_MSC_VER) + #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) +#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define __Pyx_sst_abs(value) llabs(value) +#elif defined (__GNUC__) + #define __Pyx_sst_abs(value) __builtin_llabs(value) +#else + #define __Pyx_sst_abs(value) ((value<0) ? -value : value) +#endif +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*); +#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#else + #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize +#endif +#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) +#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) +#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) +#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) +#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) +#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); +#define __Pyx_PySequence_Tuple(obj)\ + (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); +#if CYTHON_ASSUME_SAFE_MACROS +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) +#else +#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) +#endif +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_VERSION_HEX >= 0x030C00A7 + #ifndef _PyLong_SIGN_MASK + #define _PyLong_SIGN_MASK 3 + #endif + #ifndef _PyLong_NON_SIZE_BITS + #define _PyLong_NON_SIZE_BITS 3 + #endif + #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) + #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) + #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) + #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) + #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_SignedDigitCount(x)\ + ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) + #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) + #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) + #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) + #else + #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) + #endif + typedef Py_ssize_t __Pyx_compact_pylong; + typedef size_t __Pyx_compact_upylong; + #else + #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) + #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) + #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) + #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) + #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) + #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) + #define __Pyx_PyLong_CompactValue(x)\ + ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) + typedef sdigit __Pyx_compact_pylong; + typedef digit __Pyx_compact_upylong; + #endif + #if PY_VERSION_HEX >= 0x030C00A5 + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) + #else + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) + #endif +#endif +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII +#include +static int __Pyx_sys_getdefaultencoding_not_ascii; +static int __Pyx_init_sys_getdefaultencoding_params(void) { + PyObject* sys; + PyObject* default_encoding = NULL; + PyObject* ascii_chars_u = NULL; + PyObject* ascii_chars_b = NULL; + const char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (!sys) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); + Py_DECREF(sys); + if (!default_encoding) goto bad; + default_encoding_c = PyBytes_AsString(default_encoding); + if (!default_encoding_c) goto bad; + if (strcmp(default_encoding_c, "ascii") == 0) { + __Pyx_sys_getdefaultencoding_not_ascii = 0; + } else { + char ascii_chars[128]; + int c; + for (c = 0; c < 128; c++) { + ascii_chars[c] = (char) c; + } + __Pyx_sys_getdefaultencoding_not_ascii = 1; + ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); + if (!ascii_chars_u) goto bad; + ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); + if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { + PyErr_Format( + PyExc_ValueError, + "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", + default_encoding_c); + goto bad; + } + Py_DECREF(ascii_chars_u); + Py_DECREF(ascii_chars_b); + } + Py_DECREF(default_encoding); + return 0; +bad: + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return -1; +} +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#else +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT +#include +static char* __PYX_DEFAULT_STRING_ENCODING; +static int __Pyx_init_sys_getdefaultencoding_params(void) { + PyObject* sys; + PyObject* default_encoding = NULL; + char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (!sys) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + Py_DECREF(sys); + if (!default_encoding) goto bad; + default_encoding_c = PyBytes_AsString(default_encoding); + if (!default_encoding_c) goto bad; + __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1); + if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; + strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); + Py_DECREF(default_encoding); + return 0; +bad: + Py_XDECREF(default_encoding); + return -1; +} +#endif +#endif + + +/* Test for GCC > 2.95 */ +#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) +#else /* !__GNUC__ or GCC < 2.95 */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ +static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } + +#if !CYTHON_USE_MODULE_STATE +static PyObject *__pyx_m = NULL; +#endif +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm = __FILE__; +static const char *__pyx_filename; + +/* #### Code section: filename_table ### */ + +static const char *__pyx_f[] = { + "ssh2/extras.pyx", +}; +/* #### Code section: utility_code_proto_before_types ### */ +/* ForceInitThreads.proto */ +#ifndef __PYX_FORCE_INIT_THREADS + #define __PYX_FORCE_INIT_THREADS 0 +#endif + +/* #### Code section: numeric_typedefs ### */ +/* #### Code section: complex_type_declarations ### */ +/* #### Code section: type_declarations ### */ + +/*--- Type declarations ---*/ +/* #### Code section: utility_code_proto ### */ + +/* --- Runtime support code (head) --- */ +/* Refnanny.proto */ +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, Py_ssize_t); + void (*DECREF)(void*, PyObject*, Py_ssize_t); + void (*GOTREF)(void*, PyObject*, Py_ssize_t); + void (*GIVEREF)(void*, PyObject*, Py_ssize_t); + void* (*SetupContext)(const char*, Py_ssize_t, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil)\ + if (acquire_gil) {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + PyGILState_Release(__pyx_gilstate_save);\ + } else {\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil)\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) + #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() +#endif + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } + #define __Pyx_RefNannyFinishContext()\ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContextNogil() + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif +#define __Pyx_Py_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; Py_XDECREF(tmp);\ + } while (0) +#define __Pyx_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_XDECREF(tmp);\ + } while (0) +#define __Pyx_DECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_DECREF(tmp);\ + } while (0) +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +/* TupleAndListFromArray.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); +static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); +#endif + +/* IncludeStringH.proto */ +#include + +/* BytesEquals.proto */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +/* UnicodeEquals.proto */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + +/* fastcall.proto */ +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_Arg_VARARGS(args, i) PySequence_GetItem(args, i) +#elif CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i) +#else + #define __Pyx_Arg_VARARGS(args, i) PyTuple_GetItem(args, i) +#endif +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg) + #define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg) +#else + #define __Pyx_Arg_NewRef_VARARGS(arg) arg + #define __Pyx_Arg_XDECREF_VARARGS(arg) +#endif +#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) +#define __Pyx_KwValues_VARARGS(args, nargs) NULL +#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) +#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) +#if CYTHON_METH_FASTCALL + #define __Pyx_Arg_FASTCALL(args, i) args[i] + #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds) + #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) + static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 + CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues); + #else + #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) + #endif + #define __Pyx_Arg_NewRef_FASTCALL(arg) arg /* no-op, __Pyx_Arg_FASTCALL is direct and this needs + to have the same reference counting */ + #define __Pyx_Arg_XDECREF_FASTCALL(arg) +#else + #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS + #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS + #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS + #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS + #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS + #define __Pyx_Arg_NewRef_FASTCALL(arg) __Pyx_Arg_NewRef_VARARGS(arg) + #define __Pyx_Arg_XDECREF_FASTCALL(arg) __Pyx_Arg_XDECREF_VARARGS(arg) +#endif +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start) +#else +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) +#endif + +/* 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); + +/* RaiseDoubleKeywords.proto */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); + +/* ParseKeywords.proto */ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues, + PyObject **argnames[], + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, + const char* function_name); + +/* 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 + +/* PyFunctionFastCall.proto */ +#if CYTHON_FAST_PYCALL +#if !CYTHON_VECTORCALL +#define __Pyx_PyFunction_FastCall(func, args, nargs)\ + __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); +#endif +#define __Pyx_BUILD_ASSERT_EXPR(cond)\ + (sizeof(char [1 - 2*!(cond)]) - 1) +#ifndef Py_MEMBER_SIZE +#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) +#endif +#if !CYTHON_VECTORCALL +#if PY_VERSION_HEX >= 0x03080000 + #include "frameobject.h" +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif + #define __Pxy_PyFrame_Initialize_Offsets() + #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus) +#else + static size_t __pyx_pyframe_localsplus_offset = 0; + #include "frameobject.h" + #define __Pxy_PyFrame_Initialize_Offsets()\ + ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ + (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) + #define __Pyx_PyFrame_GetLocalsplus(frame)\ + (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) +#endif +#endif +#endif + +/* PyObjectCallMethO.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif + +/* PyObjectFastCall.proto */ +#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs); + +/* ArgTypeTest.proto */ +#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ + ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\ + __Pyx__ArgTypeTest(obj, type, name, exact)) +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); + +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +/* PyThreadStateGet.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() 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 && PY_VERSION_HEX < 0x030C00A6 +#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 + +/* IterFinish.proto */ +static CYTHON_INLINE int __Pyx_IterFinish(void); + +/* UnpackItemEndCheck.proto */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); + +/* PyObjectGetAttrStr.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +/* Import.proto */ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); + +/* ImportFrom.proto */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); + +/* IncludeStructmemberH.proto */ +#include + +/* FixUpExtensionType.proto */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); +#endif + +/* FetchSharedCythonModule.proto */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void); + +/* FetchCommonType.proto */ +#if !CYTHON_USE_TYPE_SPECS +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); +#else +static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases); +#endif + +/* PyMethodNew.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + PyObject *typesModule=NULL, *methodType=NULL, *result=NULL; + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + typesModule = PyImport_ImportModule("types"); + if (!typesModule) return NULL; + methodType = PyObject_GetAttrString(typesModule, "MethodType"); + Py_DECREF(typesModule); + if (!methodType) return NULL; + result = PyObject_CallFunctionObjArgs(methodType, func, self, NULL); + Py_DECREF(methodType); + return result; +} +#elif PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + return PyMethod_New(func, self); +} +#else + #define __Pyx_PyMethod_New PyMethod_New +#endif + +/* PyVectorcallFastCallDict.proto */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); +#endif + +/* CythonFunctionShared.proto */ +#define __Pyx_CyFunction_USED +#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 +#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 +#define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CYFUNCTION_COROUTINE 0x08 +#define __Pyx_CyFunction_GetClosure(f)\ + (((__pyx_CyFunctionObject *) (f))->func_closure) +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_CyFunction_GetClassObj(f)\ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#else + #define __Pyx_CyFunction_GetClassObj(f)\ + ((PyObject*) ((PyCMethodObject *) (f))->mm_class) +#endif +#define __Pyx_CyFunction_SetClassObj(f, classobj)\ + __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) +#define __Pyx_CyFunction_Defaults(type, f)\ + ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) +#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ + ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) +typedef struct { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject_HEAD + PyObject *func; +#elif PY_VERSION_HEX < 0x030900B1 + PyCFunctionObject func; +#else + PyCMethodObject func; +#endif +#if CYTHON_BACKPORT_VECTORCALL + __pyx_vectorcallfunc func_vectorcall; +#endif +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_weakreflist; +#endif + PyObject *func_dict; + PyObject *func_name; + PyObject *func_qualname; + PyObject *func_doc; + PyObject *func_globals; + PyObject *func_code; + PyObject *func_closure; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_classobj; +#endif + void *defaults; + int defaults_pyobjects; + size_t defaults_size; + int flags; + PyObject *defaults_tuple; + PyObject *defaults_kwdict; + PyObject *(*defaults_getter)(PyObject *); + PyObject *func_annotations; + PyObject *func_is_coroutine; +} __pyx_CyFunctionObject; +#undef __Pyx_CyOrPyCFunction_Check +#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType) +#define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type) +#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType) +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc); +#undef __Pyx_IsSameCFunction +#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc) +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, + size_t size, + int pyobjects); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, + PyObject *dict); +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, + PyObject *dict); +static int __pyx_CyFunction_init(PyObject *module); +#if CYTHON_METH_FASTCALL +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#if CYTHON_BACKPORT_VECTORCALL +#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) +#else +#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) +#endif +#endif + +/* CythonFunction.proto */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); + +/* PyDictVersioning.proto */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) +#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ + (version_var) = __PYX_GET_DICT_VERSION(dict);\ + (cache_var) = (value); +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ + (VAR) = __pyx_dict_cached_value;\ + } else {\ + (VAR) = __pyx_dict_cached_value = (LOOKUP);\ + __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ + }\ +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); +#else +#define __PYX_GET_DICT_VERSION(dict) (0) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); +#endif + +/* PyErrExceptionMatches.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); +#else +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) +#endif + +/* PyObjectGetAttrStrNoError.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + +/* CLineInTraceback.proto */ +#ifdef CYTHON_CLINE_IN_TRACEBACK +#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) +#else +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); +#endif + +/* CodeObjectCache.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API +typedef struct { + PyCodeObject* code_object; + int code_line; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); +#endif + +/* AddTraceback.proto */ +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); + +/* GCCDiagnostics.proto */ +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC +#endif + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From___pyx_anon_enum(int value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *); + +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#else +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); + +/* FastTypeChecks.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); +#else +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) +#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) +#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) +#endif +#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) +#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) + +/* CheckBinaryVersion.proto */ +static unsigned long __Pyx_get_runtime_version(void); +static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer); + +/* InitStrings.proto */ +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); + +/* #### Code section: module_declarations ### */ + +/* Module declarations from "ssh2" */ + +/* Module declarations from "ssh2.error_codes" */ + +/* Module declarations from "ssh2.extras" */ +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ +#define __Pyx_MODULE_NAME "ssh2.extras" +extern int __pyx_module_is_main_ssh2__extras; +int __pyx_module_is_main_ssh2__extras = 0; + +/* Implementation of "ssh2.extras" */ +/* #### Code section: global_var ### */ +/* #### Code section: string_decls ### */ +static const char __pyx_k_[] = "."; +static const char __pyx_k__6[] = "?"; +static const char __pyx_k_rc[] = "rc"; +static const char __pyx_k_Any[] = "Any"; +static const char __pyx_k_ret[] = "ret"; +static const char __pyx_k_None[] = "None"; +static const char __pyx_k_args[] = "args"; +static const char __pyx_k_data[] = "data"; +static const char __pyx_k_func[] = "func"; +static const char __pyx_k_main[] = "__main__"; +static const char __pyx_k_name[] = "__name__"; +static const char __pyx_k_test[] = "__test__"; +static const char __pyx_k_utils[] = "utils"; +static const char __pyx_k_import[] = "__import__"; +static const char __pyx_k_kwargs[] = "kwargs"; +static const char __pyx_k_return[] = "return"; +static const char __pyx_k_typing[] = "typing"; +static const char __pyx_k_Callable[] = "Callable"; +static const char __pyx_k_data_len[] = "data_len"; +static const char __pyx_k_find_eol[] = "find_eol"; +static const char __pyx_k_write_func[] = "write_func"; +static const char __pyx_k_poller_func[] = "poller_func"; +static const char __pyx_k_ssh2_extras[] = "ssh2.extras"; +static const char __pyx_k_is_coroutine[] = "_is_coroutine"; +static const char __pyx_k_ParamSpecArgs[] = "ParamSpecArgs"; +static const char __pyx_k_bytes_written[] = "bytes_written"; +static const char __pyx_k_total_written[] = "total_written"; +static const char __pyx_k_eagain_errcode[] = "eagain_errcode"; +static const char __pyx_k_ParamSpecKwargs[] = "ParamSpecKwargs"; +static const char __pyx_k_ssh2_extras_pyx[] = "ssh2/extras.pyx"; +static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines"; +static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; +static const char __pyx_k_eagain_write_errcode[] = "eagain_write_errcode"; +static const char __pyx_k_Additional_functionality_not_pa[] = "\nAdditional functionality not part of the libssh2 API.\n"; +/* #### Code section: decls ### */ +static PyObject *__pyx_pf_4ssh2_6extras_eagain_errcode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_func, PyObject *__pyx_v_poller_func, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_4ssh2_6extras_2eagain_write_errcode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_write_func, PyObject *__pyx_v_poller_func, PyObject *__pyx_v_data); /* proto */ +/* #### Code section: late_includes ### */ +/* #### Code section: module_state ### */ +typedef struct { + PyObject *__pyx_d; + PyObject *__pyx_b; + PyObject *__pyx_cython_runtime; + PyObject *__pyx_empty_tuple; + PyObject *__pyx_empty_bytes; + PyObject *__pyx_empty_unicode; + #ifdef __Pyx_CyFunction_USED + PyTypeObject *__pyx_CyFunctionType; + #endif + #ifdef __Pyx_FusedFunction_USED + PyTypeObject *__pyx_FusedFunctionType; + #endif + #ifdef __Pyx_Generator_USED + PyTypeObject *__pyx_GeneratorType; + #endif + #ifdef __Pyx_IterableCoroutine_USED + PyTypeObject *__pyx_IterableCoroutineType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineAwaitType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineType; + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyObject *__pyx_kp_u_; + PyObject *__pyx_n_s_Any; + PyObject *__pyx_n_s_Callable; + PyObject *__pyx_n_s_None; + PyObject *__pyx_n_s_ParamSpecArgs; + PyObject *__pyx_n_s_ParamSpecKwargs; + PyObject *__pyx_n_s__6; + PyObject *__pyx_n_s_args; + PyObject *__pyx_n_s_asyncio_coroutines; + PyObject *__pyx_n_s_bytes_written; + PyObject *__pyx_n_s_cline_in_traceback; + PyObject *__pyx_n_s_data; + PyObject *__pyx_n_s_data_len; + PyObject *__pyx_n_s_eagain_errcode; + PyObject *__pyx_n_s_eagain_write_errcode; + PyObject *__pyx_n_s_find_eol; + PyObject *__pyx_n_s_func; + PyObject *__pyx_n_s_import; + PyObject *__pyx_n_s_is_coroutine; + PyObject *__pyx_n_s_kwargs; + PyObject *__pyx_n_s_main; + PyObject *__pyx_n_s_name; + PyObject *__pyx_n_s_poller_func; + PyObject *__pyx_n_s_rc; + PyObject *__pyx_n_s_ret; + PyObject *__pyx_n_s_return; + PyObject *__pyx_n_s_ssh2_extras; + PyObject *__pyx_kp_s_ssh2_extras_pyx; + PyObject *__pyx_n_s_test; + PyObject *__pyx_n_s_total_written; + PyObject *__pyx_n_s_typing; + PyObject *__pyx_n_s_utils; + PyObject *__pyx_n_s_write_func; + PyObject *__pyx_tuple__2; + PyObject *__pyx_tuple__4; + PyObject *__pyx_codeobj__3; + PyObject *__pyx_codeobj__5; +} __pyx_mstate; + +#if CYTHON_USE_MODULE_STATE +#ifdef __cplusplus +namespace { + extern struct PyModuleDef __pyx_moduledef; +} /* anonymous namespace */ +#else +static struct PyModuleDef __pyx_moduledef; +#endif + +#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) + +#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) + +#define __pyx_m (PyState_FindModule(&__pyx_moduledef)) +#else +static __pyx_mstate __pyx_mstate_global_static = +#ifdef __cplusplus + {}; +#else + {0}; +#endif +static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static; +#endif +/* #### Code section: module_state_clear ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_clear(PyObject *m) { + __pyx_mstate *clear_module_state = __pyx_mstate(m); + if (!clear_module_state) return 0; + Py_CLEAR(clear_module_state->__pyx_d); + Py_CLEAR(clear_module_state->__pyx_b); + Py_CLEAR(clear_module_state->__pyx_cython_runtime); + Py_CLEAR(clear_module_state->__pyx_empty_tuple); + Py_CLEAR(clear_module_state->__pyx_empty_bytes); + Py_CLEAR(clear_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_CLEAR(clear_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); + #endif + Py_CLEAR(clear_module_state->__pyx_kp_u_); + Py_CLEAR(clear_module_state->__pyx_n_s_Any); + Py_CLEAR(clear_module_state->__pyx_n_s_Callable); + Py_CLEAR(clear_module_state->__pyx_n_s_None); + Py_CLEAR(clear_module_state->__pyx_n_s_ParamSpecArgs); + Py_CLEAR(clear_module_state->__pyx_n_s_ParamSpecKwargs); + Py_CLEAR(clear_module_state->__pyx_n_s__6); + Py_CLEAR(clear_module_state->__pyx_n_s_args); + Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); + Py_CLEAR(clear_module_state->__pyx_n_s_bytes_written); + Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); + Py_CLEAR(clear_module_state->__pyx_n_s_data); + Py_CLEAR(clear_module_state->__pyx_n_s_data_len); + Py_CLEAR(clear_module_state->__pyx_n_s_eagain_errcode); + Py_CLEAR(clear_module_state->__pyx_n_s_eagain_write_errcode); + Py_CLEAR(clear_module_state->__pyx_n_s_find_eol); + Py_CLEAR(clear_module_state->__pyx_n_s_func); + Py_CLEAR(clear_module_state->__pyx_n_s_import); + Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); + Py_CLEAR(clear_module_state->__pyx_n_s_kwargs); + Py_CLEAR(clear_module_state->__pyx_n_s_main); + Py_CLEAR(clear_module_state->__pyx_n_s_name); + Py_CLEAR(clear_module_state->__pyx_n_s_poller_func); + Py_CLEAR(clear_module_state->__pyx_n_s_rc); + Py_CLEAR(clear_module_state->__pyx_n_s_ret); + Py_CLEAR(clear_module_state->__pyx_n_s_return); + Py_CLEAR(clear_module_state->__pyx_n_s_ssh2_extras); + Py_CLEAR(clear_module_state->__pyx_kp_s_ssh2_extras_pyx); + Py_CLEAR(clear_module_state->__pyx_n_s_test); + Py_CLEAR(clear_module_state->__pyx_n_s_total_written); + Py_CLEAR(clear_module_state->__pyx_n_s_typing); + Py_CLEAR(clear_module_state->__pyx_n_s_utils); + Py_CLEAR(clear_module_state->__pyx_n_s_write_func); + Py_CLEAR(clear_module_state->__pyx_tuple__2); + Py_CLEAR(clear_module_state->__pyx_tuple__4); + Py_CLEAR(clear_module_state->__pyx_codeobj__3); + Py_CLEAR(clear_module_state->__pyx_codeobj__5); + return 0; +} +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstate *traverse_module_state = __pyx_mstate(m); + if (!traverse_module_state) return 0; + Py_VISIT(traverse_module_state->__pyx_d); + Py_VISIT(traverse_module_state->__pyx_b); + Py_VISIT(traverse_module_state->__pyx_cython_runtime); + Py_VISIT(traverse_module_state->__pyx_empty_tuple); + Py_VISIT(traverse_module_state->__pyx_empty_bytes); + Py_VISIT(traverse_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_VISIT(traverse_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); + #endif + Py_VISIT(traverse_module_state->__pyx_kp_u_); + Py_VISIT(traverse_module_state->__pyx_n_s_Any); + Py_VISIT(traverse_module_state->__pyx_n_s_Callable); + Py_VISIT(traverse_module_state->__pyx_n_s_None); + Py_VISIT(traverse_module_state->__pyx_n_s_ParamSpecArgs); + Py_VISIT(traverse_module_state->__pyx_n_s_ParamSpecKwargs); + Py_VISIT(traverse_module_state->__pyx_n_s__6); + Py_VISIT(traverse_module_state->__pyx_n_s_args); + Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); + Py_VISIT(traverse_module_state->__pyx_n_s_bytes_written); + Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); + Py_VISIT(traverse_module_state->__pyx_n_s_data); + Py_VISIT(traverse_module_state->__pyx_n_s_data_len); + Py_VISIT(traverse_module_state->__pyx_n_s_eagain_errcode); + Py_VISIT(traverse_module_state->__pyx_n_s_eagain_write_errcode); + Py_VISIT(traverse_module_state->__pyx_n_s_find_eol); + Py_VISIT(traverse_module_state->__pyx_n_s_func); + Py_VISIT(traverse_module_state->__pyx_n_s_import); + Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); + Py_VISIT(traverse_module_state->__pyx_n_s_kwargs); + Py_VISIT(traverse_module_state->__pyx_n_s_main); + Py_VISIT(traverse_module_state->__pyx_n_s_name); + Py_VISIT(traverse_module_state->__pyx_n_s_poller_func); + Py_VISIT(traverse_module_state->__pyx_n_s_rc); + Py_VISIT(traverse_module_state->__pyx_n_s_ret); + Py_VISIT(traverse_module_state->__pyx_n_s_return); + Py_VISIT(traverse_module_state->__pyx_n_s_ssh2_extras); + Py_VISIT(traverse_module_state->__pyx_kp_s_ssh2_extras_pyx); + Py_VISIT(traverse_module_state->__pyx_n_s_test); + Py_VISIT(traverse_module_state->__pyx_n_s_total_written); + Py_VISIT(traverse_module_state->__pyx_n_s_typing); + Py_VISIT(traverse_module_state->__pyx_n_s_utils); + Py_VISIT(traverse_module_state->__pyx_n_s_write_func); + Py_VISIT(traverse_module_state->__pyx_tuple__2); + Py_VISIT(traverse_module_state->__pyx_tuple__4); + Py_VISIT(traverse_module_state->__pyx_codeobj__3); + Py_VISIT(traverse_module_state->__pyx_codeobj__5); + return 0; +} +#endif +/* #### Code section: module_state_defines ### */ +#define __pyx_d __pyx_mstate_global->__pyx_d +#define __pyx_b __pyx_mstate_global->__pyx_b +#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime +#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple +#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes +#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode +#ifdef __Pyx_CyFunction_USED +#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType +#endif +#ifdef __Pyx_FusedFunction_USED +#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType +#endif +#ifdef __Pyx_Generator_USED +#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType +#endif +#ifdef __Pyx_IterableCoroutine_USED +#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_kp_u_ __pyx_mstate_global->__pyx_kp_u_ +#define __pyx_n_s_Any __pyx_mstate_global->__pyx_n_s_Any +#define __pyx_n_s_Callable __pyx_mstate_global->__pyx_n_s_Callable +#define __pyx_n_s_None __pyx_mstate_global->__pyx_n_s_None +#define __pyx_n_s_ParamSpecArgs __pyx_mstate_global->__pyx_n_s_ParamSpecArgs +#define __pyx_n_s_ParamSpecKwargs __pyx_mstate_global->__pyx_n_s_ParamSpecKwargs +#define __pyx_n_s__6 __pyx_mstate_global->__pyx_n_s__6 +#define __pyx_n_s_args __pyx_mstate_global->__pyx_n_s_args +#define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines +#define __pyx_n_s_bytes_written __pyx_mstate_global->__pyx_n_s_bytes_written +#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback +#define __pyx_n_s_data __pyx_mstate_global->__pyx_n_s_data +#define __pyx_n_s_data_len __pyx_mstate_global->__pyx_n_s_data_len +#define __pyx_n_s_eagain_errcode __pyx_mstate_global->__pyx_n_s_eagain_errcode +#define __pyx_n_s_eagain_write_errcode __pyx_mstate_global->__pyx_n_s_eagain_write_errcode +#define __pyx_n_s_find_eol __pyx_mstate_global->__pyx_n_s_find_eol +#define __pyx_n_s_func __pyx_mstate_global->__pyx_n_s_func +#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import +#define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine +#define __pyx_n_s_kwargs __pyx_mstate_global->__pyx_n_s_kwargs +#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main +#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name +#define __pyx_n_s_poller_func __pyx_mstate_global->__pyx_n_s_poller_func +#define __pyx_n_s_rc __pyx_mstate_global->__pyx_n_s_rc +#define __pyx_n_s_ret __pyx_mstate_global->__pyx_n_s_ret +#define __pyx_n_s_return __pyx_mstate_global->__pyx_n_s_return +#define __pyx_n_s_ssh2_extras __pyx_mstate_global->__pyx_n_s_ssh2_extras +#define __pyx_kp_s_ssh2_extras_pyx __pyx_mstate_global->__pyx_kp_s_ssh2_extras_pyx +#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test +#define __pyx_n_s_total_written __pyx_mstate_global->__pyx_n_s_total_written +#define __pyx_n_s_typing __pyx_mstate_global->__pyx_n_s_typing +#define __pyx_n_s_utils __pyx_mstate_global->__pyx_n_s_utils +#define __pyx_n_s_write_func __pyx_mstate_global->__pyx_n_s_write_func +#define __pyx_tuple__2 __pyx_mstate_global->__pyx_tuple__2 +#define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4 +#define __pyx_codeobj__3 __pyx_mstate_global->__pyx_codeobj__3 +#define __pyx_codeobj__5 __pyx_mstate_global->__pyx_codeobj__5 +/* #### Code section: module_code ### */ + +/* "ssh2/extras.pyx":26 + * + * + * def eagain_errcode(func: Callable, poller_func: Callable, *args: ParamSpecArgs, **kwargs: ParamSpecKwargs) -> Any: # <<<<<<<<<<<<<< + * """Helper function for reading in non-blocking mode. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_4ssh2_6extras_1eagain_errcode(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_4ssh2_6extras_eagain_errcode, "eagain_errcode(func: Callable, poller_func: Callable, *args: ParamSpecArgs, **kwargs: ParamSpecKwargs) -> Any\nHelper function for reading in non-blocking mode.\n\n Any additional arguments and keyword arguments provided are used as arguments to the session function `func`.\n `func` should return an integer return code.\n\n :param func: The session function to call to read data from.\n :param poller_func: A python function to handle socket polling that takes no arguments.\n\n :returns: Output of func.\n :rtype: int\n "); +static PyMethodDef __pyx_mdef_4ssh2_6extras_1eagain_errcode = {"eagain_errcode", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_6extras_1eagain_errcode, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_6extras_eagain_errcode}; +static PyObject *__pyx_pw_4ssh2_6extras_1eagain_errcode(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_func = 0; + PyObject *__pyx_v_poller_func = 0; + PyObject *__pyx_v_args = 0; + PyObject *__pyx_v_kwargs = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("eagain_errcode (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; + __Pyx_GOTREF(__pyx_v_kwargs); + __pyx_v_args = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 2, __pyx_nargs); + if (unlikely(!__pyx_v_args)) { + __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_v_args); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_func,&__pyx_n_s_poller_func,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + default: + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_func)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 26, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_poller_func)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 26, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("eagain_errcode", 0, 2, 2, 1); __PYX_ERR(0, 26, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + const Py_ssize_t used_pos_args = (kwd_pos_args < 2) ? kwd_pos_args : 2; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values + 0, used_pos_args, "eagain_errcode") < 0)) __PYX_ERR(0, 26, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs < 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + } + __pyx_v_func = values[0]; + __pyx_v_poller_func = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("eagain_errcode", 0, 2, 2, __pyx_nargs); __PYX_ERR(0, 26, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_AddTraceback("ssh2.extras.eagain_errcode", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4ssh2_6extras_eagain_errcode(__pyx_self, __pyx_v_func, __pyx_v_poller_func, __pyx_v_args, __pyx_v_kwargs); + + /* function exit code */ + __Pyx_DECREF(__pyx_v_args); + __Pyx_DECREF(__pyx_v_kwargs); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_4ssh2_6extras_eagain_errcode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_func, PyObject *__pyx_v_poller_func, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_v_ret = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + unsigned int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("eagain_errcode", 1); + + /* "ssh2/extras.pyx":38 + * :rtype: int + * """ + * ret = func(*args, **kwargs) # <<<<<<<<<<<<<< + * while ret == error_codes._LIBSSH2_ERROR_EAGAIN: + * poller_func() + */ + __pyx_t_1 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_func, __pyx_v_args, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_ret = __pyx_t_2; + __pyx_t_2 = 0; + + /* "ssh2/extras.pyx":39 + * """ + * ret = func(*args, **kwargs) + * while ret == error_codes._LIBSSH2_ERROR_EAGAIN: # <<<<<<<<<<<<<< + * poller_func() + * ret = func(*args, **kwargs) + */ + while (1) { + __pyx_t_2 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_ERROR_EAGAIN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_ret, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!__pyx_t_3) break; + + /* "ssh2/extras.pyx":40 + * ret = func(*args, **kwargs) + * while ret == error_codes._LIBSSH2_ERROR_EAGAIN: + * poller_func() # <<<<<<<<<<<<<< + * ret = func(*args, **kwargs) + * return ret + */ + __Pyx_INCREF(__pyx_v_poller_func); + __pyx_t_2 = __pyx_v_poller_func; __pyx_t_4 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_5 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "ssh2/extras.pyx":41 + * while ret == error_codes._LIBSSH2_ERROR_EAGAIN: + * poller_func() + * ret = func(*args, **kwargs) # <<<<<<<<<<<<<< + * return ret + * + */ + __pyx_t_1 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_func, __pyx_v_args, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_ret, __pyx_t_2); + __pyx_t_2 = 0; + } + + /* "ssh2/extras.pyx":42 + * poller_func() + * ret = func(*args, **kwargs) + * return ret # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_ret); + __pyx_r = __pyx_v_ret; + goto __pyx_L0; + + /* "ssh2/extras.pyx":26 + * + * + * def eagain_errcode(func: Callable, poller_func: Callable, *args: ParamSpecArgs, **kwargs: ParamSpecKwargs) -> Any: # <<<<<<<<<<<<<< + * """Helper function for reading in non-blocking mode. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("ssh2.extras.eagain_errcode", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ret); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ssh2/extras.pyx":45 + * + * + * def eagain_write_errcode(write_func: Callable, poller_func: Callable, bytes data) -> None: # <<<<<<<<<<<<<< + * """Helper function for writing in non-blocking mode. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_4ssh2_6extras_3eagain_write_errcode(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_4ssh2_6extras_2eagain_write_errcode, "eagain_write_errcode(write_func: Callable, poller_func: Callable, data: bytes) -> None\nHelper function for writing in non-blocking mode.\n\n Any additional arguments and keyword arguments provided are used as arguments to the session function `write_func`.\n `write_func` should return an integer tuple `(rc, bytes_written)` for return code and bytes written respectively.\n\n :param write_func: The session function to call to read data from.\n :param poller_func: A python function to handle socket polling that takes no arguments.\n :param data: The data to write.\n :type data: bytes\n "); +static PyMethodDef __pyx_mdef_4ssh2_6extras_3eagain_write_errcode = {"eagain_write_errcode", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_6extras_3eagain_write_errcode, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_6extras_2eagain_write_errcode}; +static PyObject *__pyx_pw_4ssh2_6extras_3eagain_write_errcode(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_write_func = 0; + PyObject *__pyx_v_poller_func = 0; + PyObject *__pyx_v_data = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("eagain_write_errcode (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_write_func,&__pyx_n_s_poller_func,&__pyx_n_s_data,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_write_func)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 45, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_poller_func)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 45, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("eagain_write_errcode", 1, 3, 3, 1); __PYX_ERR(0, 45, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 45, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("eagain_write_errcode", 1, 3, 3, 2); __PYX_ERR(0, 45, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "eagain_write_errcode") < 0)) __PYX_ERR(0, 45, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v_write_func = values[0]; + __pyx_v_poller_func = values[1]; + __pyx_v_data = ((PyObject*)values[2]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("eagain_write_errcode", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 45, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("ssh2.extras.eagain_write_errcode", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyBytes_Type), 1, "data", 1))) __PYX_ERR(0, 45, __pyx_L1_error) + __pyx_r = __pyx_pf_4ssh2_6extras_2eagain_write_errcode(__pyx_self, __pyx_v_write_func, __pyx_v_poller_func, __pyx_v_data); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_4ssh2_6extras_2eagain_write_errcode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_write_func, PyObject *__pyx_v_poller_func, PyObject *__pyx_v_data) { + size_t __pyx_v_data_len; + size_t __pyx_v_total_written; + PyObject *__pyx_v_rc = 0; + size_t __pyx_v_bytes_written; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + unsigned int __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); + size_t __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("eagain_write_errcode", 1); + + /* "ssh2/extras.pyx":56 + * :type data: bytes + * """ + * cdef size_t data_len = len(data) # <<<<<<<<<<<<<< + * cdef size_t total_written = 0 + * cdef rc + */ + if (unlikely(__pyx_v_data == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 56, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyBytes_GET_SIZE(__pyx_v_data); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_v_data_len = __pyx_t_1; + + /* "ssh2/extras.pyx":57 + * """ + * cdef size_t data_len = len(data) + * cdef size_t total_written = 0 # <<<<<<<<<<<<<< + * cdef rc + * cdef size_t bytes_written + */ + __pyx_v_total_written = 0; + + /* "ssh2/extras.pyx":60 + * cdef rc + * cdef size_t bytes_written + * while total_written < data_len: # <<<<<<<<<<<<<< + * rc, bytes_written = write_func(data[total_written:]) + * total_written += bytes_written + */ + while (1) { + __pyx_t_2 = (__pyx_v_total_written < __pyx_v_data_len); + if (!__pyx_t_2) break; + + /* "ssh2/extras.pyx":61 + * cdef size_t bytes_written + * while total_written < data_len: + * rc, bytes_written = write_func(data[total_written:]) # <<<<<<<<<<<<<< + * total_written += bytes_written + * if rc == error_codes._LIBSSH2_ERROR_EAGAIN: + */ + if (unlikely(__pyx_v_data == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 61, __pyx_L1_error) + } + __pyx_t_4 = PySequence_GetSlice(__pyx_v_data, __pyx_v_total_written, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_write_func); + __pyx_t_5 = __pyx_v_write_func; __pyx_t_6 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_4}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { + PyObject* sequence = __pyx_t_3; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 61, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_5 = PyList_GET_ITEM(sequence, 0); + __pyx_t_4 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); + index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + index = 1; __pyx_t_4 = __pyx_t_8(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_6), 2) < 0) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_t_8 = NULL; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_8 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_L6_unpacking_done:; + } + __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF_SET(__pyx_v_rc, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_v_bytes_written = __pyx_t_9; + + /* "ssh2/extras.pyx":62 + * while total_written < data_len: + * rc, bytes_written = write_func(data[total_written:]) + * total_written += bytes_written # <<<<<<<<<<<<<< + * if rc == error_codes._LIBSSH2_ERROR_EAGAIN: + * poller_func() + */ + __pyx_v_total_written = (__pyx_v_total_written + __pyx_v_bytes_written); + + /* "ssh2/extras.pyx":63 + * rc, bytes_written = write_func(data[total_written:]) + * total_written += bytes_written + * if rc == error_codes._LIBSSH2_ERROR_EAGAIN: # <<<<<<<<<<<<<< + * poller_func() + */ + __pyx_t_3 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_ERROR_EAGAIN); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_rc, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 63, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 63, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + + /* "ssh2/extras.pyx":64 + * total_written += bytes_written + * if rc == error_codes._LIBSSH2_ERROR_EAGAIN: + * poller_func() # <<<<<<<<<<<<<< + */ + __Pyx_INCREF(__pyx_v_poller_func); + __pyx_t_3 = __pyx_v_poller_func; __pyx_t_5 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "ssh2/extras.pyx":63 + * rc, bytes_written = write_func(data[total_written:]) + * total_written += bytes_written + * if rc == error_codes._LIBSSH2_ERROR_EAGAIN: # <<<<<<<<<<<<<< + * poller_func() + */ + } + } + + /* "ssh2/extras.pyx":45 + * + * + * def eagain_write_errcode(write_func: Callable, poller_func: Callable, bytes data) -> None: # <<<<<<<<<<<<<< + * """Helper function for writing in non-blocking mode. + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("ssh2.extras.eagain_write_errcode", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_rc); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) + #define CYTHON_SMALL_CODE __attribute__((cold)) +#else + #define CYTHON_SMALL_CODE +#endif +#endif +/* #### Code section: pystring_table ### */ + +static int __Pyx_CreateStringTabAndInitStrings(void) { + __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0}, + {&__pyx_n_s_Any, __pyx_k_Any, sizeof(__pyx_k_Any), 0, 0, 1, 1}, + {&__pyx_n_s_Callable, __pyx_k_Callable, sizeof(__pyx_k_Callable), 0, 0, 1, 1}, + {&__pyx_n_s_None, __pyx_k_None, sizeof(__pyx_k_None), 0, 0, 1, 1}, + {&__pyx_n_s_ParamSpecArgs, __pyx_k_ParamSpecArgs, sizeof(__pyx_k_ParamSpecArgs), 0, 0, 1, 1}, + {&__pyx_n_s_ParamSpecKwargs, __pyx_k_ParamSpecKwargs, sizeof(__pyx_k_ParamSpecKwargs), 0, 0, 1, 1}, + {&__pyx_n_s__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 0, 1, 1}, + {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1}, + {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, + {&__pyx_n_s_bytes_written, __pyx_k_bytes_written, sizeof(__pyx_k_bytes_written), 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_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1}, + {&__pyx_n_s_data_len, __pyx_k_data_len, sizeof(__pyx_k_data_len), 0, 0, 1, 1}, + {&__pyx_n_s_eagain_errcode, __pyx_k_eagain_errcode, sizeof(__pyx_k_eagain_errcode), 0, 0, 1, 1}, + {&__pyx_n_s_eagain_write_errcode, __pyx_k_eagain_write_errcode, sizeof(__pyx_k_eagain_write_errcode), 0, 0, 1, 1}, + {&__pyx_n_s_find_eol, __pyx_k_find_eol, sizeof(__pyx_k_find_eol), 0, 0, 1, 1}, + {&__pyx_n_s_func, __pyx_k_func, sizeof(__pyx_k_func), 0, 0, 1, 1}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, + {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_n_s_poller_func, __pyx_k_poller_func, sizeof(__pyx_k_poller_func), 0, 0, 1, 1}, + {&__pyx_n_s_rc, __pyx_k_rc, sizeof(__pyx_k_rc), 0, 0, 1, 1}, + {&__pyx_n_s_ret, __pyx_k_ret, sizeof(__pyx_k_ret), 0, 0, 1, 1}, + {&__pyx_n_s_return, __pyx_k_return, sizeof(__pyx_k_return), 0, 0, 1, 1}, + {&__pyx_n_s_ssh2_extras, __pyx_k_ssh2_extras, sizeof(__pyx_k_ssh2_extras), 0, 0, 1, 1}, + {&__pyx_kp_s_ssh2_extras_pyx, __pyx_k_ssh2_extras_pyx, sizeof(__pyx_k_ssh2_extras_pyx), 0, 0, 1, 0}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_total_written, __pyx_k_total_written, sizeof(__pyx_k_total_written), 0, 0, 1, 1}, + {&__pyx_n_s_typing, __pyx_k_typing, sizeof(__pyx_k_typing), 0, 0, 1, 1}, + {&__pyx_n_s_utils, __pyx_k_utils, sizeof(__pyx_k_utils), 0, 0, 1, 1}, + {&__pyx_n_s_write_func, __pyx_k_write_func, sizeof(__pyx_k_write_func), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} + }; + return __Pyx_InitStrings(__pyx_string_tab); +} +/* #### Code section: cached_builtins ### */ +static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { + return 0; +} +/* #### Code section: cached_constants ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "ssh2/extras.pyx":26 + * + * + * def eagain_errcode(func: Callable, poller_func: Callable, *args: ParamSpecArgs, **kwargs: ParamSpecKwargs) -> Any: # <<<<<<<<<<<<<< + * """Helper function for reading in non-blocking mode. + * + */ + __pyx_tuple__2 = PyTuple_Pack(5, __pyx_n_s_func, __pyx_n_s_poller_func, __pyx_n_s_args, __pyx_n_s_kwargs, __pyx_n_s_ret); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__2); + __Pyx_GIVEREF(__pyx_tuple__2); + __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__2, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_extras_pyx, __pyx_n_s_eagain_errcode, 26, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 26, __pyx_L1_error) + + /* "ssh2/extras.pyx":45 + * + * + * def eagain_write_errcode(write_func: Callable, poller_func: Callable, bytes data) -> None: # <<<<<<<<<<<<<< + * """Helper function for writing in non-blocking mode. + * + */ + __pyx_tuple__4 = PyTuple_Pack(7, __pyx_n_s_write_func, __pyx_n_s_poller_func, __pyx_n_s_data, __pyx_n_s_data_len, __pyx_n_s_total_written, __pyx_n_s_rc, __pyx_n_s_bytes_written); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_GIVEREF(__pyx_tuple__4); + __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_extras_pyx, __pyx_n_s_eagain_write_errcode, 45, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} +/* #### Code section: init_constants ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { + if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error); + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_globals ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { + return 0; +} +/* #### Code section: init_module ### */ + +static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ + +static int __Pyx_modinit_global_init_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); + /*--- Global init code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); + /*--- Variable export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); + /*--- Function export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_type_init_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_type_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); + /*--- Function import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + + +#if PY_MAJOR_VERSION >= 3 +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_extras(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_extras}, + {0, NULL} +}; +#endif + +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "extras", + __pyx_k_Additional_functionality_not_pa, /* m_doc */ + #if CYTHON_PEP489_MULTI_PHASE_INIT + 0, /* m_size */ + #elif CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstate), /* m_size */ + #else + -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #if CYTHON_USE_MODULE_STATE + __pyx_m_traverse, /* m_traverse */ + __pyx_m_clear, /* m_clear */ + NULL /* m_free */ + #else + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + #endif + }; + #ifdef __cplusplus +} /* anonymous namespace */ +#endif +#endif + +#ifndef CYTHON_NO_PYINIT_EXPORT +#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#elif PY_MAJOR_VERSION < 3 +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" void +#else +#define __Pyx_PyMODINIT_FUNC void +#endif +#else +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * +#else +#define __Pyx_PyMODINIT_FUNC PyObject * +#endif +#endif + + +#if PY_MAJOR_VERSION < 3 +__Pyx_PyMODINIT_FUNC initextras(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC initextras(void) +#else +__Pyx_PyMODINIT_FUNC PyInit_extras(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_extras(void) +#if CYTHON_PEP489_MULTI_PHASE_INIT +{ + return PyModuleDef_Init(&__pyx_moduledef); +} +static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { + #if PY_VERSION_HEX >= 0x030700A1 + static PY_INT64_T main_interpreter_id = -1; + PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); + if (main_interpreter_id == -1) { + main_interpreter_id = current_id; + return (unlikely(current_id == -1)) ? -1 : 0; + } else if (unlikely(main_interpreter_id != current_id)) + #else + static PyInterpreterState *main_interpreter = NULL; + PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; + if (!main_interpreter) { + main_interpreter = current_interpreter; + } else if (unlikely(main_interpreter != current_interpreter)) + #endif + { + PyErr_SetString( + PyExc_ImportError, + "Interpreter change detected - this module can only be loaded into one interpreter per process."); + return -1; + } + return 0; +} +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) +#else +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) +#endif +{ + PyObject *value = PyObject_GetAttrString(spec, from_name); + int result = 0; + if (likely(value)) { + if (allow_none || value != Py_None) { +#if CYTHON_COMPILING_IN_LIMITED_API + result = PyModule_AddObject(module, to_name, value); +#else + result = PyDict_SetItemString(moddict, to_name, value); +#endif + } + Py_DECREF(value); + } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + } else { + result = -1; + } + return result; +} +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { + PyObject *module = NULL, *moddict, *modname; + CYTHON_UNUSED_VAR(def); + if (__Pyx_check_single_interpreter()) + return NULL; + if (__pyx_m) + return __Pyx_NewRef(__pyx_m); + modname = PyObject_GetAttrString(spec, "name"); + if (unlikely(!modname)) goto bad; + module = PyModule_NewObject(modname); + Py_DECREF(modname); + if (unlikely(!module)) goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + moddict = module; +#else + moddict = PyModule_GetDict(module); + if (unlikely(!moddict)) goto bad; +#endif + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; + return module; +bad: + Py_XDECREF(module); + return NULL; +} + + +static CYTHON_SMALL_CODE int __pyx_pymod_exec_extras(PyObject *__pyx_pyinit_module) +#endif +#endif +{ + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_PEP489_MULTI_PHASE_INIT + if (__pyx_m) { + if (__pyx_m == __pyx_pyinit_module) return 0; + PyErr_SetString(PyExc_RuntimeError, "Module 'extras' has already been imported. Re-initialisation is not supported."); + return -1; + } + #elif PY_MAJOR_VERSION >= 3 + if (__pyx_m) return __Pyx_NewRef(__pyx_m); + #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_m = __pyx_pyinit_module; + Py_INCREF(__pyx_m); + #else + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4("extras", __pyx_methods, __pyx_k_Additional_functionality_not_pa, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #elif CYTHON_USE_MODULE_STATE + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + { + int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "extras" pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #endif + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_d); + __pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_cython_runtime = __Pyx_PyImport_AddModuleRef((const char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if CYTHON_REFNANNY +__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); +if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); +} +#endif + __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_extras(void)", 0); + if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < 0) __PYX_ERR(0, 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) + #ifdef __Pyx_CyFunction_USED + if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Coroutine_USED + if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_StopAsyncIteration_USED + if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + PyEval_InitThreads(); + #endif + /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + stringtab_initialized = 1; + if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 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) + #endif + if (__pyx_module_is_main_ssh2__extras) { + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + } + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "ssh2.extras")) { + if (unlikely((PyDict_SetItemString(modules, "ssh2.extras", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #endif + /*--- Builtin init code ---*/ + if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Constants init code ---*/ + if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 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(); + (void)__Pyx_modinit_type_init_code(); + (void)__Pyx_modinit_type_import_code(); + (void)__Pyx_modinit_variable_import_code(); + (void)__Pyx_modinit_function_import_code(); + /*--- Execution code ---*/ + #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + + /* "ssh2/extras.pyx":20 + * Additional functionality not part of the libssh2 API. + * """ + * from typing import Callable, Any, ParamSpecArgs, ParamSpecKwargs # <<<<<<<<<<<<<< + * + * from . cimport error_codes + */ + __pyx_t_2 = PyList_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_n_s_Callable); + __Pyx_GIVEREF(__pyx_n_s_Callable); + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Callable)) __PYX_ERR(0, 20, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_Any); + __Pyx_GIVEREF(__pyx_n_s_Any); + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_Any)) __PYX_ERR(0, 20, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_ParamSpecArgs); + __Pyx_GIVEREF(__pyx_n_s_ParamSpecArgs); + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_ParamSpecArgs)) __PYX_ERR(0, 20, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_ParamSpecKwargs); + __Pyx_GIVEREF(__pyx_n_s_ParamSpecKwargs); + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_ParamSpecKwargs)) __PYX_ERR(0, 20, __pyx_L1_error); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_typing, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Callable); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Callable, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Any); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Any, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_ParamSpecArgs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ParamSpecArgs, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_ParamSpecKwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ParamSpecKwargs, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "ssh2/extras.pyx":23 + * + * from . cimport error_codes + * from .utils import find_eol # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_n_s_find_eol); + __Pyx_GIVEREF(__pyx_n_s_find_eol); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_find_eol)) __PYX_ERR(0, 23, __pyx_L1_error); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_utils, __pyx_t_3, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_find_eol); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_find_eol, __pyx_t_3) < 0) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "ssh2/extras.pyx":26 + * + * + * def eagain_errcode(func: Callable, poller_func: Callable, *args: ParamSpecArgs, **kwargs: ParamSpecKwargs) -> Any: # <<<<<<<<<<<<<< + * """Helper function for reading in non-blocking mode. + * + */ + __pyx_t_2 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_func, __pyx_n_s_Callable) < 0) __PYX_ERR(0, 26, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_poller_func, __pyx_n_s_Callable) < 0) __PYX_ERR(0, 26, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_args, __pyx_n_s_ParamSpecArgs) < 0) __PYX_ERR(0, 26, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_kwargs, __pyx_n_s_ParamSpecKwargs) < 0) __PYX_ERR(0, 26, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_s_Any) < 0) __PYX_ERR(0, 26, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_6extras_1eagain_errcode, 0, __pyx_n_s_eagain_errcode, NULL, __pyx_n_s_ssh2_extras, __pyx_d, ((PyObject *)__pyx_codeobj__3)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_eagain_errcode, __pyx_t_3) < 0) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "ssh2/extras.pyx":45 + * + * + * def eagain_write_errcode(write_func: Callable, poller_func: Callable, bytes data) -> None: # <<<<<<<<<<<<<< + * """Helper function for writing in non-blocking mode. + * + */ + __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_write_func, __pyx_n_s_Callable) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_poller_func, __pyx_n_s_Callable) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_s_None) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_6extras_3eagain_write_errcode, 0, __pyx_n_s_eagain_write_errcode, NULL, __pyx_n_s_ssh2_extras, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_eagain_write_errcode, __pyx_t_2) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "ssh2/extras.pyx":1 + * # This file is part of ssh2-python. # <<<<<<<<<<<<<< + * # Copyright (C) 2017-2025 Panos Kittenis + * # + */ + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 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) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + if (__pyx_m) { + if (__pyx_d && stringtab_initialized) { + __Pyx_AddTraceback("init ssh2.extras", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + #if !CYTHON_USE_MODULE_STATE + Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init ssh2.extras"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if CYTHON_PEP489_MULTI_PHASE_INIT + return (__pyx_m != NULL) ? 0 : -1; + #elif PY_MAJOR_VERSION >= 3 + return __pyx_m; + #else + return; + #endif +} +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ + +/* --- Runtime support code --- */ +/* Refnanny */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule(modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, "RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif + +/* TupleAndListFromArray */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { + PyObject *v; + Py_ssize_t i; + for (i = 0; i < length; i++) { + v = dest[i] = src[i]; + Py_INCREF(v); + } +} +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + Py_INCREF(__pyx_empty_tuple); + return __pyx_empty_tuple; + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); + return res; +} +static CYTHON_INLINE PyObject * +__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return PyList_New(0); + } + res = PyList_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); + return res; +} +#endif + +/* BytesEquals */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result; +#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +#endif +} + +/* UnicodeEquals */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else +#if PY_MAJOR_VERSION < 3 + PyObject* owned_ref = NULL; +#endif + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; + } + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); +#if PY_MAJOR_VERSION < 3 + if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { + owned_ref = PyUnicode_FromObject(s2); + if (unlikely(!owned_ref)) + return -1; + s2 = owned_ref; + s2_is_unicode = 1; + } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { + owned_ref = PyUnicode_FromObject(s1); + if (unlikely(!owned_ref)) + return -1; + s1 = owned_ref; + s1_is_unicode = 1; + } else if (((!s2_is_unicode) & (!s1_is_unicode))) { + return __Pyx_PyBytes_Equals(s1, s2, equals); + } +#endif + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length; + int kind; + void *data1, *data2; + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + length = __Pyx_PyUnicode_GET_LENGTH(s1); + if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { + goto return_ne; + } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + #if CYTHON_PEP393_ENABLED + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + #else + hash1 = ((PyUnicodeObject*)s1)->hash; + hash2 = ((PyUnicodeObject*)s2)->hash; + #endif + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ); +return_ne: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_NE); +#endif +} + +/* fastcall */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) +{ + Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames); + for (i = 0; i < n; i++) + { + if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i]; + } + for (i = 0; i < n; i++) + { + int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ); + if (unlikely(eq != 0)) { + if (unlikely(eq < 0)) return NULL; + return kwvalues[i]; + } + } + return NULL; +} +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 +CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) { + Py_ssize_t i, nkwargs = PyTuple_GET_SIZE(kwnames); + PyObject *dict; + dict = PyDict_New(); + if (unlikely(!dict)) + return NULL; + for (i=0; i= 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 *const *kwvalues, + 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; + int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)); + while (1) { + Py_XDECREF(key); key = NULL; + Py_XDECREF(value); value = NULL; + if (kwds_is_tuple) { + Py_ssize_t size; +#if CYTHON_ASSUME_SAFE_MACROS + size = PyTuple_GET_SIZE(kwds); +#else + size = PyTuple_Size(kwds); + if (size < 0) goto bad; +#endif + if (pos >= size) break; +#if CYTHON_AVOID_BORROWED_REFS + key = __Pyx_PySequence_ITEM(kwds, pos); + if (!key) goto bad; +#elif CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kwds, pos); +#else + key = PyTuple_GetItem(kwds, pos); + if (!key) goto bad; +#endif + value = kwvalues[pos]; + pos++; + } + else + { + if (!PyDict_Next(kwds, &pos, &key, &value)) break; +#if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(key); +#endif + } + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(value); + Py_DECREF(key); +#endif + key = NULL; + value = NULL; + continue; + } +#if !CYTHON_AVOID_BORROWED_REFS + Py_INCREF(key); +#endif + Py_INCREF(value); + 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; +#if CYTHON_AVOID_BORROWED_REFS + value = NULL; +#endif + 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 = ( + #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; +#if CYTHON_AVOID_BORROWED_REFS + value = NULL; +#endif + 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; + } + } + Py_XDECREF(key); + Py_XDECREF(value); + 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: + #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + Py_XDECREF(key); + Py_XDECREF(value); + return -1; +} + +/* PyObjectCall */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = Py_TYPE(func)->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + #if PY_MAJOR_VERSION < 3 + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + #else + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + #endif + 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 + +/* PyFunctionFastCall */ +#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL +static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, + PyObject *globals) { + PyFrameObject *f; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject **fastlocals; + Py_ssize_t i; + PyObject *result; + assert(globals != NULL); + /* XXX Perhaps we should create a specialized + PyFrame_New() that doesn't take locals, but does + take builtins without sanity checking them. + */ + assert(tstate != NULL); + f = PyFrame_New(tstate, co, globals, NULL); + if (f == NULL) { + return NULL; + } + fastlocals = __Pyx_PyFrame_GetLocalsplus(f); + for (i = 0; i < na; i++) { + Py_INCREF(*args); + fastlocals[i] = *args++; + } + result = PyEval_EvalFrameEx(f,0); + ++tstate->recursion_depth; + Py_DECREF(f); + --tstate->recursion_depth; + return result; +} +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { + PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); + PyObject *globals = PyFunction_GET_GLOBALS(func); + PyObject *argdefs = PyFunction_GET_DEFAULTS(func); + PyObject *closure; +#if PY_MAJOR_VERSION >= 3 + PyObject *kwdefs; +#endif + PyObject *kwtuple, **k; + PyObject **d; + Py_ssize_t nd; + Py_ssize_t nk; + PyObject *result; + assert(kwargs == NULL || PyDict_Check(kwargs)); + nk = kwargs ? PyDict_Size(kwargs) : 0; + #if PY_MAJOR_VERSION < 3 + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) { + return NULL; + } + #else + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) { + return NULL; + } + #endif + if ( +#if PY_MAJOR_VERSION >= 3 + co->co_kwonlyargcount == 0 && +#endif + likely(kwargs == NULL || nk == 0) && + co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { + if (argdefs == NULL && co->co_argcount == nargs) { + result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); + goto done; + } + else if (nargs == 0 && argdefs != NULL + && co->co_argcount == Py_SIZE(argdefs)) { + /* function called with no arguments, but all parameters have + a default value: use default values as arguments .*/ + args = &PyTuple_GET_ITEM(argdefs, 0); + result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); + goto done; + } + } + if (kwargs != NULL) { + Py_ssize_t pos, i; + kwtuple = PyTuple_New(2 * nk); + if (kwtuple == NULL) { + result = NULL; + goto done; + } + k = &PyTuple_GET_ITEM(kwtuple, 0); + pos = i = 0; + while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { + Py_INCREF(k[i]); + Py_INCREF(k[i+1]); + i += 2; + } + nk = i / 2; + } + else { + kwtuple = NULL; + k = NULL; + } + closure = PyFunction_GET_CLOSURE(func); +#if PY_MAJOR_VERSION >= 3 + kwdefs = PyFunction_GET_KW_DEFAULTS(func); +#endif + if (argdefs != NULL) { + d = &PyTuple_GET_ITEM(argdefs, 0); + nd = Py_SIZE(argdefs); + } + else { + d = NULL; + nd = 0; + } +#if PY_MAJOR_VERSION >= 3 + result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, kwdefs, closure); +#else + result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, closure); +#endif + Py_XDECREF(kwtuple); +done: + Py_LeaveRecursiveCall(); + return result; +} +#endif + +/* PyObjectCallMethO */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func); + self = __Pyx_CyOrPyCFunction_GET_SELF(func); + #if PY_MAJOR_VERSION < 3 + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + #else + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + #endif + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectFastCall */ +#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result = 0; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad; + } + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + bad: + Py_DECREF(argstuple); + return result; +} +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); +#if CYTHON_COMPILING_IN_CPYTHON + if (nargs == 0 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS)) + return __Pyx_PyObject_CallMethO(func, NULL); + } + else if (nargs == 1 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O)) + return __Pyx_PyObject_CallMethO(func, args[0]); + } +#endif + #if PY_VERSION_HEX < 0x030800B1 + #if CYTHON_FAST_PYCCALL + if (PyCFunction_Check(func)) { + if (kwargs) { + return _PyCFunction_FastCallDict(func, args, nargs, kwargs); + } else { + return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); + } + } + #if PY_VERSION_HEX >= 0x030700A1 + if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { + return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); + } + #endif + #endif + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); + } + #endif + #endif + if (kwargs == NULL) { + #if CYTHON_VECTORCALL + #if PY_VERSION_HEX < 0x03090000 + vectorcallfunc f = _PyVectorcall_Function(func); + #else + vectorcallfunc f = PyVectorcall_Function(func); + #endif + if (f) { + return f(func, args, (size_t)nargs, NULL); + } + #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL + if (__Pyx_CyFunction_CheckExact(func)) { + __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); + if (f) return f(func, args, (size_t)nargs, NULL); + } + #endif + } + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs); + } + #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API + return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs); + #else + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); + #endif +} + +/* ArgTypeTest */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) +{ + __Pyx_TypeName type_name; + __Pyx_TypeName obj_type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + else if (exact) { + #if PY_MAJOR_VERSION == 2 + if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + #endif + } + else { + if (likely(__Pyx_TypeCheck(obj, type))) return 1; + } + type_name = __Pyx_PyType_GetName(type); + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME + ", got " __Pyx_FMT_TYPENAME ")", name, type_name, obj_type_name); + __Pyx_DECREF_TypeName(type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* RaiseTooManyValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* RaiseNeedMoreValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* PyErrFetchRestore */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); +#else + 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); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *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 +} +#endif + +/* IterFinish */ +static CYTHON_INLINE int __Pyx_IterFinish(void) { + PyObject* exc_type; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + exc_type = __Pyx_PyErr_CurrentExceptionType(); + if (unlikely(exc_type)) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) + return -1; + __Pyx_PyErr_Clear(); + return 0; + } + return 0; +} + +/* UnpackItemEndCheck */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } + return __Pyx_IterFinish(); +} + +/* PyObjectGetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* Import */ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *module = 0; + PyObject *empty_dict = 0; + PyObject *empty_list = 0; + #if PY_MAJOR_VERSION < 3 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); + if (unlikely(!py_import)) + goto bad; + if (!from_list) { + empty_list = PyList_New(0); + if (unlikely(!empty_list)) + goto bad; + from_list = empty_list; + } + #endif + empty_dict = PyDict_New(); + if (unlikely(!empty_dict)) + goto bad; + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.') != NULL) { + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, 1); + if (unlikely(!module)) { + if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) + goto bad; + PyErr_Clear(); + } + } + level = 0; + } + #endif + if (!module) { + #if PY_MAJOR_VERSION < 3 + PyObject *py_level = PyInt_FromLong(level); + if (unlikely(!py_level)) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, level); + #endif + } + } +bad: + Py_XDECREF(empty_dict); + Py_XDECREF(empty_list); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_import); + #endif + return module; +} + +/* ImportFrom */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + const char* module_name_str = 0; + PyObject* module_name = 0; + PyObject* module_dot = 0; + PyObject* full_name = 0; + PyErr_Clear(); + module_name_str = PyModule_GetName(module); + if (unlikely(!module_name_str)) { goto modbad; } + module_name = PyUnicode_FromString(module_name_str); + if (unlikely(!module_name)) { goto modbad; } + module_dot = PyUnicode_Concat(module_name, __pyx_kp_u_); + if (unlikely(!module_dot)) { goto modbad; } + full_name = PyUnicode_Concat(module_dot, name); + if (unlikely(!full_name)) { goto modbad; } + #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + { + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + goto modbad; + value = PyObject_GetItem(modules, full_name); + } + #else + value = PyImport_GetModule(full_name); + #endif + modbad: + Py_XDECREF(full_name); + Py_XDECREF(module_dot); + Py_XDECREF(module_name); + } + if (unlikely(!value)) { + PyErr_Format(PyExc_ImportError, + #if PY_MAJOR_VERSION < 3 + "cannot import name %.230s", PyString_AS_STRING(name)); + #else + "cannot import name %S", name); + #endif + } + return value; +} + +/* FixUpExtensionType */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { +#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED_VAR(spec); + CYTHON_UNUSED_VAR(type); +#else + const PyType_Slot *slot = spec->slots; + while (slot && slot->slot && slot->slot != Py_tp_members) + slot++; + if (slot && slot->slot == Py_tp_members) { + int changed = 0; +#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) + const +#endif + PyMemberDef *memb = (PyMemberDef*) slot->pfunc; + while (memb && memb->name) { + if (memb->name[0] == '_' && memb->name[1] == '_') { +#if PY_VERSION_HEX < 0x030900b1 + if (strcmp(memb->name, "__weaklistoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_weaklistoffset = memb->offset; + changed = 1; + } + else if (strcmp(memb->name, "__dictoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_dictoffset = memb->offset; + changed = 1; + } +#if CYTHON_METH_FASTCALL + else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); +#if PY_VERSION_HEX >= 0x030800b4 + type->tp_vectorcall_offset = memb->offset; +#else + type->tp_print = (printfunc) memb->offset; +#endif + changed = 1; + } +#endif +#else + if ((0)); +#endif +#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON + else if (strcmp(memb->name, "__module__") == 0) { + PyObject *descr; + assert(memb->type == T_OBJECT); + assert(memb->flags == 0 || memb->flags == READONLY); + descr = PyDescr_NewMember(type, memb); + if (unlikely(!descr)) + return -1; + if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { + Py_DECREF(descr); + return -1; + } + Py_DECREF(descr); + changed = 1; + } +#endif + } + memb++; + } + if (changed) + PyType_Modified(type); + } +#endif + return 0; +} +#endif + +/* FetchSharedCythonModule */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void) { + return __Pyx_PyImport_AddModuleRef((char*) __PYX_ABI_MODULE_NAME); +} + +/* FetchCommonType */ +static int __Pyx_VerifyCachedType(PyObject *cached_type, + const char *name, + Py_ssize_t basicsize, + Py_ssize_t expected_basicsize) { + if (!PyType_Check(cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", name); + return -1; + } + if (basicsize != expected_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + name); + return -1; + } + return 0; +} +#if !CYTHON_USE_TYPE_SPECS +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { + PyObject* abi_module; + const char* object_name; + PyTypeObject *cached_type = NULL; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + object_name = strrchr(type->tp_name, '.'); + object_name = object_name ? object_name+1 : type->tp_name; + cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name); + if (cached_type) { + if (__Pyx_VerifyCachedType( + (PyObject *)cached_type, + object_name, + cached_type->tp_basicsize, + type->tp_basicsize) < 0) { + goto bad; + } + goto done; + } + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + if (PyType_Ready(type) < 0) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0) + goto bad; + Py_INCREF(type); + cached_type = type; +done: + Py_DECREF(abi_module); + return cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} +#else +static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *abi_module, *cached_type = NULL; + const char* object_name = strrchr(spec->name, '.'); + object_name = object_name ? object_name+1 : spec->name; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + cached_type = PyObject_GetAttrString(abi_module, object_name); + if (cached_type) { + Py_ssize_t basicsize; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); + if (unlikely(!py_basicsize)) goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; +#else + basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1; +#endif + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + basicsize, + spec->basicsize) < 0) { + goto bad; + } + goto done; + } + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + CYTHON_UNUSED_VAR(module); + cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases); + if (unlikely(!cached_type)) goto bad; + if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad; +done: + Py_DECREF(abi_module); + assert(cached_type == NULL || PyType_Check(cached_type)); + return (PyTypeObject *) cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} +#endif + +/* PyVectorcallFastCallDict */ +#if CYTHON_METH_FASTCALL +static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + PyObject *res = NULL; + PyObject *kwnames; + PyObject **newargs; + PyObject **kwvalues; + Py_ssize_t i, pos; + size_t j; + PyObject *key, *value; + unsigned long keys_are_strings; + Py_ssize_t nkw = PyDict_GET_SIZE(kw); + newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); + if (unlikely(newargs == NULL)) { + PyErr_NoMemory(); + return NULL; + } + for (j = 0; j < nargs; j++) newargs[j] = args[j]; + kwnames = PyTuple_New(nkw); + if (unlikely(kwnames == NULL)) { + PyMem_Free(newargs); + return NULL; + } + kwvalues = newargs + nargs; + pos = i = 0; + keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; + while (PyDict_Next(kw, &pos, &key, &value)) { + keys_are_strings &= Py_TYPE(key)->tp_flags; + Py_INCREF(key); + Py_INCREF(value); + PyTuple_SET_ITEM(kwnames, i, key); + kwvalues[i] = value; + i++; + } + if (unlikely(!keys_are_strings)) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + goto cleanup; + } + res = vc(func, newargs, nargs, kwnames); +cleanup: + Py_DECREF(kwnames); + for (i = 0; i < nkw; i++) + Py_DECREF(kwvalues[i]); + PyMem_Free(newargs); + return res; +} +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) { + return vc(func, args, nargs, NULL); + } + return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); +} +#endif + +/* CythonFunctionShared */ +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) { + if (__Pyx_CyFunction_Check(func)) { + return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc; + } else if (PyCFunction_Check(func)) { + return PyCFunction_GetFunction(func) == (PyCFunction) cfunc; + } + return 0; +} +#else +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) { + return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; +} +#endif +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + __Pyx_Py_XDECREF_SET( + __Pyx_CyFunction_GetClassObj(f), + ((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#else + __Pyx_Py_XDECREF_SET( + ((PyCMethodObject *) (f))->mm_class, + (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#endif +} +static PyObject * +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) +{ + CYTHON_UNUSED_VAR(closure); + if (unlikely(op->func_doc == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_doc = PyObject_GetAttrString(op->func, "__doc__"); + if (unlikely(!op->func_doc)) return NULL; +#else + if (((PyCFunctionObject*)op)->m_ml->ml_doc) { +#if PY_MAJOR_VERSION >= 3 + op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); +#else + op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); +#endif + if (unlikely(op->func_doc == NULL)) + return NULL; + } else { + Py_INCREF(Py_None); + return Py_None; + } +#endif + } + Py_INCREF(op->func_doc); + return op->func_doc; +} +static int +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (value == NULL) { + value = Py_None; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_doc, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(op->func_name == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_name = PyObject_GetAttrString(op->func, "__name__"); +#elif PY_MAJOR_VERSION >= 3 + op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); +#else + op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); +#endif + if (unlikely(op->func_name == NULL)) + return NULL; + } + Py_INCREF(op->func_name); + return op->func_name; +} +static int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) +#endif + { + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_name, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + Py_INCREF(op->func_qualname); + return op->func_qualname; +} +static int +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) +#endif + { + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_qualname, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(op->func_dict == NULL)) { + op->func_dict = PyDict_New(); + if (unlikely(op->func_dict == NULL)) + return NULL; + } + Py_INCREF(op->func_dict); + return op->func_dict; +} +static int +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL)) { + PyErr_SetString(PyExc_TypeError, + "function's dictionary may not be deleted"); + return -1; + } + if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "setting function's dictionary to a non-dict"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_dict, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + Py_INCREF(op->func_globals); + return op->func_globals; +} +static PyObject * +__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(op); + CYTHON_UNUSED_VAR(context); + Py_INCREF(Py_None); + return Py_None; +} +static PyObject * +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) +{ + PyObject* result = (op->func_code) ? op->func_code : Py_None; + CYTHON_UNUSED_VAR(context); + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { + int result = 0; + PyObject *res = op->defaults_getter((PyObject *) op); + if (unlikely(!res)) + return -1; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + op->defaults_tuple = PyTuple_GET_ITEM(res, 0); + Py_INCREF(op->defaults_tuple); + op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); + Py_INCREF(op->defaults_kwdict); + #else + op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0); + if (unlikely(!op->defaults_tuple)) result = -1; + else { + op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1); + if (unlikely(!op->defaults_kwdict)) result = -1; + } + #endif + Py_DECREF(res); + return result; +} +static int +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__defaults__ must be set to a tuple object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = op->defaults_tuple; + CYTHON_UNUSED_VAR(context); + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_tuple; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__kwdefaults__ must be set to a dict object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = op->defaults_kwdict; + CYTHON_UNUSED_VAR(context); + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_kwdict; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value || value == Py_None) { + value = NULL; + } else if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__annotations__ must be set to a dict object"); + return -1; + } + Py_XINCREF(value); + __Pyx_Py_XDECREF_SET(op->func_annotations, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = op->func_annotations; + CYTHON_UNUSED_VAR(context); + if (unlikely(!result)) { + result = PyDict_New(); + if (unlikely(!result)) return NULL; + op->func_annotations = result; + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { + int is_coroutine; + CYTHON_UNUSED_VAR(context); + if (op->func_is_coroutine) { + return __Pyx_NewRef(op->func_is_coroutine); + } + is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; +#if PY_VERSION_HEX >= 0x03050000 + if (is_coroutine) { + PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine; + fromlist = PyList_New(1); + if (unlikely(!fromlist)) return NULL; + Py_INCREF(marker); +#if CYTHON_ASSUME_SAFE_MACROS + PyList_SET_ITEM(fromlist, 0, marker); +#else + if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) { + Py_DECREF(marker); + Py_DECREF(fromlist); + return NULL; + } +#endif + module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + if (unlikely(!module)) goto ignore; + op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker); + Py_DECREF(module); + if (likely(op->func_is_coroutine)) { + return __Pyx_NewRef(op->func_is_coroutine); + } +ignore: + PyErr_Clear(); + } +#endif + op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine); + return __Pyx_NewRef(op->func_is_coroutine); +} +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject * +__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_GetAttrString(op->func, "__module__"); +} +static int +__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_SetAttrString(op->func, "__module__", value); +} +#endif +static PyGetSetDef __pyx_CyFunction_getsets[] = { + {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, + {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, + {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, +#if CYTHON_COMPILING_IN_LIMITED_API + {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0}, +#endif + {0, 0, 0, 0, 0} +}; +static PyMemberDef __pyx_CyFunction_members[] = { +#if !CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, +#endif +#if CYTHON_USE_TYPE_SPECS + {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, +#if CYTHON_METH_FASTCALL +#if CYTHON_BACKPORT_VECTORCALL + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, +#else +#if !CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, +#endif +#endif +#endif +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, +#else + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, +#endif +#endif + {0, 0, 0, 0, 0} +}; +static PyObject * +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) +{ + CYTHON_UNUSED_VAR(args); +#if PY_MAJOR_VERSION >= 3 + Py_INCREF(m->func_qualname); + return m->func_qualname; +#else + return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name); +#endif +} +static PyMethodDef __pyx_CyFunction_methods[] = { + {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, + {0, 0, 0, 0} +}; +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) +#else +#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) +#endif +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { +#if !CYTHON_COMPILING_IN_LIMITED_API + PyCFunctionObject *cf = (PyCFunctionObject*) op; +#endif + if (unlikely(op == NULL)) + return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + op->func = PyCFunction_NewEx(ml, (PyObject*)op, module); + if (unlikely(!op->func)) return NULL; +#endif + op->flags = flags; + __Pyx_CyFunction_weakreflist(op) = NULL; +#if !CYTHON_COMPILING_IN_LIMITED_API + cf->m_ml = ml; + cf->m_self = (PyObject *) op; +#endif + Py_XINCREF(closure); + op->func_closure = closure; +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_XINCREF(module); + cf->m_module = module; +#endif + op->func_dict = NULL; + op->func_name = NULL; + Py_INCREF(qualname); + op->func_qualname = qualname; + op->func_doc = NULL; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + op->func_classobj = NULL; +#else + ((PyCMethodObject*)op)->mm_class = NULL; +#endif + op->func_globals = globals; + Py_INCREF(op->func_globals); + Py_XINCREF(code); + op->func_code = code; + op->defaults_pyobjects = 0; + op->defaults_size = 0; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_kwdict = NULL; + op->defaults_getter = NULL; + op->func_annotations = NULL; + op->func_is_coroutine = NULL; +#if CYTHON_METH_FASTCALL + switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { + case METH_NOARGS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; + break; + case METH_O: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; + break; + case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; + break; + case METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; + break; + case METH_VARARGS | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = NULL; + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + Py_DECREF(op); + return NULL; + } +#endif + return (PyObject *) op; +} +static int +__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) +{ + Py_CLEAR(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_CLEAR(m->func); +#else + Py_CLEAR(((PyCFunctionObject*)m)->m_module); +#endif + Py_CLEAR(m->func_dict); + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_qualname); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_globals); + Py_CLEAR(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } +#endif +#endif + Py_CLEAR(m->defaults_tuple); + Py_CLEAR(m->defaults_kwdict); + Py_CLEAR(m->func_annotations); + Py_CLEAR(m->func_is_coroutine); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_XDECREF(pydefaults[i]); + PyObject_Free(m->defaults); + m->defaults = NULL; + } + return 0; +} +static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + if (__Pyx_CyFunction_weakreflist(m) != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); + __Pyx_PyHeapTypeObject_GC_Del(m); +} +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + __Pyx__CyFunction_dealloc(m); +} +static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) +{ + Py_VISIT(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func); +#else + Py_VISIT(((PyCFunctionObject*)m)->m_module); +#endif + Py_VISIT(m->func_dict); + Py_VISIT(m->func_name); + Py_VISIT(m->func_qualname); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_globals); + Py_VISIT(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); +#endif + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + Py_VISIT(m->func_is_coroutine); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_VISIT(pydefaults[i]); + } + return 0; +} +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromFormat("", + op->func_qualname, (void *)op); +#else + return PyString_FromFormat("", + PyString_AsString(op->func_qualname), (void *)op); +#endif +} +static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *f = ((__pyx_CyFunctionObject*)func)->func; + PyObject *py_name = NULL; + PyCFunction meth; + int flags; + meth = PyCFunction_GetFunction(f); + if (unlikely(!meth)) return NULL; + flags = PyCFunction_GetFlags(f); + if (unlikely(flags < 0)) return NULL; +#else + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = f->m_ml->ml_meth; + int flags = f->m_ml->ml_flags; +#endif + Py_ssize_t size; + switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { + case METH_VARARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) + return (*meth)(self, arg); + break; + case METH_VARARGS | METH_KEYWORDS: + return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_MACROS + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 0)) + return (*meth)(self, NULL); +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, + "%.200S() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, size); + Py_DECREF(py_name); +#else + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); +#endif + return NULL; + } + break; + case METH_O: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_MACROS + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 1)) { + PyObject *result, *arg0; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + arg0 = PyTuple_GET_ITEM(arg, 0); + #else + arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; + #endif + result = (*meth)(self, arg0); + #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(arg0); + #endif + return result; + } +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, + "%.200S() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, size); + Py_DECREF(py_name); +#else + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); +#endif + return NULL; + } + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + return NULL; + } +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, "%.200S() takes no keyword arguments", + py_name); + Py_DECREF(py_name); +#else + PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", + f->m_ml->ml_name); +#endif + return NULL; +} +static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *self, *result; +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)func)->m_self; +#endif + result = __Pyx_CyFunction_CallMethod(func, self, arg, kw); + return result; +} +static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { + PyObject *result; + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; +#if CYTHON_METH_FASTCALL + __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); + if (vc) { +#if CYTHON_ASSUME_SAFE_MACROS + return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); +#else + (void) &__Pyx_PyVectorcall_FastCallDict; + return PyVectorcall_Call(func, args, kw); +#endif + } +#endif + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + Py_ssize_t argc; + PyObject *new_args; + PyObject *self; +#if CYTHON_ASSUME_SAFE_MACROS + argc = PyTuple_GET_SIZE(args); +#else + argc = PyTuple_Size(args); + if (unlikely(!argc) < 0) return NULL; +#endif + new_args = PyTuple_GetSlice(args, 1, argc); + if (unlikely(!new_args)) + return NULL; + self = PyTuple_GetItem(args, 0); + if (unlikely(!self)) { + Py_DECREF(new_args); +#if PY_MAJOR_VERSION > 2 + PyErr_Format(PyExc_TypeError, + "unbound method %.200S() needs an argument", + cyfunc->func_qualname); +#else + PyErr_SetString(PyExc_TypeError, + "unbound method needs an argument"); +#endif + return NULL; + } + result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); + Py_DECREF(new_args); + } else { + result = __Pyx_CyFunction_Call(func, args, kw); + } + return result; +} +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) +{ + int ret = 0; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + if (unlikely(nargs < 1)) { + PyErr_Format(PyExc_TypeError, "%.200s() needs an argument", + ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; + } + ret = 1; + } + if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; + } + return ret; +} +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + if (unlikely(nargs != 0)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; + } + return def->ml_meth(self, NULL); +} +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + if (unlikely(nargs != 1)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; + } + return def->ml_meth(self, args[0]); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; + PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames); +} +#endif +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_CyFunctionType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, + {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, + {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, + {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, + {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, + {Py_tp_methods, (void *)__pyx_CyFunction_methods}, + {Py_tp_members, (void *)__pyx_CyFunction_members}, + {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, + {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, + {0, 0}, +}; +static PyType_Spec __pyx_CyFunctionType_spec = { + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL) + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + __pyx_CyFunctionType_slots +}; +#else +static PyTypeObject __pyx_CyFunctionType_type = { + PyVarObject_HEAD_INIT(0, 0) + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, + (destructor) __Pyx_CyFunction_dealloc, +#if !CYTHON_METH_FASTCALL + 0, +#elif CYTHON_BACKPORT_VECTORCALL + (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall), +#else + offsetof(PyCFunctionObject, vectorcall), +#endif + 0, + 0, +#if PY_MAJOR_VERSION < 3 + 0, +#else + 0, +#endif + (reprfunc) __Pyx_CyFunction_repr, + 0, + 0, + 0, + 0, + __Pyx_CyFunction_CallAsMethod, + 0, + 0, + 0, + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + 0, + (traverseproc) __Pyx_CyFunction_traverse, + (inquiry) __Pyx_CyFunction_clear, + 0, +#if PY_VERSION_HEX < 0x030500A0 + offsetof(__pyx_CyFunctionObject, func_weakreflist), +#else + offsetof(PyCFunctionObject, m_weakreflist), +#endif + 0, + 0, + __pyx_CyFunction_methods, + __pyx_CyFunction_members, + __pyx_CyFunction_getsets, + 0, + 0, + __Pyx_PyMethod_New, + 0, + offsetof(__pyx_CyFunctionObject, func_dict), + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +#if PY_VERSION_HEX >= 0x030400a1 + 0, +#endif +#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, +#endif +#if __PYX_NEED_TP_PRINT_SLOT + 0, +#endif +#if PY_VERSION_HEX >= 0x030C0000 + 0, +#endif +#if PY_VERSION_HEX >= 0x030d00A4 + 0, +#endif +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, +#endif +}; +#endif +static int __pyx_CyFunction_init(PyObject *module) { +#if CYTHON_USE_TYPE_SPECS + __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL); +#else + CYTHON_UNUSED_VAR(module); + __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); +#endif + if (unlikely(__pyx_CyFunctionType == NULL)) { + return -1; + } + return 0; +} +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyObject_Malloc(size); + if (unlikely(!m->defaults)) + return PyErr_NoMemory(); + memset(m->defaults, 0, size); + m->defaults_pyobjects = pyobjects; + m->defaults_size = size; + return m->defaults; +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_kwdict = dict; + Py_INCREF(dict); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->func_annotations = dict; + Py_INCREF(dict); +} + +/* CythonFunction */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + PyObject *op = __Pyx_CyFunction_Init( + PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), + ml, flags, qualname, closure, module, globals, code + ); + if (likely(op)) { + PyObject_GC_Track(op); + } + return op; +} + +/* PyDictVersioning */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + +/* PyErrExceptionMatches */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyObjectGetAttrStrNoError */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d00A1 +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1 + (void) PyObject_GetOptionalAttr(obj, attr_name, &result); + return result; +#else +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +#endif +} + +/* CLineInTraceback */ +#ifndef CYTHON_CLINE_IN_TRACEBACK +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { + PyObject *use_cline; + PyObject *ptype, *pvalue, *ptraceback; +#if CYTHON_COMPILING_IN_CPYTHON + PyObject **cython_runtime_dict; +#endif + CYTHON_MAYBE_UNUSED_VAR(tstate); + if (unlikely(!__pyx_cython_runtime)) { + return c_line; + } + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); +#if CYTHON_COMPILING_IN_CPYTHON + cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); + if (likely(cython_runtime_dict)) { + __PYX_PY_DICT_LOOKUP_IF_MODIFIED( + use_cline, *cython_runtime_dict, + __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) + } else +#endif + { + PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + if (use_cline_obj) { + use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; + Py_DECREF(use_cline_obj); + } else { + PyErr_Clear(); + use_cline = NULL; + } + } + if (!use_cline) { + c_line = 0; + (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + } + else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { + c_line = 0; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + return c_line; +} +#endif + +/* CodeObjectCache */ +#if !CYTHON_COMPILING_IN_LIMITED_API +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = start + (end - start) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); +} +#endif + +/* AddTraceback */ +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, + PyObject *firstlineno, PyObject *name) { + PyObject *replace = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; + replace = PyObject_GetAttrString(code, "replace"); + if (likely(replace)) { + PyObject *result; + result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict); + Py_DECREF(replace); + return result; + } + PyErr_Clear(); + #if __PYX_LIMITED_VERSION_HEX < 0x030780000 + { + PyObject *compiled = NULL, *result = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL; + compiled = Py_CompileString( + "out = type(code)(\n" + " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n" + " code.co_flags, code.co_code, code.co_consts, code.co_names,\n" + " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n" + " code.co_lnotab)\n", "", Py_file_input); + if (!compiled) return NULL; + result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict); + Py_DECREF(compiled); + if (!result) PyErr_Print(); + Py_DECREF(result); + result = PyDict_GetItemString(scratch_dict, "out"); + if (result) Py_INCREF(result); + return result; + } + #else + return NULL; + #endif +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; + PyObject *replace = NULL, *getframe = NULL, *frame = NULL; + PyObject *exc_type, *exc_value, *exc_traceback; + int success = 0; + if (c_line) { + (void) __pyx_cfilenm; + (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); + code_object = Py_CompileString("_getframe()", filename, Py_eval_input); + if (unlikely(!code_object)) goto bad; + py_py_line = PyLong_FromLong(py_line); + if (unlikely(!py_py_line)) goto bad; + py_funcname = PyUnicode_FromString(funcname); + if (unlikely(!py_funcname)) goto bad; + dict = PyDict_New(); + if (unlikely(!dict)) goto bad; + { + PyObject *old_code_object = code_object; + code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); + Py_DECREF(old_code_object); + } + if (unlikely(!code_object)) goto bad; + getframe = PySys_GetObject("_getframe"); + if (unlikely(!getframe)) goto bad; + if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; + frame = PyEval_EvalCode(code_object, dict, dict); + if (unlikely(!frame) || frame == Py_None) goto bad; + success = 1; + bad: + PyErr_Restore(exc_type, exc_value, exc_traceback); + Py_XDECREF(code_object); + Py_XDECREF(py_py_line); + Py_XDECREF(py_funcname); + Py_XDECREF(dict); + Py_XDECREF(replace); + if (success) { + PyTraceBack_Here( + (struct _frame*)frame); + } + Py_XDECREF(frame); +} +#else +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; + #if PY_MAJOR_VERSION < 3 + PyObject *py_srcfile = NULL; + py_srcfile = PyString_FromString(filename); + if (!py_srcfile) goto bad; + #endif + if (c_line) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + if (!py_funcname) goto bad; + #endif + } + #if PY_MAJOR_VERSION < 3 + py_code = __Pyx_PyCode_New( + 0, + 0, + 0, + 0, + 0, + 0, + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + py_line, + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + Py_DECREF(py_srcfile); + #else + py_code = PyCode_NewEmpty(filename, funcname, py_line); + #endif + Py_XDECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_funcname); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_srcfile); + #endif + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject *ptype, *pvalue, *ptraceback; + if (c_line) { + c_line = __Pyx_CLineForTraceback(tstate, c_line); + } + py_code = __pyx_find_code_object(c_line ? -c_line : py_line); + if (!py_code) { + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) { + /* If the code object creation fails, then we should clear the + fetched exception references and propagate the new exception */ + Py_XDECREF(ptype); + Py_XDECREF(pvalue); + Py_XDECREF(ptraceback); + goto bad; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); + } + py_frame = PyFrame_New( + tstate, /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + __pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + __Pyx_PyFrame_SetLineNumber(py_frame, py_line); + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} +#endif + +/* CIntFromPyVerify */ +#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) +#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) +#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ + {\ + func_type value = func_value;\ + if (sizeof(target_type) < sizeof(func_type)) {\ + if (unlikely(value != (func_type) (target_type) value)) {\ + func_type zero = 0;\ + if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ + return (target_type) -1;\ + if (is_unsigned && unlikely(value < zero))\ + goto raise_neg_overflow;\ + else\ + goto raise_overflow;\ + }\ + }\ + return (target_type) value;\ + } + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From___pyx_anon_enum(int value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(int) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(int), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + if (!is_unsigned) { + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad; + } + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(arg_tuple); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntFromPy */ +static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const size_t neg_one = (size_t) -1, const_zero = (size_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if ((sizeof(size_t) < sizeof(long))) { + __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (size_t) val; + } + } +#endif + if (unlikely(!PyLong_Check(x))) { + size_t val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (size_t) -1; + val = __Pyx_PyInt_As_size_t(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 2 * PyLong_SHIFT)) { + return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 3 * PyLong_SHIFT)) { + return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 4 * PyLong_SHIFT)) { + return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (size_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(size_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if ((sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) { + return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(size_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if ((sizeof(size_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif + } + } + { + size_t val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (size_t) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (size_t) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (size_t) -1; + } else { + stepval = v; + } + v = NULL; + val = (size_t) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(size_t) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((size_t) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(size_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((size_t) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((size_t) 1) << (sizeof(size_t) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (size_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to size_t"); + return (size_t) -1; +} + +/* FormatTypeName */ +#if CYTHON_COMPILING_IN_LIMITED_API +static __Pyx_TypeName +__Pyx_PyType_GetName(PyTypeObject* tp) +{ + PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_n_s_name); + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { + PyErr_Clear(); + Py_XDECREF(name); + name = __Pyx_NewRef(__pyx_n_s__6); + } + return name; +} +#endif + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + if (!is_unsigned) { + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad; + } + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(arg_tuple); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntFromPy */ +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if ((sizeof(long) < sizeof(long))) { + __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (long) val; + } + } +#endif + if (unlikely(!PyLong_Check(x))) { + long val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (long) -1; + val = __Pyx_PyInt_As_long(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(long) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(long) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif + } + } + { + long val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (long) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (long) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = v; + } + v = NULL; + val = (long) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((long) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((long) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (long) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to long"); + return (long) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if ((sizeof(int) < sizeof(long))) { + __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (int) val; + } + } +#endif + if (unlikely(!PyLong_Check(x))) { + int val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (int) -1; + val = __Pyx_PyInt_As_int(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(int) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(int) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif + } + } + { + int val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (int) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (int) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = v; + } + v = NULL; + val = (int) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((int) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (int) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int"); + return (int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; +} + +/* FastTypeChecks */ +#if CYTHON_COMPILING_IN_CPYTHON +static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { + while (a) { + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); + if (a == b) + return 1; + } + return b == &PyBaseObject_Type; +} +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (a == b) return 1; + mro = a->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(a, b); +} +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (cls == a || cls == b) return 1; + mro = cls->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + PyObject *base = PyTuple_GET_ITEM(mro, i); + if (base == (PyObject *)a || base == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); +} +#if PY_MAJOR_VERSION == 2 +static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { + PyObject *exception, *value, *tb; + int res; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&exception, &value, &tb); + res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + if (!res) { + res = PyObject_IsSubclass(err, exc_type2); + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + } + __Pyx_ErrRestore(exception, value, tb); + return res; +} +#else +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + } +} +#endif +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i= 0x030B00A4 + return Py_Version & ~0xFFUL; +#else + const char* rt_version = Py_GetVersion(); + unsigned long version = 0; + unsigned long factor = 0x01000000UL; + unsigned int digit = 0; + int i = 0; + while (factor) { + while ('0' <= rt_version[i] && rt_version[i] <= '9') { + digit = digit * 10 + (unsigned int) (rt_version[i] - '0'); + ++i; + } + version += factor * digit; + if (rt_version[i] != '.') + break; + digit = 0; + factor >>= 8; + ++i; + } + return version; +#endif +} +static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) { + const unsigned long MAJOR_MINOR = 0xFFFF0000UL; + if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR)) + return 0; + if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR))) + return 1; + { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compile time Python version %d.%d " + "of module '%.100s' " + "%s " + "runtime version %d.%d", + (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF), + __Pyx_MODULE_NAME, + (allow_newer) ? "was newer than" : "does not match", + (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF) + ); + return PyErr_WarnEx(NULL, message, 1); + } +} + +/* InitStrings */ +#if PY_MAJOR_VERSION >= 3 +static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { + if (t.is_unicode | t.is_str) { + if (t.intern) { + *str = PyUnicode_InternFromString(t.s); + } else if (t.encoding) { + *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); + } else { + *str = PyUnicode_FromStringAndSize(t.s, t.n - 1); + } + } else { + *str = PyBytes_FromStringAndSize(t.s, t.n - 1); + } + if (!*str) + return -1; + if (PyObject_Hash(*str) == -1) + return -1; + return 0; +} +#endif +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION >= 3 + __Pyx_InitString(*t, t->p); + #else + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + if (!*t->p) + return -1; + if (PyObject_Hash(*t->p) == -1) + return -1; + #endif + ++t; + } + return 0; +} + +#include +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { + size_t len = strlen(s); + if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) { + PyErr_SetString(PyExc_OverflowError, "byte string is too long"); + return -1; + } + return (Py_ssize_t) len; +} +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { + Py_ssize_t len = __Pyx_ssize_strlen(c_str); + if (unlikely(len < 0)) return NULL; + return __Pyx_PyUnicode_FromStringAndSize(c_str, len); +} +static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) { + Py_ssize_t len = __Pyx_ssize_strlen(c_str); + if (unlikely(len < 0)) return NULL; + return PyByteArray_FromStringAndSize(c_str, len); +} +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { + Py_ssize_t ignore; + return __Pyx_PyObject_AsStringAndSize(o, &ignore); +} +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT +#if !CYTHON_PEP393_ENABLED +static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { + char* defenc_c; + PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); + if (!defenc) return NULL; + defenc_c = PyBytes_AS_STRING(defenc); +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + { + char* end = defenc_c + PyBytes_GET_SIZE(defenc); + char* c; + for (c = defenc_c; c < end; c++) { + if ((unsigned char) (*c) >= 128) { + PyUnicode_AsASCIIString(o); + return NULL; + } + } + } +#endif + *length = PyBytes_GET_SIZE(defenc); + return defenc_c; +} +#else +static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { + if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (likely(PyUnicode_IS_ASCII(o))) { + *length = PyUnicode_GET_LENGTH(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else + return PyUnicode_AsUTF8AndSize(o, length); +#endif +} +#endif +#endif +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT + if ( +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + __Pyx_sys_getdefaultencoding_not_ascii && +#endif + PyUnicode_Check(o)) { + return __Pyx_PyUnicode_AsStringAndSize(o, length); + } else +#endif +#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) + if (PyByteArray_Check(o)) { + *length = PyByteArray_GET_SIZE(o); + return PyByteArray_AS_STRING(o); + } else +#endif + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (unlikely(r < 0)) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { + int retval; + if (unlikely(!x)) return -1; + retval = __Pyx_PyObject_IsTrue(x); + Py_DECREF(x); + return retval; +} +static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); +#if PY_MAJOR_VERSION >= 3 + if (PyLong_Check(result)) { + if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " + "The ability to return an instance of a strict subclass of int is deprecated, " + "and may be removed in a future version of Python.", + result_type_name)) { + __Pyx_DECREF_TypeName(result_type_name); + Py_DECREF(result); + return NULL; + } + __Pyx_DECREF_TypeName(result_type_name); + return result; + } +#endif + PyErr_Format(PyExc_TypeError, + "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", + type_name, type_name, result_type_name); + __Pyx_DECREF_TypeName(result_type_name); + Py_DECREF(result); + return NULL; +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { +#if CYTHON_USE_TYPE_SLOTS + PyNumberMethods *m; +#endif + const char *name = NULL; + PyObject *res = NULL; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x) || PyLong_Check(x))) +#else + if (likely(PyLong_Check(x))) +#endif + return __Pyx_NewRef(x); +#if CYTHON_USE_TYPE_SLOTS + m = Py_TYPE(x)->tp_as_number; + #if PY_MAJOR_VERSION < 3 + if (m && m->nb_int) { + name = "int"; + res = m->nb_int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = m->nb_long(x); + } + #else + if (likely(m && m->nb_int)) { + name = "int"; + res = m->nb_int(x); + } + #endif +#else + if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { + res = PyNumber_Int(x); + } +#endif + if (likely(res)) { +#if PY_MAJOR_VERSION < 3 + if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { +#else + if (unlikely(!PyLong_CheckExact(res))) { +#endif + return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject *x; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_CheckExact(b))) { + if (sizeof(Py_ssize_t) >= sizeof(long)) + return PyInt_AS_LONG(b); + else + return PyInt_AsSsize_t(b); + } +#endif + if (likely(PyLong_CheckExact(b))) { + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(__Pyx_PyLong_IsCompact(b))) { + return __Pyx_PyLong_CompactValue(b); + } else { + const digit* digits = __Pyx_PyLong_Digits(b); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); + switch (size) { + case 2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + } + } + #endif + return PyLong_AsSsize_t(b); + } + x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); +#if PY_MAJOR_VERSION < 3 + } else if (likely(PyInt_CheckExact(o))) { + return PyInt_AS_LONG(o); +#endif + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyInt_AsLong(x); + Py_DECREF(x); + return ival; + } +} +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { + return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); +} +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { + return PyInt_FromSize_t(ival); +} + + +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ +#endif /* Py_PYTHON_H */ diff --git a/ssh2/extras.pyi b/ssh2/extras.pyi new file mode 100644 index 00000000..66ed707c --- /dev/null +++ b/ssh2/extras.pyi @@ -0,0 +1,20 @@ +# This file is part of ssh2-python. +# Copyright (C) 2017-2025 Panos Kittenis +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation, version 2.1. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +from typing import Callable, Any, ParamSpecArgs, ParamSpecKwargs + +def eagain_errcode(func: Callable, poller_func: Callable, *args: ParamSpecArgs, **kwargs: ParamSpecKwargs) -> Any: ... +def eagain_write_errcode(write_func: Callable, poller_func: Callable, data: bytes) -> None: ... diff --git a/ssh2/extras.pyx b/ssh2/extras.pyx new file mode 100644 index 00000000..d49b431d --- /dev/null +++ b/ssh2/extras.pyx @@ -0,0 +1,64 @@ +# This file is part of ssh2-python. +# Copyright (C) 2017-2025 Panos Kittenis +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation, version 2.1. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +""" +Additional functionality not part of the libssh2 API. +""" +from typing import Callable, Any, ParamSpecArgs, ParamSpecKwargs + +from . cimport error_codes +from .utils import find_eol + + +def eagain_errcode(func: Callable, poller_func: Callable, *args: ParamSpecArgs, **kwargs: ParamSpecKwargs) -> Any: + """Helper function for reading in non-blocking mode. + + Any additional arguments and keyword arguments provided are used as arguments to the session function `func`. + `func` should return an integer return code. + + :param func: The session function to call to read data from. + :param poller_func: A python function to handle socket polling that takes no arguments. + + :returns: Output of func. + :rtype: int + """ + ret = func(*args, **kwargs) + while ret == error_codes._LIBSSH2_ERROR_EAGAIN: + poller_func() + ret = func(*args, **kwargs) + return ret + + +def eagain_write_errcode(write_func: Callable, poller_func: Callable, bytes data) -> None: + """Helper function for writing in non-blocking mode. + + Any additional arguments and keyword arguments provided are used as arguments to the session function `write_func`. + `write_func` should return an integer tuple `(rc, bytes_written)` for return code and bytes written respectively. + + :param write_func: The session function to call to read data from. + :param poller_func: A python function to handle socket polling that takes no arguments. + :param data: The data to write. + :type data: bytes + """ + cdef size_t data_len = len(data) + cdef size_t total_written = 0 + cdef rc + cdef size_t bytes_written + while total_written < data_len: + rc, bytes_written = write_func(data[total_written:]) + total_written += bytes_written + if rc == error_codes._LIBSSH2_ERROR_EAGAIN: + poller_func() diff --git a/ssh2/fileinfo.c b/ssh2/fileinfo.c index 6bb5ecab..7a7b5f32 100644 --- a/ssh2/fileinfo.c +++ b/ssh2/fileinfo.c @@ -1,4 +1,4 @@ -/* Generated by Cython 3.0.11 */ +/* Generated by Cython 3.0.12 */ /* BEGIN: Cython Metadata { @@ -52,10 +52,10 @@ END: Cython Metadata */ #else #define __PYX_EXTRA_ABI_MODULE_NAME "" #endif -#define CYTHON_ABI "3_0_11" __PYX_EXTRA_ABI_MODULE_NAME +#define CYTHON_ABI "3_0_12" __PYX_EXTRA_ABI_MODULE_NAME #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." -#define CYTHON_HEX_VERSION 0x03000BF0 +#define CYTHON_HEX_VERSION 0x03000CF0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -1781,7 +1781,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #if !CYTHON_VECTORCALL #if PY_VERSION_HEX >= 0x03080000 #include "frameobject.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif @@ -3396,7 +3396,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_8fileinfo_8FileInfo_4__reduce_cython__, "FileInfo.__reduce_cython__(self)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_8fileinfo_8FileInfo_4__reduce_cython__, "__reduce_cython__(self)"); static PyMethodDef __pyx_mdef_4ssh2_8fileinfo_8FileInfo_5__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_8fileinfo_8FileInfo_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_8fileinfo_8FileInfo_4__reduce_cython__}; static PyObject *__pyx_pw_4ssh2_8fileinfo_8FileInfo_5__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -3477,7 +3477,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_8fileinfo_8FileInfo_6__setstate_cython__, "FileInfo.__setstate_cython__(self, __pyx_state)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_8fileinfo_8FileInfo_6__setstate_cython__, "__setstate_cython__(self, __pyx_state)"); static PyMethodDef __pyx_mdef_4ssh2_8fileinfo_8FileInfo_7__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_8fileinfo_8FileInfo_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_8fileinfo_8FileInfo_6__setstate_cython__}; static PyObject *__pyx_pw_4ssh2_8fileinfo_8FileInfo_7__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -7321,7 +7321,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { #include "compile.h" #include "frameobject.h" #include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif diff --git a/ssh2/knownhost.c b/ssh2/knownhost.c index ec32044b..f1849c2e 100644 --- a/ssh2/knownhost.c +++ b/ssh2/knownhost.c @@ -1,4 +1,4 @@ -/* Generated by Cython 3.0.11 */ +/* Generated by Cython 3.0.12 */ /* BEGIN: Cython Metadata { @@ -56,10 +56,10 @@ END: Cython Metadata */ #else #define __PYX_EXTRA_ABI_MODULE_NAME "" #endif -#define CYTHON_ABI "3_0_11" __PYX_EXTRA_ABI_MODULE_NAME +#define CYTHON_ABI "3_0_12" __PYX_EXTRA_ABI_MODULE_NAME #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." -#define CYTHON_HEX_VERSION 0x03000BF0 +#define CYTHON_HEX_VERSION 0x03000CF0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -1532,6 +1532,18 @@ struct __pyx_obj_4ssh2_7session_Session; struct __pyx_obj_4ssh2_7session_MethodType; struct __pyx_obj_4ssh2_9knownhost_KnownHostEntry; struct __pyx_obj_4ssh2_9knownhost_KnownHost; +struct __pyx_ctuple_int__and_int; +typedef struct __pyx_ctuple_int__and_int __pyx_ctuple_int__and_int; + +/* "utils.pxd":24 + * cdef object to_str_len(char *c_str, int length) + * cpdef int handle_error_codes(int errcode) except -1 + * cpdef (int, int) find_eol(bytes buf: bytes, Py_ssize_t pos: Py_ssize_t) # <<<<<<<<<<<<<< + */ +struct __pyx_ctuple_int__and_int { + int f0; + int f1; +}; /* "session.pxd":19 * from . cimport c_ssh2 @@ -1812,7 +1824,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #if !CYTHON_VECTORCALL #if PY_VERSION_HEX >= 0x03080000 #include "frameobject.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif @@ -2021,22 +2033,22 @@ static int __Pyx_setup_reduce(PyObject* type_obj); #endif /* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_11 -#define __PYX_HAVE_RT_ImportType_proto_3_0_11 +#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_12 +#define __PYX_HAVE_RT_ImportType_proto_3_0_12 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #include #endif #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L -#define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) alignof(s) +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_12(s) alignof(s) #else -#define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) sizeof(void*) +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_12(s) sizeof(void*) #endif -enum __Pyx_ImportType_CheckSize_3_0_11 { - __Pyx_ImportType_CheckSize_Error_3_0_11 = 0, - __Pyx_ImportType_CheckSize_Warn_3_0_11 = 1, - __Pyx_ImportType_CheckSize_Ignore_3_0_11 = 2 +enum __Pyx_ImportType_CheckSize_3_0_12 { + __Pyx_ImportType_CheckSize_Error_3_0_12 = 0, + __Pyx_ImportType_CheckSize_Warn_3_0_12 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_0_12 = 2 }; -static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size); +static PyTypeObject *__Pyx_ImportType_3_0_12(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_12 check_size); #endif /* Import.proto */ @@ -2277,7 +2289,7 @@ static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig); /* FunctionImport.proto */ -static int __Pyx_ImportFunction_3_0_11(PyObject *module, const char *funcname, void (**f)(void), const char *sig); +static int __Pyx_ImportFunction_3_0_12(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); @@ -3884,7 +3896,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_14KnownHostEntry_4_dealloc__, "KnownHostEntry._dealloc__(self)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_14KnownHostEntry_4_dealloc__, "_dealloc__(self)"); static PyMethodDef __pyx_mdef_4ssh2_9knownhost_14KnownHostEntry_5_dealloc__ = {"_dealloc__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_9knownhost_14KnownHostEntry_5_dealloc__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_9knownhost_14KnownHostEntry_4_dealloc__}; static PyObject *__pyx_pw_4ssh2_9knownhost_14KnownHostEntry_5_dealloc__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -4372,7 +4384,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_14KnownHostEntry_6__reduce_cython__, "KnownHostEntry.__reduce_cython__(self)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_14KnownHostEntry_6__reduce_cython__, "__reduce_cython__(self)"); static PyMethodDef __pyx_mdef_4ssh2_9knownhost_14KnownHostEntry_7__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_9knownhost_14KnownHostEntry_7__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_9knownhost_14KnownHostEntry_6__reduce_cython__}; static PyObject *__pyx_pw_4ssh2_9knownhost_14KnownHostEntry_7__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -4453,7 +4465,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_14KnownHostEntry_8__setstate_cython__, "KnownHostEntry.__setstate_cython__(self, __pyx_state)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_14KnownHostEntry_8__setstate_cython__, "__setstate_cython__(self, __pyx_state)"); static PyMethodDef __pyx_mdef_4ssh2_9knownhost_14KnownHostEntry_9__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_9knownhost_14KnownHostEntry_9__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_9knownhost_14KnownHostEntry_8__setstate_cython__}; static PyObject *__pyx_pw_4ssh2_9knownhost_14KnownHostEntry_9__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -4810,7 +4822,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_9KnownHost_4add, "KnownHost.add(self, bytes host, bytes salt, bytes key, int typemask)\nDeprecated - use ``self.addc``"); +PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_9KnownHost_4add, "add(self, host: bytes, salt: bytes, key: bytes, typemask: int)\nDeprecated - use ``self.addc``"); static PyMethodDef __pyx_mdef_4ssh2_9knownhost_9KnownHost_5add = {"add", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_9knownhost_9KnownHost_5add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_9knownhost_9KnownHost_4add}; static PyObject *__pyx_pw_4ssh2_9knownhost_9KnownHost_5add(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -5002,7 +5014,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_9KnownHost_6addc, "KnownHost.addc(self, bytes host, bytes key, int typemask, bytes salt=None, bytes comment=None)\nAdds a host and its key to known hosts collection.\n\n Note - ``libssh2`` expects correct use of hashed hosts when\n ``LIBSSH2_KNOWNHOST_TYPE_SHA1`` is part of typemask. Incorrect use of\n hashed host typemask without appropriate hashed host and salt values\n will result in host entries being added to the collection without a\n host name.\n\n :param host: Host to add key for.\n :type host: bytes\n :param key: Key to add.\n :type key: bytes\n :param typemask: Bitmask of one of each from\n ``ssh2.knownhost.LIBSSH2_KNOWNHOST_TYPE_*``,\n ``ssh2.knownhost.LIBSSH2_KNOWNHOST_KEYENC_*`` and\n ``ssh2.knownhost.LIBSSH2_KNOWNHOST_KEY_*`` for example for plain text\n host, raw key encoding and SSH RSA key ``type`` would be\n ``LIBSSH2_KNOWNHOST_TYPE_PLAIN | LIBSSH2_KNOWNHOST_KEYENC_RAW |\n LIBSSH2_KNOWNHOST_KEY_SSHRSA``.\n :param salt: Salt used for host hashing if host is hashed.\n Defaults to ``None``.\n :type salt: bytes\n :param comment: Comment to add for host. Defaults to ``None``.\n :type comment: bytes\n\n :raises: :py:class:`ssh2.exceptions.KnownHostAddError` on errors adding\n known host entry."); +PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_9KnownHost_6addc, "addc(self, host: bytes, key: bytes, typemask: int, salt: bytes = None, comment: bytes = None)\nAdds a host and its key to known hosts collection.\n\n Note - ``libssh2`` expects correct use of hashed hosts when\n ``LIBSSH2_KNOWNHOST_TYPE_SHA1`` is part of typemask. Incorrect use of\n hashed host typemask without appropriate hashed host and salt values\n will result in host entries being added to the collection without a\n host name.\n\n :param host: Host to add key for.\n :type host: bytes\n :param key: Key to add.\n :type key: bytes\n :param typemask: Bitmask of one of each from\n ``ssh2.knownhost.LIBSSH2_KNOWNHOST_TYPE_*``,\n ``ssh2.knownhost.LIBSSH2_KNOWNHOST_KEYENC_*`` and\n ``ssh2.knownhost.LIBSSH2_KNOWNHOST_KEY_*`` for example for plain text\n host, raw key encoding and SSH RSA key ``type`` would be\n ``LIBSSH2_KNOWNHOST_TYPE_PLAIN | LIBSSH2_KNOWNHOST_KEYENC_RAW |\n LIBSSH2_KNOWNHOST_KEY_SSHRSA``.\n :param salt: Salt used for host hashing if host is hashed.\n Defaults to ``None``.\n :type salt: bytes\n :param comment: Comment to add for host. Defaults to ``None``.\n :type comment: bytes\n\n :raises: :py:class:`ssh2.exceptions.KnownHostAddError` on errors adding\n known host entry."); static PyMethodDef __pyx_mdef_4ssh2_9knownhost_9KnownHost_7addc = {"addc", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_9knownhost_9KnownHost_7addc, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_9knownhost_9KnownHost_6addc}; static PyObject *__pyx_pw_4ssh2_9knownhost_9KnownHost_7addc(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -5515,7 +5527,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_9KnownHost_8check, "KnownHost.check(self, bytes host, bytes key, int typemask)\nDeprecated - use ``self.checkp``"); +PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_9KnownHost_8check, "check(self, host: bytes, key: bytes, typemask: int)\nDeprecated - use ``self.checkp``"); static PyMethodDef __pyx_mdef_4ssh2_9knownhost_9KnownHost_9check = {"check", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_9knownhost_9KnownHost_9check, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_9knownhost_9KnownHost_8check}; static PyObject *__pyx_pw_4ssh2_9knownhost_9KnownHost_9check(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -5691,7 +5703,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_9KnownHost_10checkp, "KnownHost.checkp(self, bytes host, int port, bytes key, int typemask)\nCheck a host and its key against the known hosts collection and\n return known host entry, if any.\n\n Note that server key provided to this function must be base64 encoded\n only if checking against a ``self.addc`` added known public key.\n When using ``self.readfile`` and a known_hosts file, encoding is not\n needed.\n\n :py:class:`ssh2.exceptions.KnownHostCheckError` is base class for all\n host check error exceptions and can be used to catch all host check\n errors.\n\n :param host: Host to check.\n :type host: bytes\n :param key: Key of host to check.\n :type key: bytes\n :param typemask: Bitmask of one of each from\n ``ssh2.knownhost.LIBSSH2_KNOWNHOST_TYPE_*``,\n ``ssh2.knownhost.LIBSSH2_KNOWNHOST_KEYENC_*`` and\n ``ssh2.knownhost.LIBSSH2_KNOWNHOST_KEY_*`` for example for plain text\n host, raw key encoding and SSH RSA key ``type`` would be\n ``LIBSSH2_KNOWNHOST_TYPE_PLAIN | LIBSSH2_KNOWNHOST_KEYENC_RAW |\n LIBSSH2_KNOWNHOST_KEY_SSHRSA``.\n\n :raises: :py:class:`ssh2.exceptions.KnownHostCheckMisMatchError` on\n provided key mis-match error with found key from known hosts.\n :raises: :py:class:`ssh2.exceptions.KnownHostCheckNotFoundError` on\n host not found in known hosts.\n :raises: :py:class:`ssh2.exceptions.KnownHostCheckFailure` on failure\n checking known host entry.\n :raises: :py:class:`ssh2.exceptions.KnownHostCheckError` on unknown\n errors checking known host.\n\n :rtype: :py:class:`ssh2.knownhost.KnownHostEntry`"); +PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_9KnownHost_10checkp, "checkp(self, host: bytes, port: int, key: bytes, typemask: int)\nCheck a host and its key against the known hosts collection and\n return known host entry, if any.\n\n Note that server key provided to this function must be base64 encoded\n only if checking against a ``self.addc`` added known public key.\n When using ``self.readfile`` and a known_hosts file, encoding is not\n needed.\n\n :py:class:`ssh2.exceptions.KnownHostCheckError` is base class for all\n host check error exceptions and can be used to catch all host check\n errors.\n\n :param host: Host to check.\n :type host: bytes\n :param key: Key of host to check.\n :type key: bytes\n :param typemask: Bitmask of one of each from\n ``ssh2.knownhost.LIBSSH2_KNOWNHOST_TYPE_*``,\n ``ssh2.knownhost.LIBSSH2_KNOWNHOST_KEYENC_*`` and\n ``ssh2.knownhost.LIBSSH2_KNOWNHOST_KEY_*`` for example for plain text\n host, raw key encoding and SSH RSA key ``type`` would be\n ``LIBSSH2_KNOWNHOST_TYPE_PLAIN | LIBSSH2_KNOWNHOST_KEYENC_RAW |\n LIBSSH2_KNOWNHOST_KEY_SSHRSA``.\n\n :raises: :py:class:`ssh2.exceptions.KnownHostCheckMisMatchError` on\n provided key mis-match error with found key from known hosts.\n :raises: :py:class:`ssh2.exceptions.KnownHostCheckNotFoundError` on\n host not found in known hosts.\n :raises: :py:class:`ssh2.exceptions.KnownHostCheckFailure` on failure\n checking known host entry.\n :raises: :py:class:`ssh2.exceptions.KnownHostCheckError` on unknown\n errors checking known host.\n\n :rtype: :py:class:`ssh2.knownhost.KnownHostEntry`"); static PyMethodDef __pyx_mdef_4ssh2_9knownhost_9KnownHost_11checkp = {"checkp", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_9knownhost_9KnownHost_11checkp, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_9knownhost_9KnownHost_10checkp}; static PyObject *__pyx_pw_4ssh2_9knownhost_9KnownHost_11checkp(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6228,7 +6240,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_9KnownHost_12delete, "KnownHost.delete(self, KnownHostEntry entry)\nDelete given known host entry from collection of known hosts.\n\n :param entry: Known host entry to delete.\n :type entry: :py:class:`ssh2.knownhost.KnownHostEntry`\n\n :raises: :py:class:`ssh2.exceptions.KnownHostDeleteError` on errors\n deleting host entry."); +PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_9KnownHost_12delete, "delete(self, entry: KnownHostEntry)\nDelete given known host entry from collection of known hosts.\n\n :param entry: Known host entry to delete.\n :type entry: :py:class:`ssh2.knownhost.KnownHostEntry`\n\n :raises: :py:class:`ssh2.exceptions.KnownHostDeleteError` on errors\n deleting host entry."); static PyMethodDef __pyx_mdef_4ssh2_9knownhost_9KnownHost_13delete = {"delete", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_9knownhost_9KnownHost_13delete, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_9knownhost_9KnownHost_12delete}; static PyObject *__pyx_pw_4ssh2_9knownhost_9KnownHost_13delete(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6487,7 +6499,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_9KnownHost_14readline, "KnownHost.readline(self, bytes line, int f_type=c_ssh2.LIBSSH2_KNOWNHOST_FILE_OPENSSH)\nRead line from known hosts file and add to known hosts\n collection. Only OpenSSH known hosts file format is currently supported.\n\n Note - When using readline, the key values returned by ``self.get`` will\n need to be base64 encoded as libssh2's readline does not encode them\n when adding, unlike ``self.readfile`` and ``self.addc``.\n\n :param line: Byte string representing line to read.\n :type line: bytes\n\n :raises: :py:class:`ssh2.exceptions.KnownHostReadLineError` on errors\n reading line."); +PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_9KnownHost_14readline, "readline(self, line: bytes, f_type: int = c_ssh2.LIBSSH2_KNOWNHOST_FILE_OPENSSH)\nRead line from known hosts file and add to known hosts\n collection. Only OpenSSH known hosts file format is currently supported.\n\n Note - When using readline, the key values returned by ``self.get`` will\n need to be base64 encoded as libssh2's readline does not encode them\n when adding, unlike ``self.readfile`` and ``self.addc``.\n\n :param line: Byte string representing line to read.\n :type line: bytes\n\n :raises: :py:class:`ssh2.exceptions.KnownHostReadLineError` on errors\n reading line."); static PyMethodDef __pyx_mdef_4ssh2_9knownhost_9KnownHost_15readline = {"readline", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_9knownhost_9KnownHost_15readline, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_9knownhost_9KnownHost_14readline}; static PyObject *__pyx_pw_4ssh2_9knownhost_9KnownHost_15readline(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6789,7 +6801,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_9KnownHost_16readfile, "KnownHost.readfile(self, filename, int f_type=c_ssh2.LIBSSH2_KNOWNHOST_FILE_OPENSSH)\nRead known hosts file and add hosts to known hosts collection.\n Only OpenSSH known hosts file format is currently supported.\n\n Returns number of successfully read host entries.\n\n :param filename: File name to read.\n :type filename: str\n\n :raises: :py:class:`ssh2.exceptions.KnownHostReadFileError` on errors\n reading file.\n\n :rtype: int"); +PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_9KnownHost_16readfile, "readfile(self, filename, f_type: int = c_ssh2.LIBSSH2_KNOWNHOST_FILE_OPENSSH)\nRead known hosts file and add hosts to known hosts collection.\n Only OpenSSH known hosts file format is currently supported.\n\n Returns number of successfully read host entries.\n\n :param filename: File name to read.\n :type filename: str\n\n :raises: :py:class:`ssh2.exceptions.KnownHostReadFileError` on errors\n reading file.\n\n :rtype: int"); static PyMethodDef __pyx_mdef_4ssh2_9knownhost_9KnownHost_17readfile = {"readfile", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_9knownhost_9KnownHost_17readfile, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_9knownhost_9KnownHost_16readfile}; static PyObject *__pyx_pw_4ssh2_9knownhost_9KnownHost_17readfile(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -7111,7 +7123,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_9KnownHost_18writeline, "KnownHost.writeline(self, KnownHostEntry entry, int f_type=c_ssh2.LIBSSH2_KNOWNHOST_FILE_OPENSSH, size_t buf_len=1024)\nConvert a single known host entry to a single line of output\n for writing. Only OpenSSH known hosts file format is currently\n supported.\n\n :param entry: Known host entry to write line for.\n :type entry: :py:class:`ssh2.knownhost.KnownHostEntry`\n\n :raises: :py:class:`ssh2.exceptions.KnownHostWriteLineError` on errors\n writing line.\n\n :rtype: bytes"); +PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_9KnownHost_18writeline, "writeline(self, entry: KnownHostEntry, f_type: int = c_ssh2.LIBSSH2_KNOWNHOST_FILE_OPENSSH, buf_len: int = 1024)\nConvert a single known host entry to a single line of output\n for writing. Only OpenSSH known hosts file format is currently\n supported.\n\n :param entry: Known host entry to write line for.\n :type entry: :py:class:`ssh2.knownhost.KnownHostEntry`\n\n :raises: :py:class:`ssh2.exceptions.KnownHostWriteLineError` on errors\n writing line.\n\n :rtype: bytes"); static PyMethodDef __pyx_mdef_4ssh2_9knownhost_9KnownHost_19writeline = {"writeline", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_9knownhost_9KnownHost_19writeline, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_9knownhost_9KnownHost_18writeline}; static PyObject *__pyx_pw_4ssh2_9knownhost_9KnownHost_19writeline(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -7671,7 +7683,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_9KnownHost_20writefile, "KnownHost.writefile(self, filename, int f_type=c_ssh2.LIBSSH2_KNOWNHOST_FILE_OPENSSH)\nWrite all known host entries to file. Only OpenSSH known hosts file\n format is currently supported.\n\n :param filename: File name to write known hosts to.\n :type filename: str\n\n :raises: :py:class:`ssh2.exceptions.KnownHostWriteFileError` on errors\n writing to file."); +PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_9KnownHost_20writefile, "writefile(self, filename, f_type: int = c_ssh2.LIBSSH2_KNOWNHOST_FILE_OPENSSH)\nWrite all known host entries to file. Only OpenSSH known hosts file\n format is currently supported.\n\n :param filename: File name to write known hosts to.\n :type filename: str\n\n :raises: :py:class:`ssh2.exceptions.KnownHostWriteFileError` on errors\n writing to file."); static PyMethodDef __pyx_mdef_4ssh2_9knownhost_9KnownHost_21writefile = {"writefile", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_9knownhost_9KnownHost_21writefile, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_9knownhost_9KnownHost_20writefile}; static PyObject *__pyx_pw_4ssh2_9knownhost_9KnownHost_21writefile(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -7976,7 +7988,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_9KnownHost_22get, "KnownHost.get(self, KnownHostEntry prev=None)\nRetrieve all host entries in known hosts collection.\n\n :param prev: (Optional) Existing known host entry to start retrieval\n from. All hosts are retrieved when prev is ``None`` which is the\n default.\n\n :raises: :py:class:`ssh2.exceptions.KnownHostGetError` on errors\n retrieving known host collection.\n\n :rtype: list(:py:class:`ssh2.knownhost.KnownHostEntry`)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_9KnownHost_22get, "get(self, prev: KnownHostEntry = None)\nRetrieve all host entries in known hosts collection.\n\n :param prev: (Optional) Existing known host entry to start retrieval\n from. All hosts are retrieved when prev is ``None`` which is the\n default.\n\n :raises: :py:class:`ssh2.exceptions.KnownHostGetError` on errors\n retrieving known host collection.\n\n :rtype: list(:py:class:`ssh2.knownhost.KnownHostEntry`)"); static PyMethodDef __pyx_mdef_4ssh2_9knownhost_9KnownHost_23get = {"get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_9knownhost_9KnownHost_23get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_9knownhost_9KnownHost_22get}; static PyObject *__pyx_pw_4ssh2_9knownhost_9KnownHost_23get(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -8386,7 +8398,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_9KnownHost_24__reduce_cython__, "KnownHost.__reduce_cython__(self)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_9KnownHost_24__reduce_cython__, "__reduce_cython__(self)"); static PyMethodDef __pyx_mdef_4ssh2_9knownhost_9KnownHost_25__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_9knownhost_9KnownHost_25__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_9knownhost_9KnownHost_24__reduce_cython__}; static PyObject *__pyx_pw_4ssh2_9knownhost_9KnownHost_25__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -8467,7 +8479,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_9KnownHost_26__setstate_cython__, "KnownHost.__setstate_cython__(self, __pyx_state)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_9knownhost_9KnownHost_26__setstate_cython__, "__setstate_cython__(self, __pyx_state)"); static PyMethodDef __pyx_mdef_4ssh2_9knownhost_9KnownHost_27__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_9knownhost_9KnownHost_27__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_9knownhost_9KnownHost_26__setstate_cython__}; static PyObject *__pyx_pw_4ssh2_9knownhost_9KnownHost_27__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -9418,8 +9430,8 @@ static int __Pyx_modinit_type_import_code(void) { /*--- Type import code ---*/ __pyx_t_1 = PyImport_ImportModule("ssh2.session"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_4ssh2_7session_Session = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.session", "Session", sizeof(struct __pyx_obj_4ssh2_7session_Session), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_7session_Session),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_7session_Session) __PYX_ERR(2, 19, __pyx_L1_error) - __pyx_ptype_4ssh2_7session_MethodType = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.session", "MethodType", sizeof(struct __pyx_obj_4ssh2_7session_MethodType), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_7session_MethodType),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_7session_MethodType) __PYX_ERR(2, 26, __pyx_L1_error) + __pyx_ptype_4ssh2_7session_Session = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.session", "Session", sizeof(struct __pyx_obj_4ssh2_7session_Session), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_7session_Session),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_7session_Session) __PYX_ERR(2, 19, __pyx_L1_error) + __pyx_ptype_4ssh2_7session_MethodType = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.session", "MethodType", sizeof(struct __pyx_obj_4ssh2_7session_MethodType), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_7session_MethodType),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_7session_MethodType) __PYX_ERR(2, 26, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -9447,7 +9459,7 @@ static int __Pyx_modinit_function_import_code(void) { /*--- Function import code ---*/ __pyx_t_1 = PyImport_ImportModule("ssh2.utils"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction_3_0_11(__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_3_0_12(__pyx_t_1, "to_bytes", (void (**)(void))&__pyx_f_4ssh2_5utils_to_bytes, "PyObject *(PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -12326,10 +12338,10 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { #endif /* TypeImport */ -#ifndef __PYX_HAVE_RT_ImportType_3_0_11 -#define __PYX_HAVE_RT_ImportType_3_0_11 -static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *module_name, const char *class_name, - size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size) +#ifndef __PYX_HAVE_RT_ImportType_3_0_12 +#define __PYX_HAVE_RT_ImportType_3_0_12 +static PyTypeObject *__Pyx_ImportType_3_0_12(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_12 check_size) { PyObject *result = 0; char warning[200]; @@ -12383,7 +12395,7 @@ static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *modul module_name, class_name, size, basicsize+itemsize); goto bad; } - if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_11 && + if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_12 && ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " @@ -12391,7 +12403,7 @@ static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *modul module_name, class_name, size, basicsize, basicsize+itemsize); goto bad; } - else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_11 && (size_t)basicsize > size) { + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_12 && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", @@ -13815,7 +13827,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { #include "compile.h" #include "frameobject.h" #include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif @@ -15323,9 +15335,9 @@ static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *s } /* FunctionImport */ -#ifndef __PYX_HAVE_RT_ImportFunction_3_0_11 -#define __PYX_HAVE_RT_ImportFunction_3_0_11 -static int __Pyx_ImportFunction_3_0_11(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { +#ifndef __PYX_HAVE_RT_ImportFunction_3_0_12 +#define __PYX_HAVE_RT_ImportFunction_3_0_12 +static int __Pyx_ImportFunction_3_0_12(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { PyObject *d = 0; PyObject *cobj = 0; union { diff --git a/ssh2/listener.c b/ssh2/listener.c index b66d6331..52ab9a5e 100644 --- a/ssh2/listener.c +++ b/ssh2/listener.c @@ -1,4 +1,4 @@ -/* Generated by Cython 3.0.11 */ +/* Generated by Cython 3.0.12 */ /* BEGIN: Cython Metadata { @@ -55,10 +55,10 @@ END: Cython Metadata */ #else #define __PYX_EXTRA_ABI_MODULE_NAME "" #endif -#define CYTHON_ABI "3_0_11" __PYX_EXTRA_ABI_MODULE_NAME +#define CYTHON_ABI "3_0_12" __PYX_EXTRA_ABI_MODULE_NAME #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." -#define CYTHON_HEX_VERSION 0x03000BF0 +#define CYTHON_HEX_VERSION 0x03000CF0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -1530,6 +1530,18 @@ struct __pyx_obj_4ssh2_7session_Session; struct __pyx_obj_4ssh2_7session_MethodType; struct __pyx_obj_4ssh2_7channel_Channel; struct __pyx_obj_4ssh2_8listener_Listener; +struct __pyx_ctuple_int__and_int; +typedef struct __pyx_ctuple_int__and_int __pyx_ctuple_int__and_int; + +/* "utils.pxd":24 + * cdef object to_str_len(char *c_str, int length) + * cpdef int handle_error_codes(int errcode) except -1 + * cpdef (int, int) find_eol(bytes buf: bytes, Py_ssize_t pos: Py_ssize_t) # <<<<<<<<<<<<<< + */ +struct __pyx_ctuple_int__and_int { + int f0; + int f1; +}; /* "session.pxd":19 * from . cimport c_ssh2 @@ -1844,7 +1856,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #if !CYTHON_VECTORCALL #if PY_VERSION_HEX >= 0x03080000 #include "frameobject.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif @@ -1920,22 +1932,22 @@ static int __Pyx_setup_reduce(PyObject* type_obj); #endif /* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_11 -#define __PYX_HAVE_RT_ImportType_proto_3_0_11 +#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_12 +#define __PYX_HAVE_RT_ImportType_proto_3_0_12 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #include #endif #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L -#define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) alignof(s) +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_12(s) alignof(s) #else -#define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) sizeof(void*) +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_12(s) sizeof(void*) #endif -enum __Pyx_ImportType_CheckSize_3_0_11 { - __Pyx_ImportType_CheckSize_Error_3_0_11 = 0, - __Pyx_ImportType_CheckSize_Warn_3_0_11 = 1, - __Pyx_ImportType_CheckSize_Ignore_3_0_11 = 2 +enum __Pyx_ImportType_CheckSize_3_0_12 { + __Pyx_ImportType_CheckSize_Error_3_0_12 = 0, + __Pyx_ImportType_CheckSize_Warn_3_0_12 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_0_12 = 2 }; -static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size); +static PyTypeObject *__Pyx_ImportType_3_0_12(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_12 check_size); #endif /* FetchSharedCythonModule.proto */ @@ -2187,7 +2199,7 @@ static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig); /* FunctionImport.proto */ -static int __Pyx_ImportFunction_3_0_11(PyObject *module, const char *funcname, void (**f)(void), const char *sig); +static int __Pyx_ImportFunction_3_0_12(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); @@ -2835,7 +2847,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_8listener_8Listener_2forward_accept, "Listener.forward_accept(self)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_8listener_8Listener_2forward_accept, "forward_accept(self)"); static PyMethodDef __pyx_mdef_4ssh2_8listener_8Listener_3forward_accept = {"forward_accept", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_8listener_8Listener_3forward_accept, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_8listener_8Listener_2forward_accept}; static PyObject *__pyx_pw_4ssh2_8listener_8Listener_3forward_accept(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -3030,7 +3042,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_8listener_8Listener_4forward_cancel, "Listener.forward_cancel(self)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_8listener_8Listener_4forward_cancel, "forward_cancel(self)"); static PyMethodDef __pyx_mdef_4ssh2_8listener_8Listener_5forward_cancel = {"forward_cancel", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_8listener_8Listener_5forward_cancel, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_8listener_8Listener_4forward_cancel}; static PyObject *__pyx_pw_4ssh2_8listener_8Listener_5forward_cancel(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -3166,7 +3178,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_8listener_8Listener_6__reduce_cython__, "Listener.__reduce_cython__(self)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_8listener_8Listener_6__reduce_cython__, "__reduce_cython__(self)"); static PyMethodDef __pyx_mdef_4ssh2_8listener_8Listener_7__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_8listener_8Listener_7__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_8listener_8Listener_6__reduce_cython__}; static PyObject *__pyx_pw_4ssh2_8listener_8Listener_7__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -3247,7 +3259,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_8listener_8Listener_8__setstate_cython__, "Listener.__setstate_cython__(self, __pyx_state)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_8listener_8Listener_8__setstate_cython__, "__setstate_cython__(self, __pyx_state)"); static PyMethodDef __pyx_mdef_4ssh2_8listener_8Listener_9__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_8listener_8Listener_9__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_8listener_8Listener_8__setstate_cython__}; static PyObject *__pyx_pw_4ssh2_8listener_8Listener_9__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -3758,12 +3770,12 @@ static int __Pyx_modinit_type_import_code(void) { /*--- Type import code ---*/ __pyx_t_1 = PyImport_ImportModule("ssh2.session"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_4ssh2_7session_Session = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.session", "Session", sizeof(struct __pyx_obj_4ssh2_7session_Session), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_7session_Session),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_7session_Session) __PYX_ERR(2, 19, __pyx_L1_error) - __pyx_ptype_4ssh2_7session_MethodType = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.session", "MethodType", sizeof(struct __pyx_obj_4ssh2_7session_MethodType), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_7session_MethodType),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_7session_MethodType) __PYX_ERR(2, 26, __pyx_L1_error) + __pyx_ptype_4ssh2_7session_Session = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.session", "Session", sizeof(struct __pyx_obj_4ssh2_7session_Session), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_7session_Session),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_7session_Session) __PYX_ERR(2, 19, __pyx_L1_error) + __pyx_ptype_4ssh2_7session_MethodType = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.session", "MethodType", sizeof(struct __pyx_obj_4ssh2_7session_MethodType), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_7session_MethodType),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_7session_MethodType) __PYX_ERR(2, 26, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyImport_ImportModule("ssh2.channel"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_4ssh2_7channel_Channel = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.channel", "Channel", sizeof(struct __pyx_obj_4ssh2_7channel_Channel), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_7channel_Channel),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_7channel_Channel) __PYX_ERR(3, 24, __pyx_L1_error) + __pyx_ptype_4ssh2_7channel_Channel = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.channel", "Channel", sizeof(struct __pyx_obj_4ssh2_7channel_Channel), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_7channel_Channel),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_7channel_Channel) __PYX_ERR(3, 24, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -3791,11 +3803,11 @@ static int __Pyx_modinit_function_import_code(void) { /*--- Function import code ---*/ __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_3_0_11(__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) + if (__Pyx_ImportFunction_3_0_12(__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.utils"); if (!__pyx_t_1) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction_3_0_11(__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) + if (__Pyx_ImportFunction_3_0_12(__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_RefNannyFinishContext(); return 0; @@ -5834,10 +5846,10 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { #endif /* TypeImport */ -#ifndef __PYX_HAVE_RT_ImportType_3_0_11 -#define __PYX_HAVE_RT_ImportType_3_0_11 -static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *module_name, const char *class_name, - size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size) +#ifndef __PYX_HAVE_RT_ImportType_3_0_12 +#define __PYX_HAVE_RT_ImportType_3_0_12 +static PyTypeObject *__Pyx_ImportType_3_0_12(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_12 check_size) { PyObject *result = 0; char warning[200]; @@ -5891,7 +5903,7 @@ static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *modul module_name, class_name, size, basicsize+itemsize); goto bad; } - if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_11 && + if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_12 && ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " @@ -5899,7 +5911,7 @@ static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *modul module_name, class_name, size, basicsize, basicsize+itemsize); goto bad; } - else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_11 && (size_t)basicsize > size) { + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_12 && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", @@ -7248,7 +7260,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { #include "compile.h" #include "frameobject.h" #include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif @@ -8347,9 +8359,9 @@ static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *s } /* FunctionImport */ -#ifndef __PYX_HAVE_RT_ImportFunction_3_0_11 -#define __PYX_HAVE_RT_ImportFunction_3_0_11 -static int __Pyx_ImportFunction_3_0_11(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { +#ifndef __PYX_HAVE_RT_ImportFunction_3_0_12 +#define __PYX_HAVE_RT_ImportFunction_3_0_12 +static int __Pyx_ImportFunction_3_0_12(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { PyObject *d = 0; PyObject *cobj = 0; union { diff --git a/ssh2/pkey.c b/ssh2/pkey.c index 085c5a9f..b0c1abd7 100644 --- a/ssh2/pkey.c +++ b/ssh2/pkey.c @@ -1,4 +1,4 @@ -/* Generated by Cython 3.0.11 */ +/* Generated by Cython 3.0.12 */ /* BEGIN: Cython Metadata { @@ -51,10 +51,10 @@ END: Cython Metadata */ #else #define __PYX_EXTRA_ABI_MODULE_NAME "" #endif -#define CYTHON_ABI "3_0_11" __PYX_EXTRA_ABI_MODULE_NAME +#define CYTHON_ABI "3_0_12" __PYX_EXTRA_ABI_MODULE_NAME #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." -#define CYTHON_HEX_VERSION 0x03000BF0 +#define CYTHON_HEX_VERSION 0x03000CF0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -1777,7 +1777,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #if !CYTHON_VECTORCALL #if PY_VERSION_HEX >= 0x03080000 #include "frameobject.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif @@ -2564,7 +2564,7 @@ static int __pyx_pf_4ssh2_4pkey_9PublicKey___cinit__(struct __pyx_obj_4ssh2_4pke * self._pkey = NULL * * @property # <<<<<<<<<<<<<< - * def blob(self): + * def blob(self) -> bytes: * """Blob of public key data. */ @@ -2641,7 +2641,7 @@ static PyObject *__pyx_pf_4ssh2_4pkey_9PublicKey_4blob___get__(struct __pyx_obj_ * self._pkey = NULL * * @property # <<<<<<<<<<<<<< - * def blob(self): + * def blob(self) -> bytes: * """Blob of public key data. */ @@ -2660,7 +2660,7 @@ static PyObject *__pyx_pf_4ssh2_4pkey_9PublicKey_4blob___get__(struct __pyx_obj_ * return self._pkey.blob[:self._pkey.blob_len] * * @property # <<<<<<<<<<<<<< - * def magic(self): + * def magic(self) -> int: * """Magic number of public key. */ @@ -2737,7 +2737,7 @@ static PyObject *__pyx_pf_4ssh2_4pkey_9PublicKey_5magic___get__(struct __pyx_obj * return self._pkey.blob[:self._pkey.blob_len] * * @property # <<<<<<<<<<<<<< - * def magic(self): + * def magic(self) -> int: * """Magic number of public key. */ @@ -2955,7 +2955,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_4pkey_9PublicKey_2__reduce_cython__, "PublicKey.__reduce_cython__(self)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_4pkey_9PublicKey_2__reduce_cython__, "__reduce_cython__(self)"); static PyMethodDef __pyx_mdef_4ssh2_4pkey_9PublicKey_3__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_4pkey_9PublicKey_3__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_4pkey_9PublicKey_2__reduce_cython__}; static PyObject *__pyx_pw_4ssh2_4pkey_9PublicKey_3__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -3036,7 +3036,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_4pkey_9PublicKey_4__setstate_cython__, "PublicKey.__setstate_cython__(self, __pyx_state)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_4pkey_9PublicKey_4__setstate_cython__, "__setstate_cython__(self, __pyx_state)"); static PyMethodDef __pyx_mdef_4ssh2_4pkey_9PublicKey_5__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_4pkey_9PublicKey_5__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_4pkey_9PublicKey_4__setstate_cython__}; static PyObject *__pyx_pw_4ssh2_4pkey_9PublicKey_5__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -3218,8 +3218,8 @@ static PyMethodDef __pyx_methods_4ssh2_4pkey_PublicKey[] = { }; static struct PyGetSetDef __pyx_getsets_4ssh2_4pkey_PublicKey[] = { - {(char *)"blob", __pyx_getprop_4ssh2_4pkey_9PublicKey_blob, 0, (char *)PyDoc_STR("Blob of public key data.\n\n :rtype: bytes\n "), 0}, - {(char *)"magic", __pyx_getprop_4ssh2_4pkey_9PublicKey_magic, 0, (char *)PyDoc_STR("Magic number of public key.\n\n :rtype: int\n "), 0}, + {(char *)"blob", __pyx_getprop_4ssh2_4pkey_9PublicKey_blob, 0, (char *)PyDoc_STR("blob: bytes\nBlob of public key data.\n\n :rtype: bytes\n "), 0}, + {(char *)"magic", __pyx_getprop_4ssh2_4pkey_9PublicKey_magic, 0, (char *)PyDoc_STR("magic: int\nMagic number of public key.\n\n :rtype: int\n "), 0}, {(char *)"blob_len", __pyx_getprop_4ssh2_4pkey_9PublicKey_blob_len, 0, (char *)PyDoc_STR("Blob length of public key.\n\n :rtype: int\n "), 0}, {(char *)"comment", __pyx_getprop_4ssh2_4pkey_9PublicKey_comment, 0, (char *)PyDoc_STR("Public key comment\n\n :rtype: bytes\n "), 0}, {0, 0, 0, 0, 0} @@ -6837,7 +6837,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { #include "compile.h" #include "frameobject.h" #include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif diff --git a/ssh2/pkey.pyi b/ssh2/pkey.pyi new file mode 100644 index 00000000..3c9f1bc9 --- /dev/null +++ b/ssh2/pkey.pyi @@ -0,0 +1,15 @@ +# Generated with `python conf/mpistubgen.py` +import sys +from threading import Lock +from typing import ( + Any, + Final, +) + +class PublicKey: + @property + def blob(self): ... + + @property + def magic(self): ... + diff --git a/ssh2/pkey.pyx b/ssh2/pkey.pyx index 2004115b..e7e6f698 100644 --- a/ssh2/pkey.pyx +++ b/ssh2/pkey.pyx @@ -32,7 +32,7 @@ cdef class PublicKey: self._pkey = NULL @property - def blob(self): + def blob(self) -> bytes: """Blob of public key data. :rtype: bytes @@ -42,7 +42,7 @@ cdef class PublicKey: return self._pkey.blob[:self._pkey.blob_len] @property - def magic(self): + def magic(self) -> int: """Magic number of public key. :rtype: int diff --git a/ssh2/publickey.c b/ssh2/publickey.c index 6b0e7d50..abda94df 100644 --- a/ssh2/publickey.c +++ b/ssh2/publickey.c @@ -1,4 +1,4 @@ -/* Generated by Cython 3.0.11 */ +/* Generated by Cython 3.0.12 */ /* BEGIN: Cython Metadata { @@ -55,10 +55,10 @@ END: Cython Metadata */ #else #define __PYX_EXTRA_ABI_MODULE_NAME "" #endif -#define CYTHON_ABI "3_0_11" __PYX_EXTRA_ABI_MODULE_NAME +#define CYTHON_ABI "3_0_12" __PYX_EXTRA_ABI_MODULE_NAME #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." -#define CYTHON_HEX_VERSION 0x03000BF0 +#define CYTHON_HEX_VERSION 0x03000CF0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -1533,6 +1533,18 @@ struct __pyx_obj_4ssh2_7session_MethodType; struct __pyx_obj_4ssh2_9publickey_PublicKeyList; struct __pyx_obj_4ssh2_9publickey_PublicKeyAttribute; struct __pyx_obj_4ssh2_9publickey_PublicKeySystem; +struct __pyx_ctuple_int__and_int; +typedef struct __pyx_ctuple_int__and_int __pyx_ctuple_int__and_int; + +/* "utils.pxd":24 + * cdef object to_str_len(char *c_str, int length) + * cpdef int handle_error_codes(int errcode) except -1 + * cpdef (int, int) find_eol(bytes buf: bytes, Py_ssize_t pos: Py_ssize_t) # <<<<<<<<<<<<<< + */ +struct __pyx_ctuple_int__and_int { + int f0; + int f1; +}; /* "session.pxd":19 * from . cimport c_ssh2 @@ -1923,7 +1935,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #if !CYTHON_VECTORCALL #if PY_VERSION_HEX >= 0x03080000 #include "frameobject.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif @@ -1992,22 +2004,22 @@ static int __Pyx_setup_reduce(PyObject* type_obj); #endif /* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_11 -#define __PYX_HAVE_RT_ImportType_proto_3_0_11 +#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_12 +#define __PYX_HAVE_RT_ImportType_proto_3_0_12 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #include #endif #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L -#define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) alignof(s) +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_12(s) alignof(s) #else -#define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) sizeof(void*) +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_12(s) sizeof(void*) #endif -enum __Pyx_ImportType_CheckSize_3_0_11 { - __Pyx_ImportType_CheckSize_Error_3_0_11 = 0, - __Pyx_ImportType_CheckSize_Warn_3_0_11 = 1, - __Pyx_ImportType_CheckSize_Ignore_3_0_11 = 2 +enum __Pyx_ImportType_CheckSize_3_0_12 { + __Pyx_ImportType_CheckSize_Error_3_0_12 = 0, + __Pyx_ImportType_CheckSize_Warn_3_0_12 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_0_12 = 2 }; -static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size); +static PyTypeObject *__Pyx_ImportType_3_0_12(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_12 check_size); #endif /* FetchSharedCythonModule.proto */ @@ -2277,7 +2289,7 @@ static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig); /* FunctionImport.proto */ -static int __Pyx_ImportFunction_3_0_11(PyObject *module, const char *funcname, void (**f)(void), const char *sig); +static int __Pyx_ImportFunction_3_0_12(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); @@ -4247,7 +4259,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_9publickey_13PublicKeyList_4__reduce_cython__, "PublicKeyList.__reduce_cython__(self)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_9publickey_13PublicKeyList_4__reduce_cython__, "__reduce_cython__(self)"); static PyMethodDef __pyx_mdef_4ssh2_9publickey_13PublicKeyList_5__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_9publickey_13PublicKeyList_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_9publickey_13PublicKeyList_4__reduce_cython__}; static PyObject *__pyx_pw_4ssh2_9publickey_13PublicKeyList_5__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -4328,7 +4340,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_9publickey_13PublicKeyList_6__setstate_cython__, "PublicKeyList.__setstate_cython__(self, __pyx_state)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_9publickey_13PublicKeyList_6__setstate_cython__, "__setstate_cython__(self, __pyx_state)"); static PyMethodDef __pyx_mdef_4ssh2_9publickey_13PublicKeyList_7__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_9publickey_13PublicKeyList_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_9publickey_13PublicKeyList_6__setstate_cython__}; static PyObject *__pyx_pw_4ssh2_9publickey_13PublicKeyList_7__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -5020,7 +5032,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_9publickey_18PublicKeyAttribute_2__reduce_cython__, "PublicKeyAttribute.__reduce_cython__(self)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_9publickey_18PublicKeyAttribute_2__reduce_cython__, "__reduce_cython__(self)"); static PyMethodDef __pyx_mdef_4ssh2_9publickey_18PublicKeyAttribute_3__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_9publickey_18PublicKeyAttribute_3__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_9publickey_18PublicKeyAttribute_2__reduce_cython__}; static PyObject *__pyx_pw_4ssh2_9publickey_18PublicKeyAttribute_3__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -5101,7 +5113,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_9publickey_18PublicKeyAttribute_4__setstate_cython__, "PublicKeyAttribute.__setstate_cython__(self, __pyx_state)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_9publickey_18PublicKeyAttribute_4__setstate_cython__, "__setstate_cython__(self, __pyx_state)"); static PyMethodDef __pyx_mdef_4ssh2_9publickey_18PublicKeyAttribute_5__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_9publickey_18PublicKeyAttribute_5__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_9publickey_18PublicKeyAttribute_4__setstate_cython__}; static PyObject *__pyx_pw_4ssh2_9publickey_18PublicKeyAttribute_5__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -5828,7 +5840,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_9publickey_15PublicKeySystem_4add, "PublicKeySystem.add(self, bytes name, bytes blob, char overwrite, list attrs)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_9publickey_15PublicKeySystem_4add, "add(self, name: bytes, blob: bytes, overwrite: int, attrs: list)"); static PyMethodDef __pyx_mdef_4ssh2_9publickey_15PublicKeySystem_5add = {"add", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_9publickey_15PublicKeySystem_5add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_9publickey_15PublicKeySystem_4add}; static PyObject *__pyx_pw_4ssh2_9publickey_15PublicKeySystem_5add(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6222,7 +6234,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_9publickey_15PublicKeySystem_6remove, "PublicKeySystem.remove(self, bytes name, bytes blob)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_9publickey_15PublicKeySystem_6remove, "remove(self, name: bytes, blob: bytes)"); static PyMethodDef __pyx_mdef_4ssh2_9publickey_15PublicKeySystem_7remove = {"remove", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_9publickey_15PublicKeySystem_7remove, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_9publickey_15PublicKeySystem_6remove}; static PyObject *__pyx_pw_4ssh2_9publickey_15PublicKeySystem_7remove(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6501,7 +6513,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_9publickey_15PublicKeySystem_8list_fetch, "PublicKeySystem.list_fetch(self)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_9publickey_15PublicKeySystem_8list_fetch, "list_fetch(self)"); static PyMethodDef __pyx_mdef_4ssh2_9publickey_15PublicKeySystem_9list_fetch = {"list_fetch", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_9publickey_15PublicKeySystem_9list_fetch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_9publickey_15PublicKeySystem_8list_fetch}; static PyObject *__pyx_pw_4ssh2_9publickey_15PublicKeySystem_9list_fetch(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6757,7 +6769,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_9publickey_15PublicKeySystem_10list_free, "PublicKeySystem.list_free(self)\nNo-op - list_free called automatically by\n :py:class:`ssh2.publickey.PublicKeyList` destructor"); +PyDoc_STRVAR(__pyx_doc_4ssh2_9publickey_15PublicKeySystem_10list_free, "list_free(self)\nNo-op - list_free called automatically by\n :py:class:`ssh2.publickey.PublicKeyList` destructor"); static PyMethodDef __pyx_mdef_4ssh2_9publickey_15PublicKeySystem_11list_free = {"list_free", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_9publickey_15PublicKeySystem_11list_free, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_9publickey_15PublicKeySystem_10list_free}; static PyObject *__pyx_pw_4ssh2_9publickey_15PublicKeySystem_11list_free(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6819,7 +6831,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_9publickey_15PublicKeySystem_12shutdown, "PublicKeySystem.shutdown(self)\nShutdown public key subsystem.\n Called automatically by object destructor"); +PyDoc_STRVAR(__pyx_doc_4ssh2_9publickey_15PublicKeySystem_12shutdown, "shutdown(self)\nShutdown public key subsystem.\n Called automatically by object destructor"); static PyMethodDef __pyx_mdef_4ssh2_9publickey_15PublicKeySystem_13shutdown = {"shutdown", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_9publickey_15PublicKeySystem_13shutdown, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_9publickey_15PublicKeySystem_12shutdown}; static PyObject *__pyx_pw_4ssh2_9publickey_15PublicKeySystem_13shutdown(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6954,7 +6966,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_9publickey_15PublicKeySystem_14__reduce_cython__, "PublicKeySystem.__reduce_cython__(self)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_9publickey_15PublicKeySystem_14__reduce_cython__, "__reduce_cython__(self)"); static PyMethodDef __pyx_mdef_4ssh2_9publickey_15PublicKeySystem_15__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_9publickey_15PublicKeySystem_15__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_9publickey_15PublicKeySystem_14__reduce_cython__}; static PyObject *__pyx_pw_4ssh2_9publickey_15PublicKeySystem_15__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -7035,7 +7047,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_9publickey_15PublicKeySystem_16__setstate_cython__, "PublicKeySystem.__setstate_cython__(self, __pyx_state)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_9publickey_15PublicKeySystem_16__setstate_cython__, "__setstate_cython__(self, __pyx_state)"); static PyMethodDef __pyx_mdef_4ssh2_9publickey_15PublicKeySystem_17__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_9publickey_15PublicKeySystem_17__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_9publickey_15PublicKeySystem_16__setstate_cython__}; static PyObject *__pyx_pw_4ssh2_9publickey_15PublicKeySystem_17__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -8149,8 +8161,8 @@ static int __Pyx_modinit_type_import_code(void) { /*--- Type import code ---*/ __pyx_t_1 = PyImport_ImportModule("ssh2.session"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_4ssh2_7session_Session = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.session", "Session", sizeof(struct __pyx_obj_4ssh2_7session_Session), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_7session_Session),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_7session_Session) __PYX_ERR(2, 19, __pyx_L1_error) - __pyx_ptype_4ssh2_7session_MethodType = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.session", "MethodType", sizeof(struct __pyx_obj_4ssh2_7session_MethodType), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_7session_MethodType),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_7session_MethodType) __PYX_ERR(2, 26, __pyx_L1_error) + __pyx_ptype_4ssh2_7session_Session = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.session", "Session", sizeof(struct __pyx_obj_4ssh2_7session_Session), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_7session_Session),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_7session_Session) __PYX_ERR(2, 19, __pyx_L1_error) + __pyx_ptype_4ssh2_7session_MethodType = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.session", "MethodType", sizeof(struct __pyx_obj_4ssh2_7session_MethodType), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_7session_MethodType),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_7session_MethodType) __PYX_ERR(2, 26, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -8178,8 +8190,8 @@ static int __Pyx_modinit_function_import_code(void) { /*--- Function import code ---*/ __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_3_0_11(__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_3_0_11(__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) + if (__Pyx_ImportFunction_3_0_12(__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_3_0_12(__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_RefNannyFinishContext(); return 0; @@ -10500,10 +10512,10 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { #endif /* TypeImport */ -#ifndef __PYX_HAVE_RT_ImportType_3_0_11 -#define __PYX_HAVE_RT_ImportType_3_0_11 -static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *module_name, const char *class_name, - size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size) +#ifndef __PYX_HAVE_RT_ImportType_3_0_12 +#define __PYX_HAVE_RT_ImportType_3_0_12 +static PyTypeObject *__Pyx_ImportType_3_0_12(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_12 check_size) { PyObject *result = 0; char warning[200]; @@ -10557,7 +10569,7 @@ static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *modul module_name, class_name, size, basicsize+itemsize); goto bad; } - if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_11 && + if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_12 && ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " @@ -10565,7 +10577,7 @@ static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *modul module_name, class_name, size, basicsize, basicsize+itemsize); goto bad; } - else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_11 && (size_t)basicsize > size) { + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_12 && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", @@ -11914,7 +11926,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { #include "compile.h" #include "frameobject.h" #include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif @@ -13967,9 +13979,9 @@ static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *s } /* FunctionImport */ -#ifndef __PYX_HAVE_RT_ImportFunction_3_0_11 -#define __PYX_HAVE_RT_ImportFunction_3_0_11 -static int __Pyx_ImportFunction_3_0_11(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { +#ifndef __PYX_HAVE_RT_ImportFunction_3_0_12 +#define __PYX_HAVE_RT_ImportFunction_3_0_12 +static int __Pyx_ImportFunction_3_0_12(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { PyObject *d = 0; PyObject *cobj = 0; union { diff --git a/ssh2/py.typed b/ssh2/py.typed new file mode 100644 index 00000000..e69de29b diff --git a/ssh2/session.c b/ssh2/session.c index 376bfd45..deb558f3 100644 --- a/ssh2/session.c +++ b/ssh2/session.c @@ -1,4 +1,4 @@ -/* Generated by Cython 3.0.11 */ +/* Generated by Cython 3.0.12 */ /* BEGIN: Cython Metadata { @@ -72,10 +72,10 @@ END: Cython Metadata */ #else #define __PYX_EXTRA_ABI_MODULE_NAME "" #endif -#define CYTHON_ABI "3_0_11" __PYX_EXTRA_ABI_MODULE_NAME +#define CYTHON_ABI "3_0_12" __PYX_EXTRA_ABI_MODULE_NAME #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." -#define CYTHON_HEX_VERSION 0x03000BF0 +#define CYTHON_HEX_VERSION 0x03000CF0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -1528,10 +1528,10 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { "", "ssh2/session.pyx", - "env/lib/python3.12/site-packages/Cython/Includes/cpython/contextvars.pxd", - "env/lib/python3.12/site-packages/Cython/Includes/cpython/type.pxd", - "env/lib/python3.12/site-packages/Cython/Includes/cpython/bool.pxd", - "env/lib/python3.12/site-packages/Cython/Includes/cpython/complex.pxd", + "contextvars.pxd", + "type.pxd", + "bool.pxd", + "complex.pxd", "ssh2/agent.pxd", "ssh2/channel.pxd", "ssh2/listener.pxd", @@ -1595,6 +1595,18 @@ struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default { int __pyx_n; PyObject *default_value; }; +struct __pyx_ctuple_int__and_int; +typedef struct __pyx_ctuple_int__and_int __pyx_ctuple_int__and_int; + +/* "utils.pxd":24 + * cdef object to_str_len(char *c_str, int length) + * cpdef int handle_error_codes(int errcode) except -1 + * cpdef (int, int) find_eol(bytes buf: bytes, Py_ssize_t pos: Py_ssize_t) # <<<<<<<<<<<<<< + */ +struct __pyx_ctuple_int__and_int { + int f0; + int f1; +}; /* "agent.pxd":24 * @@ -1733,11 +1745,11 @@ struct __pyx_obj_4ssh2_7session_MethodType { }; -/* "ssh2/session.pyx":311 +/* "ssh2/session.pyx":321 * return handle_error_codes(rc) * - * def userauth_keyboardinteractive(self, username not None, # <<<<<<<<<<<<<< - * password not None): + * def userauth_keyboardinteractive(self, username not None: AnyStr, # <<<<<<<<<<<<<< + * password not None: AnyStr) -> int: * """Perform keyboard-interactive authentication */ struct __pyx_obj_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive { @@ -1989,7 +2001,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #if !CYTHON_VECTORCALL #if PY_VERSION_HEX >= 0x03080000 #include "frameobject.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif @@ -2325,22 +2337,22 @@ static int __Pyx_setup_reduce(PyObject* type_obj); #endif /* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_11 -#define __PYX_HAVE_RT_ImportType_proto_3_0_11 +#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_12 +#define __PYX_HAVE_RT_ImportType_proto_3_0_12 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #include #endif #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L -#define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) alignof(s) +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_12(s) alignof(s) #else -#define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) sizeof(void*) +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_12(s) sizeof(void*) #endif -enum __Pyx_ImportType_CheckSize_3_0_11 { - __Pyx_ImportType_CheckSize_Error_3_0_11 = 0, - __Pyx_ImportType_CheckSize_Warn_3_0_11 = 1, - __Pyx_ImportType_CheckSize_Ignore_3_0_11 = 2 +enum __Pyx_ImportType_CheckSize_3_0_12 { + __Pyx_ImportType_CheckSize_Error_3_0_12 = 0, + __Pyx_ImportType_CheckSize_Warn_3_0_12 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_0_12 = 2 }; -static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size); +static PyTypeObject *__Pyx_ImportType_3_0_12(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_12 check_size); #endif /* Import.proto */ @@ -2444,7 +2456,7 @@ static unsigned long __Pyx_get_runtime_version(void); static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer); /* FunctionImport.proto */ -static int __Pyx_ImportFunction_3_0_11(PyObject *module, const char *funcname, void (**f)(void), const char *sig); +static int __Pyx_ImportFunction_3_0_12(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); @@ -2603,11 +2615,18 @@ static const char __pyx_k__2[] = ""; static const char __pyx_k__4[] = "."; static const char __pyx_k_gc[] = "gc"; static const char __pyx_k_rc[] = "rc"; +static const char __pyx_k_Any[] = "Any"; static const char __pyx_k__89[] = "?"; +static const char __pyx_k_int[] = "int"; static const char __pyx_k_key[] = "key"; static const char __pyx_k_msg[] = "msg"; +static const char __pyx_k_str[] = "str"; +static const char __pyx_k_List[] = "List"; +static const char __pyx_k_None[] = "None"; +static const char __pyx_k_SFTP[] = "'SFTP'"; static const char __pyx_k_algs[] = "algs"; static const char __pyx_k_auth[] = "_auth"; +static const char __pyx_k_bool[] = "bool"; static const char __pyx_k_hash[] = "_hash"; static const char __pyx_k_host[] = "host"; static const char __pyx_k_main[] = "__main__"; @@ -2622,8 +2641,11 @@ static const char __pyx_k_sftp[] = "_sftp"; static const char __pyx_k_size[] = "size"; static const char __pyx_k_sock[] = "sock"; static const char __pyx_k_test[] = "__test__"; +static const char __pyx_k_Agent[] = "'Agent'"; +static const char __pyx_k_Tuple[] = "Tuple"; static const char __pyx_k_agent[] = "agent"; static const char __pyx_k_atime[] = "atime"; +static const char __pyx_k_bytes[] = "bytes"; static const char __pyx_k_key_2[] = "_key"; static const char __pyx_k_mtime[] = "mtime"; static const char __pyx_k_prefs[] = "prefs"; @@ -2631,6 +2653,7 @@ static const char __pyx_k_range[] = "range"; static const char __pyx_k_shost[] = "shost"; static const char __pyx_k_sport[] = "sport"; static const char __pyx_k_value[] = "value"; +static const char __pyx_k_AnyStr[] = "AnyStr"; static const char __pyx_k_auth_2[] = "auth"; static const char __pyx_k_b_hash[] = "b_hash"; static const char __pyx_k_b_host[] = "b_host"; @@ -2643,7 +2666,10 @@ static const char __pyx_k_import[] = "__import__"; static const char __pyx_k_passwd[] = "passwd"; static const char __pyx_k_path_2[] = "_path"; static const char __pyx_k_reduce[] = "__reduce__"; +static const char __pyx_k_return[] = "return"; static const char __pyx_k_sock_2[] = "_sock"; +static const char __pyx_k_typing[] = "typing"; +static const char __pyx_k_Channel[] = "'Channel'"; static const char __pyx_k_Session[] = "Session"; static const char __pyx_k_b_prefs[] = "b_prefs"; static const char __pyx_k_b_shost[] = "b_shost"; @@ -2658,6 +2684,8 @@ static const char __pyx_k_seconds[] = "seconds"; static const char __pyx_k_shost_2[] = "_shost"; static const char __pyx_k_startup[] = "startup"; static const char __pyx_k_timeout[] = "timeout"; +static const char __pyx_k_BinaryIO[] = "BinaryIO"; +static const char __pyx_k_List_str[] = "List[str]"; static const char __pyx_k_b_errmsg[] = "b_errmsg"; static const char __pyx_k_blocking[] = "blocking"; static const char __pyx_k_errmsg_2[] = "_errmsg"; @@ -2675,6 +2703,7 @@ static const char __pyx_k_scp_send[] = "scp_send"; static const char __pyx_k_setstate[] = "__setstate__"; static const char __pyx_k_statinfo[] = "statinfo"; static const char __pyx_k_username[] = "username"; +static const char __pyx_k_KnownHost[] = "'KnownHost'"; static const char __pyx_k_TypeError[] = "TypeError"; static const char __pyx_k_c_seconds[] = "c_seconds"; static const char __pyx_k_error_msg[] = "_error_msg"; @@ -2693,6 +2722,7 @@ static const char __pyx_k_b_hostname[] = "b_hostname"; static const char __pyx_k_b_password[] = "b_password"; static const char __pyx_k_b_username[] = "b_username"; static const char __pyx_k_bound_port[] = "bound_port"; +static const char __pyx_k_bytes_None[] = "bytes | None"; static const char __pyx_k_disconnect[] = "disconnect"; static const char __pyx_k_errmsg_len[] = "errmsg_len"; static const char __pyx_k_exceptions[] = "exceptions"; @@ -2706,6 +2736,7 @@ static const char __pyx_k_pubkeydata[] = "pubkeydata"; static const char __pyx_k_scp_send64[] = "scp_send64"; static const char __pyx_k_username_2[] = "_username"; static const char __pyx_k_want_reply[] = "want_reply"; +static const char __pyx_k_AnyStr_None[] = "AnyStr | None"; static const char __pyx_k_MemoryError[] = "MemoryError"; static const char __pyx_k_b_publickey[] = "b_publickey"; static const char __pyx_k_get_timeout[] = "get_timeout"; @@ -2715,6 +2746,7 @@ static const char __pyx_k_method_type[] = "method_type"; static const char __pyx_k_publickey_2[] = "_publickey"; static const char __pyx_k_set_timeout[] = "set_timeout"; static const char __pyx_k_ChannelError[] = "ChannelError"; +static const char __pyx_k_Channel_None[] = "'Channel' | None"; static const char __pyx_k_b_passphrase[] = "b_passphrase"; static const char __pyx_k_b_privatekey[] = "b_privatekey"; static const char __pyx_k_direct_tcpip[] = "direct_tcpip"; @@ -2729,6 +2761,7 @@ static const char __pyx_k_set_blocking[] = "set_blocking"; static const char __pyx_k_ssh2_session[] = "ssh2.session"; static const char __pyx_k_stringsource[] = ""; static const char __pyx_k_username_len[] = "username_len"; +static const char __pyx_k_Listener_None[] = "'Listener' | None"; static const char __pyx_k_queue_maxsize[] = "queue_maxsize"; static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; static const char __pyx_k_userauth_list[] = "userauth_list"; @@ -2740,9 +2773,11 @@ static const char __pyx_k_pubkeydata_len[] = "pubkeydata_len"; static const char __pyx_k_publickey_init[] = "publickey_init"; static const char __pyx_k_set_last_error[] = "set_last_error"; static const char __pyx_k_supported_algs[] = "supported_algs"; +static const char __pyx_k_PublicKeySystem[] = "'PublicKeySystem'"; static const char __pyx_k_Session_hostkey[] = "Session.hostkey"; static const char __pyx_k_Session_methods[] = "Session.methods"; static const char __pyx_k_Session_startup[] = "Session.startup"; +static const char __pyx_k_Tuple_bytes_int[] = "Tuple[bytes, int]"; static const char __pyx_k_direct_tcpip_ex[] = "direct_tcpip_ex"; static const char __pyx_k_setstate_cython[] = "__setstate_cython__"; static const char __pyx_k_Session_scp_recv[] = "Session.scp_recv"; @@ -2799,6 +2834,7 @@ 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_Session___reduce_cython[] = "Session.__reduce_cython__"; static const char __pyx_k_Session_direct_tcpip_ex[] = "Session.direct_tcpip_ex"; +static const char __pyx_k_Tuple_Listener_int_None[] = "Tuple['Listener', int] | None"; 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"; @@ -2811,6 +2847,7 @@ static const char __pyx_k_Session_userauth_password[] = "Session.userauth_passwo static const char __pyx_k_MethodType___reduce_cython[] = "MethodType.__reduce_cython__"; static const char __pyx_k_Session_userauth_publickey[] = "Session.userauth_publickey"; static const char __pyx_k_LIBSSH2_HOSTKEY_HASH_SHA256[] = "LIBSSH2_HOSTKEY_HASH_SHA256"; +static const char __pyx_k_Tuple_Channel_FileInfo_None[] = "Tuple['Channel', 'FileInfo'] | None"; static const char __pyx_k_userauth_hostbased_fromfile[] = "userauth_hostbased_fromfile"; static const char __pyx_k_userauth_publickey_fromfile[] = "userauth_publickey_fromfile"; static const char __pyx_k_LIBSSH2_HOSTKEY_TYPE_ED25519[] = "LIBSSH2_HOSTKEY_TYPE_ED25519"; @@ -3050,8 +3087,16 @@ typedef struct { PyTypeObject *__pyx_ptype_4ssh2_7session_MethodType; PyTypeObject *__pyx_ptype_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive; PyObject *__pyx_kp_u_; + PyObject *__pyx_kp_s_Agent; + PyObject *__pyx_n_s_Any; + PyObject *__pyx_n_s_AnyStr; + PyObject *__pyx_kp_s_AnyStr_None; + PyObject *__pyx_n_s_BinaryIO; + PyObject *__pyx_kp_s_Channel; PyObject *__pyx_n_s_ChannelError; + PyObject *__pyx_kp_s_Channel_None; PyObject *__pyx_kp_u_Error_retrieving_server_host_key; + PyObject *__pyx_kp_s_KnownHost; PyObject *__pyx_n_s_KnownHostError; PyObject *__pyx_n_s_LIBSSH2_HOSTKEY_HASH_MD5; PyObject *__pyx_n_s_LIBSSH2_HOSTKEY_HASH_SHA1; @@ -3075,11 +3120,17 @@ typedef struct { PyObject *__pyx_n_s_LIBSSH2_METHOD_MAC_SC; PyObject *__pyx_n_s_LIBSSH2_SESSION_BLOCK_INBOUND; PyObject *__pyx_n_s_LIBSSH2_SESSION_BLOCK_OUTBOUND; + PyObject *__pyx_n_s_List; + PyObject *__pyx_kp_s_List_str; + PyObject *__pyx_kp_s_Listener_None; PyObject *__pyx_n_s_MemoryError; PyObject *__pyx_n_s_MethodType; PyObject *__pyx_n_s_MethodType___reduce_cython; PyObject *__pyx_n_s_MethodType___setstate_cython; + PyObject *__pyx_n_s_None; PyObject *__pyx_n_s_PublicKeyInitError; + PyObject *__pyx_kp_s_PublicKeySystem; + PyObject *__pyx_kp_s_SFTP; PyObject *__pyx_n_s_Session; PyObject *__pyx_n_s_SessionHostKeyError; PyObject *__pyx_n_s_Session___reduce_cython; @@ -3124,6 +3175,10 @@ typedef struct { PyObject *__pyx_n_s_Session_userauth_publickey; PyObject *__pyx_n_s_Session_userauth_publickey_fromf; PyObject *__pyx_n_s_Session_userauth_publickey_fromm; + PyObject *__pyx_n_s_Tuple; + PyObject *__pyx_kp_s_Tuple_Channel_FileInfo_None; + PyObject *__pyx_kp_s_Tuple_Listener_int_None; + PyObject *__pyx_kp_s_Tuple_bytes_int; PyObject *__pyx_n_s_TypeError; PyObject *__pyx_kp_b__2; PyObject *__pyx_kp_u__2; @@ -3151,7 +3206,10 @@ typedef struct { PyObject *__pyx_n_s_b_username; PyObject *__pyx_n_s_block_directions; PyObject *__pyx_n_s_blocking; + PyObject *__pyx_n_s_bool; PyObject *__pyx_n_s_bound_port; + PyObject *__pyx_n_s_bytes; + PyObject *__pyx_kp_s_bytes_None; PyObject *__pyx_n_s_c_algs; PyObject *__pyx_n_s_c_prefs; PyObject *__pyx_n_s_c_seconds; @@ -3187,6 +3245,7 @@ typedef struct { PyObject *__pyx_n_s_i; PyObject *__pyx_n_s_identity; PyObject *__pyx_n_s_import; + PyObject *__pyx_n_s_int; PyObject *__pyx_n_s_interval; PyObject *__pyx_n_s_is_coroutine; PyObject *__pyx_kp_u_isenabled; @@ -3243,6 +3302,7 @@ typedef struct { PyObject *__pyx_n_s_reduce; PyObject *__pyx_n_s_reduce_cython; PyObject *__pyx_n_s_reduce_ex; + PyObject *__pyx_n_s_return; PyObject *__pyx_n_s_scp_recv; PyObject *__pyx_n_s_scp_recv2; PyObject *__pyx_n_s_scp_send; @@ -3266,10 +3326,12 @@ typedef struct { PyObject *__pyx_kp_s_ssh2_session_pyx; PyObject *__pyx_n_s_startup; PyObject *__pyx_n_s_statinfo; + PyObject *__pyx_n_s_str; PyObject *__pyx_kp_s_stringsource; PyObject *__pyx_n_s_supported_algs; PyObject *__pyx_n_s_test; PyObject *__pyx_n_s_timeout; + PyObject *__pyx_n_s_typing; PyObject *__pyx_n_s_userauth_authenticated; PyObject *__pyx_n_s_userauth_hostbased_fromfile; PyObject *__pyx_n_s_userauth_keyboardinteractive; @@ -3431,8 +3493,16 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_ptype_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive); Py_CLEAR(clear_module_state->__pyx_type_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive); Py_CLEAR(clear_module_state->__pyx_kp_u_); + Py_CLEAR(clear_module_state->__pyx_kp_s_Agent); + Py_CLEAR(clear_module_state->__pyx_n_s_Any); + Py_CLEAR(clear_module_state->__pyx_n_s_AnyStr); + Py_CLEAR(clear_module_state->__pyx_kp_s_AnyStr_None); + Py_CLEAR(clear_module_state->__pyx_n_s_BinaryIO); + Py_CLEAR(clear_module_state->__pyx_kp_s_Channel); Py_CLEAR(clear_module_state->__pyx_n_s_ChannelError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Channel_None); Py_CLEAR(clear_module_state->__pyx_kp_u_Error_retrieving_server_host_key); + Py_CLEAR(clear_module_state->__pyx_kp_s_KnownHost); Py_CLEAR(clear_module_state->__pyx_n_s_KnownHostError); Py_CLEAR(clear_module_state->__pyx_n_s_LIBSSH2_HOSTKEY_HASH_MD5); Py_CLEAR(clear_module_state->__pyx_n_s_LIBSSH2_HOSTKEY_HASH_SHA1); @@ -3456,11 +3526,17 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_LIBSSH2_METHOD_MAC_SC); Py_CLEAR(clear_module_state->__pyx_n_s_LIBSSH2_SESSION_BLOCK_INBOUND); Py_CLEAR(clear_module_state->__pyx_n_s_LIBSSH2_SESSION_BLOCK_OUTBOUND); + Py_CLEAR(clear_module_state->__pyx_n_s_List); + Py_CLEAR(clear_module_state->__pyx_kp_s_List_str); + Py_CLEAR(clear_module_state->__pyx_kp_s_Listener_None); Py_CLEAR(clear_module_state->__pyx_n_s_MemoryError); Py_CLEAR(clear_module_state->__pyx_n_s_MethodType); Py_CLEAR(clear_module_state->__pyx_n_s_MethodType___reduce_cython); Py_CLEAR(clear_module_state->__pyx_n_s_MethodType___setstate_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_None); Py_CLEAR(clear_module_state->__pyx_n_s_PublicKeyInitError); + Py_CLEAR(clear_module_state->__pyx_kp_s_PublicKeySystem); + Py_CLEAR(clear_module_state->__pyx_kp_s_SFTP); Py_CLEAR(clear_module_state->__pyx_n_s_Session); Py_CLEAR(clear_module_state->__pyx_n_s_SessionHostKeyError); Py_CLEAR(clear_module_state->__pyx_n_s_Session___reduce_cython); @@ -3505,6 +3581,10 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_Session_userauth_publickey); Py_CLEAR(clear_module_state->__pyx_n_s_Session_userauth_publickey_fromf); Py_CLEAR(clear_module_state->__pyx_n_s_Session_userauth_publickey_fromm); + Py_CLEAR(clear_module_state->__pyx_n_s_Tuple); + Py_CLEAR(clear_module_state->__pyx_kp_s_Tuple_Channel_FileInfo_None); + Py_CLEAR(clear_module_state->__pyx_kp_s_Tuple_Listener_int_None); + Py_CLEAR(clear_module_state->__pyx_kp_s_Tuple_bytes_int); Py_CLEAR(clear_module_state->__pyx_n_s_TypeError); Py_CLEAR(clear_module_state->__pyx_kp_b__2); Py_CLEAR(clear_module_state->__pyx_kp_u__2); @@ -3532,7 +3612,10 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_b_username); Py_CLEAR(clear_module_state->__pyx_n_s_block_directions); Py_CLEAR(clear_module_state->__pyx_n_s_blocking); + Py_CLEAR(clear_module_state->__pyx_n_s_bool); Py_CLEAR(clear_module_state->__pyx_n_s_bound_port); + Py_CLEAR(clear_module_state->__pyx_n_s_bytes); + Py_CLEAR(clear_module_state->__pyx_kp_s_bytes_None); Py_CLEAR(clear_module_state->__pyx_n_s_c_algs); Py_CLEAR(clear_module_state->__pyx_n_s_c_prefs); Py_CLEAR(clear_module_state->__pyx_n_s_c_seconds); @@ -3568,6 +3651,7 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_i); Py_CLEAR(clear_module_state->__pyx_n_s_identity); Py_CLEAR(clear_module_state->__pyx_n_s_import); + Py_CLEAR(clear_module_state->__pyx_n_s_int); Py_CLEAR(clear_module_state->__pyx_n_s_interval); Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled); @@ -3624,6 +3708,7 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_reduce); Py_CLEAR(clear_module_state->__pyx_n_s_reduce_cython); Py_CLEAR(clear_module_state->__pyx_n_s_reduce_ex); + Py_CLEAR(clear_module_state->__pyx_n_s_return); Py_CLEAR(clear_module_state->__pyx_n_s_scp_recv); Py_CLEAR(clear_module_state->__pyx_n_s_scp_recv2); Py_CLEAR(clear_module_state->__pyx_n_s_scp_send); @@ -3647,10 +3732,12 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_kp_s_ssh2_session_pyx); Py_CLEAR(clear_module_state->__pyx_n_s_startup); Py_CLEAR(clear_module_state->__pyx_n_s_statinfo); + Py_CLEAR(clear_module_state->__pyx_n_s_str); Py_CLEAR(clear_module_state->__pyx_kp_s_stringsource); Py_CLEAR(clear_module_state->__pyx_n_s_supported_algs); Py_CLEAR(clear_module_state->__pyx_n_s_test); Py_CLEAR(clear_module_state->__pyx_n_s_timeout); + Py_CLEAR(clear_module_state->__pyx_n_s_typing); Py_CLEAR(clear_module_state->__pyx_n_s_userauth_authenticated); Py_CLEAR(clear_module_state->__pyx_n_s_userauth_hostbased_fromfile); Py_CLEAR(clear_module_state->__pyx_n_s_userauth_keyboardinteractive); @@ -3790,8 +3877,16 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_ptype_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive); Py_VISIT(traverse_module_state->__pyx_type_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive); Py_VISIT(traverse_module_state->__pyx_kp_u_); + Py_VISIT(traverse_module_state->__pyx_kp_s_Agent); + Py_VISIT(traverse_module_state->__pyx_n_s_Any); + Py_VISIT(traverse_module_state->__pyx_n_s_AnyStr); + Py_VISIT(traverse_module_state->__pyx_kp_s_AnyStr_None); + Py_VISIT(traverse_module_state->__pyx_n_s_BinaryIO); + Py_VISIT(traverse_module_state->__pyx_kp_s_Channel); Py_VISIT(traverse_module_state->__pyx_n_s_ChannelError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Channel_None); Py_VISIT(traverse_module_state->__pyx_kp_u_Error_retrieving_server_host_key); + Py_VISIT(traverse_module_state->__pyx_kp_s_KnownHost); Py_VISIT(traverse_module_state->__pyx_n_s_KnownHostError); Py_VISIT(traverse_module_state->__pyx_n_s_LIBSSH2_HOSTKEY_HASH_MD5); Py_VISIT(traverse_module_state->__pyx_n_s_LIBSSH2_HOSTKEY_HASH_SHA1); @@ -3815,11 +3910,17 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_LIBSSH2_METHOD_MAC_SC); Py_VISIT(traverse_module_state->__pyx_n_s_LIBSSH2_SESSION_BLOCK_INBOUND); Py_VISIT(traverse_module_state->__pyx_n_s_LIBSSH2_SESSION_BLOCK_OUTBOUND); + Py_VISIT(traverse_module_state->__pyx_n_s_List); + Py_VISIT(traverse_module_state->__pyx_kp_s_List_str); + Py_VISIT(traverse_module_state->__pyx_kp_s_Listener_None); Py_VISIT(traverse_module_state->__pyx_n_s_MemoryError); Py_VISIT(traverse_module_state->__pyx_n_s_MethodType); Py_VISIT(traverse_module_state->__pyx_n_s_MethodType___reduce_cython); Py_VISIT(traverse_module_state->__pyx_n_s_MethodType___setstate_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_None); Py_VISIT(traverse_module_state->__pyx_n_s_PublicKeyInitError); + Py_VISIT(traverse_module_state->__pyx_kp_s_PublicKeySystem); + Py_VISIT(traverse_module_state->__pyx_kp_s_SFTP); Py_VISIT(traverse_module_state->__pyx_n_s_Session); Py_VISIT(traverse_module_state->__pyx_n_s_SessionHostKeyError); Py_VISIT(traverse_module_state->__pyx_n_s_Session___reduce_cython); @@ -3864,6 +3965,10 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_Session_userauth_publickey); Py_VISIT(traverse_module_state->__pyx_n_s_Session_userauth_publickey_fromf); Py_VISIT(traverse_module_state->__pyx_n_s_Session_userauth_publickey_fromm); + Py_VISIT(traverse_module_state->__pyx_n_s_Tuple); + Py_VISIT(traverse_module_state->__pyx_kp_s_Tuple_Channel_FileInfo_None); + Py_VISIT(traverse_module_state->__pyx_kp_s_Tuple_Listener_int_None); + Py_VISIT(traverse_module_state->__pyx_kp_s_Tuple_bytes_int); Py_VISIT(traverse_module_state->__pyx_n_s_TypeError); Py_VISIT(traverse_module_state->__pyx_kp_b__2); Py_VISIT(traverse_module_state->__pyx_kp_u__2); @@ -3891,7 +3996,10 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_b_username); Py_VISIT(traverse_module_state->__pyx_n_s_block_directions); Py_VISIT(traverse_module_state->__pyx_n_s_blocking); + Py_VISIT(traverse_module_state->__pyx_n_s_bool); Py_VISIT(traverse_module_state->__pyx_n_s_bound_port); + Py_VISIT(traverse_module_state->__pyx_n_s_bytes); + Py_VISIT(traverse_module_state->__pyx_kp_s_bytes_None); Py_VISIT(traverse_module_state->__pyx_n_s_c_algs); Py_VISIT(traverse_module_state->__pyx_n_s_c_prefs); Py_VISIT(traverse_module_state->__pyx_n_s_c_seconds); @@ -3927,6 +4035,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_i); Py_VISIT(traverse_module_state->__pyx_n_s_identity); Py_VISIT(traverse_module_state->__pyx_n_s_import); + Py_VISIT(traverse_module_state->__pyx_n_s_int); Py_VISIT(traverse_module_state->__pyx_n_s_interval); Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled); @@ -3983,6 +4092,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_reduce); Py_VISIT(traverse_module_state->__pyx_n_s_reduce_cython); Py_VISIT(traverse_module_state->__pyx_n_s_reduce_ex); + Py_VISIT(traverse_module_state->__pyx_n_s_return); Py_VISIT(traverse_module_state->__pyx_n_s_scp_recv); Py_VISIT(traverse_module_state->__pyx_n_s_scp_recv2); Py_VISIT(traverse_module_state->__pyx_n_s_scp_send); @@ -4006,10 +4116,12 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_kp_s_ssh2_session_pyx); Py_VISIT(traverse_module_state->__pyx_n_s_startup); Py_VISIT(traverse_module_state->__pyx_n_s_statinfo); + Py_VISIT(traverse_module_state->__pyx_n_s_str); Py_VISIT(traverse_module_state->__pyx_kp_s_stringsource); Py_VISIT(traverse_module_state->__pyx_n_s_supported_algs); Py_VISIT(traverse_module_state->__pyx_n_s_test); Py_VISIT(traverse_module_state->__pyx_n_s_timeout); + Py_VISIT(traverse_module_state->__pyx_n_s_typing); Py_VISIT(traverse_module_state->__pyx_n_s_userauth_authenticated); Py_VISIT(traverse_module_state->__pyx_n_s_userauth_hostbased_fromfile); Py_VISIT(traverse_module_state->__pyx_n_s_userauth_keyboardinteractive); @@ -4277,8 +4389,16 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_ptype_4ssh2_7session_MethodType __pyx_mstate_global->__pyx_ptype_4ssh2_7session_MethodType #define __pyx_ptype_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive __pyx_mstate_global->__pyx_ptype_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive #define __pyx_kp_u_ __pyx_mstate_global->__pyx_kp_u_ +#define __pyx_kp_s_Agent __pyx_mstate_global->__pyx_kp_s_Agent +#define __pyx_n_s_Any __pyx_mstate_global->__pyx_n_s_Any +#define __pyx_n_s_AnyStr __pyx_mstate_global->__pyx_n_s_AnyStr +#define __pyx_kp_s_AnyStr_None __pyx_mstate_global->__pyx_kp_s_AnyStr_None +#define __pyx_n_s_BinaryIO __pyx_mstate_global->__pyx_n_s_BinaryIO +#define __pyx_kp_s_Channel __pyx_mstate_global->__pyx_kp_s_Channel #define __pyx_n_s_ChannelError __pyx_mstate_global->__pyx_n_s_ChannelError +#define __pyx_kp_s_Channel_None __pyx_mstate_global->__pyx_kp_s_Channel_None #define __pyx_kp_u_Error_retrieving_server_host_key __pyx_mstate_global->__pyx_kp_u_Error_retrieving_server_host_key +#define __pyx_kp_s_KnownHost __pyx_mstate_global->__pyx_kp_s_KnownHost #define __pyx_n_s_KnownHostError __pyx_mstate_global->__pyx_n_s_KnownHostError #define __pyx_n_s_LIBSSH2_HOSTKEY_HASH_MD5 __pyx_mstate_global->__pyx_n_s_LIBSSH2_HOSTKEY_HASH_MD5 #define __pyx_n_s_LIBSSH2_HOSTKEY_HASH_SHA1 __pyx_mstate_global->__pyx_n_s_LIBSSH2_HOSTKEY_HASH_SHA1 @@ -4302,11 +4422,17 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_LIBSSH2_METHOD_MAC_SC __pyx_mstate_global->__pyx_n_s_LIBSSH2_METHOD_MAC_SC #define __pyx_n_s_LIBSSH2_SESSION_BLOCK_INBOUND __pyx_mstate_global->__pyx_n_s_LIBSSH2_SESSION_BLOCK_INBOUND #define __pyx_n_s_LIBSSH2_SESSION_BLOCK_OUTBOUND __pyx_mstate_global->__pyx_n_s_LIBSSH2_SESSION_BLOCK_OUTBOUND +#define __pyx_n_s_List __pyx_mstate_global->__pyx_n_s_List +#define __pyx_kp_s_List_str __pyx_mstate_global->__pyx_kp_s_List_str +#define __pyx_kp_s_Listener_None __pyx_mstate_global->__pyx_kp_s_Listener_None #define __pyx_n_s_MemoryError __pyx_mstate_global->__pyx_n_s_MemoryError #define __pyx_n_s_MethodType __pyx_mstate_global->__pyx_n_s_MethodType #define __pyx_n_s_MethodType___reduce_cython __pyx_mstate_global->__pyx_n_s_MethodType___reduce_cython #define __pyx_n_s_MethodType___setstate_cython __pyx_mstate_global->__pyx_n_s_MethodType___setstate_cython +#define __pyx_n_s_None __pyx_mstate_global->__pyx_n_s_None #define __pyx_n_s_PublicKeyInitError __pyx_mstate_global->__pyx_n_s_PublicKeyInitError +#define __pyx_kp_s_PublicKeySystem __pyx_mstate_global->__pyx_kp_s_PublicKeySystem +#define __pyx_kp_s_SFTP __pyx_mstate_global->__pyx_kp_s_SFTP #define __pyx_n_s_Session __pyx_mstate_global->__pyx_n_s_Session #define __pyx_n_s_SessionHostKeyError __pyx_mstate_global->__pyx_n_s_SessionHostKeyError #define __pyx_n_s_Session___reduce_cython __pyx_mstate_global->__pyx_n_s_Session___reduce_cython @@ -4351,6 +4477,10 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_Session_userauth_publickey __pyx_mstate_global->__pyx_n_s_Session_userauth_publickey #define __pyx_n_s_Session_userauth_publickey_fromf __pyx_mstate_global->__pyx_n_s_Session_userauth_publickey_fromf #define __pyx_n_s_Session_userauth_publickey_fromm __pyx_mstate_global->__pyx_n_s_Session_userauth_publickey_fromm +#define __pyx_n_s_Tuple __pyx_mstate_global->__pyx_n_s_Tuple +#define __pyx_kp_s_Tuple_Channel_FileInfo_None __pyx_mstate_global->__pyx_kp_s_Tuple_Channel_FileInfo_None +#define __pyx_kp_s_Tuple_Listener_int_None __pyx_mstate_global->__pyx_kp_s_Tuple_Listener_int_None +#define __pyx_kp_s_Tuple_bytes_int __pyx_mstate_global->__pyx_kp_s_Tuple_bytes_int #define __pyx_n_s_TypeError __pyx_mstate_global->__pyx_n_s_TypeError #define __pyx_kp_b__2 __pyx_mstate_global->__pyx_kp_b__2 #define __pyx_kp_u__2 __pyx_mstate_global->__pyx_kp_u__2 @@ -4378,7 +4508,10 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_b_username __pyx_mstate_global->__pyx_n_s_b_username #define __pyx_n_s_block_directions __pyx_mstate_global->__pyx_n_s_block_directions #define __pyx_n_s_blocking __pyx_mstate_global->__pyx_n_s_blocking +#define __pyx_n_s_bool __pyx_mstate_global->__pyx_n_s_bool #define __pyx_n_s_bound_port __pyx_mstate_global->__pyx_n_s_bound_port +#define __pyx_n_s_bytes __pyx_mstate_global->__pyx_n_s_bytes +#define __pyx_kp_s_bytes_None __pyx_mstate_global->__pyx_kp_s_bytes_None #define __pyx_n_s_c_algs __pyx_mstate_global->__pyx_n_s_c_algs #define __pyx_n_s_c_prefs __pyx_mstate_global->__pyx_n_s_c_prefs #define __pyx_n_s_c_seconds __pyx_mstate_global->__pyx_n_s_c_seconds @@ -4414,6 +4547,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_i __pyx_mstate_global->__pyx_n_s_i #define __pyx_n_s_identity __pyx_mstate_global->__pyx_n_s_identity #define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import +#define __pyx_n_s_int __pyx_mstate_global->__pyx_n_s_int #define __pyx_n_s_interval __pyx_mstate_global->__pyx_n_s_interval #define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine #define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled @@ -4470,6 +4604,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_reduce __pyx_mstate_global->__pyx_n_s_reduce #define __pyx_n_s_reduce_cython __pyx_mstate_global->__pyx_n_s_reduce_cython #define __pyx_n_s_reduce_ex __pyx_mstate_global->__pyx_n_s_reduce_ex +#define __pyx_n_s_return __pyx_mstate_global->__pyx_n_s_return #define __pyx_n_s_scp_recv __pyx_mstate_global->__pyx_n_s_scp_recv #define __pyx_n_s_scp_recv2 __pyx_mstate_global->__pyx_n_s_scp_recv2 #define __pyx_n_s_scp_send __pyx_mstate_global->__pyx_n_s_scp_send @@ -4493,10 +4628,12 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_kp_s_ssh2_session_pyx __pyx_mstate_global->__pyx_kp_s_ssh2_session_pyx #define __pyx_n_s_startup __pyx_mstate_global->__pyx_n_s_startup #define __pyx_n_s_statinfo __pyx_mstate_global->__pyx_n_s_statinfo +#define __pyx_n_s_str __pyx_mstate_global->__pyx_n_s_str #define __pyx_kp_s_stringsource __pyx_mstate_global->__pyx_kp_s_stringsource #define __pyx_n_s_supported_algs __pyx_mstate_global->__pyx_n_s_supported_algs #define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test #define __pyx_n_s_timeout __pyx_mstate_global->__pyx_n_s_timeout +#define __pyx_n_s_typing __pyx_mstate_global->__pyx_n_s_typing #define __pyx_n_s_userauth_authenticated __pyx_mstate_global->__pyx_n_s_userauth_authenticated #define __pyx_n_s_userauth_hostbased_fromfile __pyx_mstate_global->__pyx_n_s_userauth_hostbased_fromfile #define __pyx_n_s_userauth_keyboardinteractive __pyx_mstate_global->__pyx_n_s_userauth_keyboardinteractive @@ -4893,7 +5030,7 @@ static CYTHON_INLINE PyObject *__pyx_f_7cpython_11contextvars_get_value_no_defau return __pyx_r; } -/* "ssh2/session.pyx":57 +/* "ssh2/session.pyx":59 * * cdef class MethodType: * def __cinit__(self, value): # <<<<<<<<<<<<<< @@ -4937,12 +5074,12 @@ static int __pyx_pw_4ssh2_7session_10MethodType_1__cinit__(PyObject *__pyx_v_sel (void)__Pyx_Arg_NewRef_VARARGS(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 57, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 59, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(1, 57, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(1, 59, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; @@ -4953,7 +5090,7 @@ static int __pyx_pw_4ssh2_7session_10MethodType_1__cinit__(PyObject *__pyx_v_sel } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 57, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 59, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -4987,17 +5124,17 @@ static int __pyx_pf_4ssh2_7session_10MethodType___cinit__(struct __pyx_obj_4ssh2 const char *__pyx_filename = NULL; int __pyx_clineno = 0; - /* "ssh2/session.pyx":58 + /* "ssh2/session.pyx":60 * cdef class MethodType: * def __cinit__(self, value): * self.value = value # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 58, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 60, __pyx_L1_error) __pyx_v_self->value = __pyx_t_1; - /* "ssh2/session.pyx":57 + /* "ssh2/session.pyx":59 * * cdef class MethodType: * def __cinit__(self, value): # <<<<<<<<<<<<<< @@ -5029,7 +5166,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_10MethodType_2__reduce_cython__, "MethodType.__reduce_cython__(self)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_10MethodType_2__reduce_cython__, "__reduce_cython__(self)"); static PyMethodDef __pyx_mdef_4ssh2_7session_10MethodType_3__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_10MethodType_3__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_10MethodType_2__reduce_cython__}; static PyObject *__pyx_pw_4ssh2_7session_10MethodType_3__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -5110,7 +5247,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_10MethodType_4__setstate_cython__, "MethodType.__setstate_cython__(self, __pyx_state)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_10MethodType_4__setstate_cython__, "__setstate_cython__(self, __pyx_state)"); static PyMethodDef __pyx_mdef_4ssh2_7session_10MethodType_5__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_10MethodType_5__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_10MethodType_4__setstate_cython__}; static PyObject *__pyx_pw_4ssh2_7session_10MethodType_5__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -5231,7 +5368,7 @@ static PyObject *__pyx_pf_4ssh2_7session_10MethodType_4__setstate_cython__(CYTHO return __pyx_r; } -/* "ssh2/session.pyx":73 +/* "ssh2/session.pyx":75 * * * cdef void kbd_callback(const char *name, int name_len, # <<<<<<<<<<<<<< @@ -5263,7 +5400,7 @@ static void __pyx_f_4ssh2_7session_kbd_callback(CYTHON_UNUSED char const *__pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("kbd_callback", 1); - /* "ssh2/session.pyx":79 + /* "ssh2/session.pyx":81 * c_ssh2.LIBSSH2_USERAUTH_KBDINT_RESPONSE *responses, * void **abstract) except *: * py_sess = (c_dereference(abstract)) # <<<<<<<<<<<<<< @@ -5276,7 +5413,7 @@ static void __pyx_f_4ssh2_7session_kbd_callback(CYTHON_UNUSED char const *__pyx_ __pyx_v_py_sess = ((struct __pyx_obj_4ssh2_7session_Session *)__pyx_t_2); __pyx_t_2 = 0; - /* "ssh2/session.pyx":80 + /* "ssh2/session.pyx":82 * void **abstract) except *: * py_sess = (c_dereference(abstract)) * if py_sess._kbd_callback is None: # <<<<<<<<<<<<<< @@ -5286,7 +5423,7 @@ static void __pyx_f_4ssh2_7session_kbd_callback(CYTHON_UNUSED char const *__pyx_ __pyx_t_3 = (__pyx_v_py_sess->_kbd_callback == Py_None); if (__pyx_t_3) { - /* "ssh2/session.pyx":81 + /* "ssh2/session.pyx":83 * py_sess = (c_dereference(abstract)) * if py_sess._kbd_callback is None: * return # <<<<<<<<<<<<<< @@ -5295,7 +5432,7 @@ static void __pyx_f_4ssh2_7session_kbd_callback(CYTHON_UNUSED char const *__pyx_ */ goto __pyx_L0; - /* "ssh2/session.pyx":80 + /* "ssh2/session.pyx":82 * void **abstract) except *: * py_sess = (c_dereference(abstract)) * if py_sess._kbd_callback is None: # <<<<<<<<<<<<<< @@ -5304,7 +5441,7 @@ static void __pyx_f_4ssh2_7session_kbd_callback(CYTHON_UNUSED char const *__pyx_ */ } - /* "ssh2/session.pyx":82 + /* "ssh2/session.pyx":84 * if py_sess._kbd_callback is None: * return * cdef bytes b_password = to_bytes(py_sess._kbd_callback()) # <<<<<<<<<<<<<< @@ -5330,17 +5467,17 @@ static void __pyx_f_4ssh2_7session_kbd_callback(CYTHON_UNUSED char const *__pyx_ PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 82, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __pyx_t_4 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 82, __pyx_L1_error) + __pyx_t_4 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_b_password = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; - /* "ssh2/session.pyx":83 + /* "ssh2/session.pyx":85 * return * cdef bytes b_password = to_bytes(py_sess._kbd_callback()) * cdef size_t _len = len(b_password) # <<<<<<<<<<<<<< @@ -5349,12 +5486,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(1, 83, __pyx_L1_error) + __PYX_ERR(1, 85, __pyx_L1_error) } - __pyx_t_7 = __Pyx_PyBytes_GET_SIZE(__pyx_v_b_password); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(1, 83, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyBytes_GET_SIZE(__pyx_v_b_password); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(1, 85, __pyx_L1_error) __pyx_v__len = __pyx_t_7; - /* "ssh2/session.pyx":84 + /* "ssh2/session.pyx":86 * cdef bytes b_password = to_bytes(py_sess._kbd_callback()) * cdef size_t _len = len(b_password) * cdef char *_password = b_password # <<<<<<<<<<<<<< @@ -5363,12 +5500,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(1, 84, __pyx_L1_error) + __PYX_ERR(1, 86, __pyx_L1_error) } - __pyx_t_8 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_password); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(1, 84, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_password); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(1, 86, __pyx_L1_error) __pyx_v__password = __pyx_t_8; - /* "ssh2/session.pyx":86 + /* "ssh2/session.pyx":88 * cdef char *_password = b_password * cdef char *_password_copy * if num_prompts == 1: # <<<<<<<<<<<<<< @@ -5378,7 +5515,7 @@ static void __pyx_f_4ssh2_7session_kbd_callback(CYTHON_UNUSED char const *__pyx_ __pyx_t_3 = (__pyx_v_num_prompts == 1); if (__pyx_t_3) { - /* "ssh2/session.pyx":87 + /* "ssh2/session.pyx":89 * cdef char *_password_copy * if num_prompts == 1: * _password_copy = malloc(sizeof(char) * _len) # <<<<<<<<<<<<<< @@ -5387,7 +5524,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":88 + /* "ssh2/session.pyx":90 * if num_prompts == 1: * _password_copy = malloc(sizeof(char) * _len) * for i in range(_len): # <<<<<<<<<<<<<< @@ -5399,7 +5536,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":89 + /* "ssh2/session.pyx":91 * _password_copy = malloc(sizeof(char) * _len) * for i in range(_len): * _password_copy[i] = _password[i] # <<<<<<<<<<<<<< @@ -5409,7 +5546,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":90 + /* "ssh2/session.pyx":92 * for i in range(_len): * _password_copy[i] = _password[i] * responses[0].text = _password_copy # <<<<<<<<<<<<<< @@ -5418,7 +5555,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":91 + /* "ssh2/session.pyx":93 * _password_copy[i] = _password[i] * responses[0].text = _password_copy * responses[0].length = _len # <<<<<<<<<<<<<< @@ -5427,7 +5564,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":86 + /* "ssh2/session.pyx":88 * cdef char *_password = b_password * cdef char *_password_copy * if num_prompts == 1: # <<<<<<<<<<<<<< @@ -5436,7 +5573,7 @@ static void __pyx_f_4ssh2_7session_kbd_callback(CYTHON_UNUSED char const *__pyx_ */ } - /* "ssh2/session.pyx":73 + /* "ssh2/session.pyx":75 * * * cdef void kbd_callback(const char *name, int name_len, # <<<<<<<<<<<<<< @@ -5457,7 +5594,7 @@ static void __pyx_f_4ssh2_7session_kbd_callback(CYTHON_UNUSED char const *__pyx_ __Pyx_RefNannyFinishContext(); } -/* "ssh2/session.pyx":98 +/* "ssh2/session.pyx":100 * """LibSSH2 Session class providing session functions""" * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -5498,7 +5635,7 @@ static int __pyx_pf_4ssh2_7session_7Session___cinit__(struct __pyx_obj_4ssh2_7se int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 1); - /* "ssh2/session.pyx":99 + /* "ssh2/session.pyx":101 * * def __cinit__(self): * self._session = c_ssh2.libssh2_session_init_ex( # <<<<<<<<<<<<<< @@ -5507,7 +5644,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":101 + /* "ssh2/session.pyx":103 * self._session = c_ssh2.libssh2_session_init_ex( * NULL, NULL, NULL, self) * if self._session is NULL: # <<<<<<<<<<<<<< @@ -5517,16 +5654,16 @@ static int __pyx_pf_4ssh2_7session_7Session___cinit__(struct __pyx_obj_4ssh2_7se __pyx_t_1 = (__pyx_v_self->_session == NULL); if (unlikely(__pyx_t_1)) { - /* "ssh2/session.pyx":102 + /* "ssh2/session.pyx":104 * NULL, NULL, NULL, self) * if self._session is NULL: * raise MemoryError # <<<<<<<<<<<<<< * self._sock = 0 * self.sock = None */ - PyErr_NoMemory(); __PYX_ERR(1, 102, __pyx_L1_error) + PyErr_NoMemory(); __PYX_ERR(1, 104, __pyx_L1_error) - /* "ssh2/session.pyx":101 + /* "ssh2/session.pyx":103 * self._session = c_ssh2.libssh2_session_init_ex( * NULL, NULL, NULL, self) * if self._session is NULL: # <<<<<<<<<<<<<< @@ -5535,7 +5672,7 @@ static int __pyx_pf_4ssh2_7session_7Session___cinit__(struct __pyx_obj_4ssh2_7se */ } - /* "ssh2/session.pyx":103 + /* "ssh2/session.pyx":105 * if self._session is NULL: * raise MemoryError * self._sock = 0 # <<<<<<<<<<<<<< @@ -5544,7 +5681,7 @@ static int __pyx_pf_4ssh2_7session_7Session___cinit__(struct __pyx_obj_4ssh2_7se */ __pyx_v_self->_sock = 0; - /* "ssh2/session.pyx":104 + /* "ssh2/session.pyx":106 * raise MemoryError * self._sock = 0 * self.sock = None # <<<<<<<<<<<<<< @@ -5557,7 +5694,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":105 + /* "ssh2/session.pyx":107 * self._sock = 0 * self.sock = None * self._kbd_callback = None # <<<<<<<<<<<<<< @@ -5570,7 +5707,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":98 + /* "ssh2/session.pyx":100 * """LibSSH2 Session class providing session functions""" * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -5589,7 +5726,7 @@ static int __pyx_pf_4ssh2_7session_7Session___cinit__(struct __pyx_obj_4ssh2_7se return __pyx_r; } -/* "ssh2/session.pyx":107 +/* "ssh2/session.pyx":109 * self._kbd_callback = None * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -5613,7 +5750,7 @@ static void __pyx_pw_4ssh2_7session_7Session_3__dealloc__(PyObject *__pyx_v_self static void __pyx_pf_4ssh2_7session_7Session_2__dealloc__(struct __pyx_obj_4ssh2_7session_Session *__pyx_v_self) { int __pyx_t_1; - /* "ssh2/session.pyx":108 + /* "ssh2/session.pyx":110 * * def __dealloc__(self): * if self._session is not NULL: # <<<<<<<<<<<<<< @@ -5623,7 +5760,7 @@ static void __pyx_pf_4ssh2_7session_7Session_2__dealloc__(struct __pyx_obj_4ssh2 __pyx_t_1 = (__pyx_v_self->_session != NULL); if (__pyx_t_1) { - /* "ssh2/session.pyx":109 + /* "ssh2/session.pyx":111 * def __dealloc__(self): * if self._session is not NULL: * c_ssh2.libssh2_session_free(self._session) # <<<<<<<<<<<<<< @@ -5632,7 +5769,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":108 + /* "ssh2/session.pyx":110 * * def __dealloc__(self): * if self._session is not NULL: # <<<<<<<<<<<<<< @@ -5641,16 +5778,16 @@ static void __pyx_pf_4ssh2_7session_7Session_2__dealloc__(struct __pyx_obj_4ssh2 */ } - /* "ssh2/session.pyx":110 + /* "ssh2/session.pyx":112 * if self._session is not NULL: * c_ssh2.libssh2_session_free(self._session) * self._session = NULL # <<<<<<<<<<<<<< * - * def disconnect(self): + * def disconnect(self) -> int: */ __pyx_v_self->_session = NULL; - /* "ssh2/session.pyx":107 + /* "ssh2/session.pyx":109 * self._kbd_callback = None * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -5661,12 +5798,12 @@ static void __pyx_pf_4ssh2_7session_7Session_2__dealloc__(struct __pyx_obj_4ssh2 /* function exit code */ } -/* "ssh2/session.pyx":112 +/* "ssh2/session.pyx":114 * self._session = NULL * - * def disconnect(self): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: + * def disconnect(self) -> int: # <<<<<<<<<<<<<< + * """Disconnect session. + * */ /* Python wrapper */ @@ -5677,7 +5814,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_4disconnect, "Session.disconnect(self)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_4disconnect, "disconnect(self) -> int\nDisconnect session.\n\n :rtype: int\n "); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_5disconnect = {"disconnect", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_5disconnect, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_4disconnect}; static PyObject *__pyx_pw_4ssh2_7session_7Session_5disconnect(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -5722,8 +5859,8 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_4disconnect(struct __pyx_obj_4 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("disconnect", 1); - /* "ssh2/session.pyx":114 - * def disconnect(self): + /* "ssh2/session.pyx":120 + * """ * cdef int rc * with nogil: # <<<<<<<<<<<<<< * rc = c_ssh2.libssh2_session_disconnect(self._session, b"end") @@ -5738,7 +5875,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_4disconnect(struct __pyx_obj_4 #endif /*try:*/ { - /* "ssh2/session.pyx":115 + /* "ssh2/session.pyx":121 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_session_disconnect(self._session, b"end") # <<<<<<<<<<<<<< @@ -5748,8 +5885,8 @@ 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":114 - * def disconnect(self): + /* "ssh2/session.pyx":120 + * """ * cdef int rc * with nogil: # <<<<<<<<<<<<<< * rc = c_ssh2.libssh2_session_disconnect(self._session, b"end") @@ -5767,27 +5904,28 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_4disconnect(struct __pyx_obj_4 } } - /* "ssh2/session.pyx":116 + /* "ssh2/session.pyx":122 * with nogil: * rc = c_ssh2.libssh2_session_disconnect(self._session, b"end") * return handle_error_codes(rc) # <<<<<<<<<<<<<< * - * def handshake(self, sock not None): + * def handshake(self, sock not None: BinaryIO) -> int: */ __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(1, 116, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 116, __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, 122, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; + if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_t_2)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_t_2))) __PYX_ERR(1, 122, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":112 + /* "ssh2/session.pyx":114 * self._session = NULL * - * def disconnect(self): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: + * def disconnect(self) -> int: # <<<<<<<<<<<<<< + * """Disconnect session. + * */ /* function exit code */ @@ -5801,10 +5939,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_4disconnect(struct __pyx_obj_4 return __pyx_r; } -/* "ssh2/session.pyx":118 +/* "ssh2/session.pyx":124 * return handle_error_codes(rc) * - * def handshake(self, sock not None): # <<<<<<<<<<<<<< + * def handshake(self, sock not None: BinaryIO) -> int: # <<<<<<<<<<<<<< * """Perform SSH handshake. * */ @@ -5817,7 +5955,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_6handshake, "Session.handshake(self, sock)\nPerform SSH handshake.\n\n Must be called after Session initialisation."); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_6handshake, "handshake(self, sock: BinaryIO) -> int\nPerform SSH handshake.\n\n Must be called after Session initialisation.\n :param sock: A python compatible socket object.\n "); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_7handshake = {"handshake", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_7handshake, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_6handshake}; static PyObject *__pyx_pw_4ssh2_7session_7Session_7handshake(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -5863,12 +6001,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 118, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 124, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "handshake") < 0)) __PYX_ERR(1, 118, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "handshake") < 0)) __PYX_ERR(1, 124, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; @@ -5879,7 +6017,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("handshake", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 118, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("handshake", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 124, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -5894,7 +6032,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(((PyObject *)__pyx_v_sock) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sock"); __PYX_ERR(1, 118, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "sock"); __PYX_ERR(1, 124, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_6handshake(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_sock); @@ -5925,17 +6063,17 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("handshake", 1); - /* "ssh2/session.pyx":122 - * - * Must be called after Session initialisation.""" + /* "ssh2/session.pyx":130 + * :param sock: A python compatible socket object. + * """ * 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(1, 122, __pyx_L1_error) + __pyx_t_1 = PyObject_AsFileDescriptor(__pyx_v_sock); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 130, __pyx_L1_error) __pyx_v__sock = __pyx_t_1; - /* "ssh2/session.pyx":124 + /* "ssh2/session.pyx":132 * cdef int _sock = PyObject_AsFileDescriptor(sock) * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -5951,7 +6089,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4s #endif /*try:*/ { - /* "ssh2/session.pyx":125 + /* "ssh2/session.pyx":133 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_session_handshake(self._session, _sock) # <<<<<<<<<<<<<< @@ -5960,7 +6098,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":126 + /* "ssh2/session.pyx":134 * with nogil: * rc = c_ssh2.libssh2_session_handshake(self._session, _sock) * self._sock = _sock # <<<<<<<<<<<<<< @@ -5970,7 +6108,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4s __pyx_v_self->_sock = __pyx_v__sock; } - /* "ssh2/session.pyx":124 + /* "ssh2/session.pyx":132 * cdef int _sock = PyObject_AsFileDescriptor(sock) * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -5989,7 +6127,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4s } } - /* "ssh2/session.pyx":127 + /* "ssh2/session.pyx":135 * rc = c_ssh2.libssh2_session_handshake(self._session, _sock) * self._sock = _sock * self.sock = sock # <<<<<<<<<<<<<< @@ -6002,7 +6140,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":128 + /* "ssh2/session.pyx":136 * self._sock = _sock * self.sock = sock * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -6010,17 +6148,18 @@ 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(1, 128, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 128, __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, 136, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 136, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; + if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_t_2)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_t_2))) __PYX_ERR(1, 136, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":118 + /* "ssh2/session.pyx":124 * return handle_error_codes(rc) * - * def handshake(self, sock not None): # <<<<<<<<<<<<<< + * def handshake(self, sock not None: BinaryIO) -> int: # <<<<<<<<<<<<<< * """Perform SSH handshake. * */ @@ -6036,7 +6175,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_6handshake(struct __pyx_obj_4s return __pyx_r; } -/* "ssh2/session.pyx":130 +/* "ssh2/session.pyx":138 * return handle_error_codes(rc) * * def startup(self, sock): # <<<<<<<<<<<<<< @@ -6052,7 +6191,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_8startup, "Session.startup(self, sock)\nDeprecated - use self.handshake"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_8startup, "startup(self, sock)\nDeprecated - use self.handshake"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_9startup = {"startup", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_9startup, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_8startup}; static PyObject *__pyx_pw_4ssh2_7session_7Session_9startup(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6098,12 +6237,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 130, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 138, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "startup") < 0)) __PYX_ERR(1, 130, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "startup") < 0)) __PYX_ERR(1, 138, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; @@ -6114,7 +6253,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("startup", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 130, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("startup", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 138, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -6153,17 +6292,17 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_8startup(struct __pyx_obj_4ssh int __pyx_clineno = 0; __Pyx_RefNannySetupContext("startup", 1); - /* "ssh2/session.pyx":132 + /* "ssh2/session.pyx":140 * def startup(self, sock): * """Deprecated - use self.handshake""" * cdef int _sock = PyObject_AsFileDescriptor(sock) # <<<<<<<<<<<<<< * cdef int rc = c_ssh2.libssh2_session_startup(self._session, _sock) * return handle_error_codes(rc) */ - __pyx_t_1 = PyObject_AsFileDescriptor(__pyx_v_sock); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 132, __pyx_L1_error) + __pyx_t_1 = PyObject_AsFileDescriptor(__pyx_v_sock); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 140, __pyx_L1_error) __pyx_v__sock = __pyx_t_1; - /* "ssh2/session.pyx":133 + /* "ssh2/session.pyx":141 * """Deprecated - use self.handshake""" * cdef int _sock = PyObject_AsFileDescriptor(sock) * cdef int rc = c_ssh2.libssh2_session_startup(self._session, _sock) # <<<<<<<<<<<<<< @@ -6172,22 +6311,22 @@ 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":134 + /* "ssh2/session.pyx":142 * cdef int _sock = PyObject_AsFileDescriptor(sock) * cdef int rc = c_ssh2.libssh2_session_startup(self._session, _sock) * return handle_error_codes(rc) # <<<<<<<<<<<<<< * - * def set_blocking(self, bint blocking): + * def set_blocking(self, bint blocking: bool) -> 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(1, 134, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 134, __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, 142, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 142, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":130 + /* "ssh2/session.pyx":138 * return handle_error_codes(rc) * * def startup(self, sock): # <<<<<<<<<<<<<< @@ -6206,10 +6345,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_8startup(struct __pyx_obj_4ssh return __pyx_r; } -/* "ssh2/session.pyx":136 +/* "ssh2/session.pyx":144 * return handle_error_codes(rc) * - * def set_blocking(self, bint blocking): # <<<<<<<<<<<<<< + * def set_blocking(self, bint blocking: bool) -> None: # <<<<<<<<<<<<<< * """Set session blocking mode on/off. * */ @@ -6222,7 +6361,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_10set_blocking, "Session.set_blocking(self, bool blocking)\nSet session blocking mode on/off.\n\n :param blocking: ``False`` for non-blocking, ``True`` for blocking.\n Session default is blocking unless set otherwise.\n :type blocking: bool"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_10set_blocking, "set_blocking(self, blocking: bool) -> None\nSet session blocking mode on/off.\n\n :param blocking: ``False`` for non-blocking, ``True`` for blocking.\n Session default is blocking unless set otherwise.\n :type blocking: bool"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_11set_blocking = {"set_blocking", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_11set_blocking, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_10set_blocking}; static PyObject *__pyx_pw_4ssh2_7session_7Session_11set_blocking(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6268,23 +6407,23 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 136, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 144, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set_blocking") < 0)) __PYX_ERR(1, 136, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set_blocking") < 0)) __PYX_ERR(1, 144, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - __pyx_v_blocking = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_blocking == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 136, __pyx_L3_error) + __pyx_v_blocking = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_blocking == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 144, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_blocking", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 136, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("set_blocking", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 144, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -6316,7 +6455,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_10set_blocking(struct __pyx_ob __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_blocking", 1); - /* "ssh2/session.pyx":142 + /* "ssh2/session.pyx":150 * Session default is blocking unless set otherwise. * :type blocking: bool""" * with nogil: # <<<<<<<<<<<<<< @@ -6332,7 +6471,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_10set_blocking(struct __pyx_ob #endif /*try:*/ { - /* "ssh2/session.pyx":143 + /* "ssh2/session.pyx":151 * :type blocking: bool""" * with nogil: * c_ssh2.libssh2_session_set_blocking( # <<<<<<<<<<<<<< @@ -6342,7 +6481,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":142 + /* "ssh2/session.pyx":150 * Session default is blocking unless set otherwise. * :type blocking: bool""" * with nogil: # <<<<<<<<<<<<<< @@ -6361,10 +6500,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_10set_blocking(struct __pyx_ob } } - /* "ssh2/session.pyx":136 + /* "ssh2/session.pyx":144 * return handle_error_codes(rc) * - * def set_blocking(self, bint blocking): # <<<<<<<<<<<<<< + * def set_blocking(self, bint blocking: bool) -> None: # <<<<<<<<<<<<<< * """Set session blocking mode on/off. * */ @@ -6376,10 +6515,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_10set_blocking(struct __pyx_ob return __pyx_r; } -/* "ssh2/session.pyx":146 +/* "ssh2/session.pyx":154 * self._session, blocking) * - * def get_blocking(self): # <<<<<<<<<<<<<< + * def get_blocking(self) -> bool: # <<<<<<<<<<<<<< * """Get session blocking mode enabled True/False. * */ @@ -6392,7 +6531,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_12get_blocking, "Session.get_blocking(self)\nGet session blocking mode enabled True/False.\n\n :rtype: bool"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_12get_blocking, "get_blocking(self) -> bool\nGet session blocking mode enabled True/False.\n\n :rtype: bool"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_13get_blocking = {"get_blocking", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_13get_blocking, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_12get_blocking}; static PyObject *__pyx_pw_4ssh2_7session_7Session_13get_blocking(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6437,7 +6576,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_12get_blocking(struct __pyx_ob int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_blocking", 1); - /* "ssh2/session.pyx":151 + /* "ssh2/session.pyx":159 * :rtype: bool""" * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -6453,7 +6592,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_12get_blocking(struct __pyx_ob #endif /*try:*/ { - /* "ssh2/session.pyx":152 + /* "ssh2/session.pyx":160 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_session_get_blocking(self._session) # <<<<<<<<<<<<<< @@ -6463,7 +6602,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":151 + /* "ssh2/session.pyx":159 * :rtype: bool""" * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -6482,28 +6621,28 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_12get_blocking(struct __pyx_ob } } - /* "ssh2/session.pyx":153 + /* "ssh2/session.pyx":161 * with nogil: * rc = c_ssh2.libssh2_session_get_blocking(self._session) * return bool(rc) # <<<<<<<<<<<<<< * - * def set_timeout(self, long timeout): + * def set_timeout(self, long timeout) -> None: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 153, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 161, __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(1, 153, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(1, 161, __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(1, 153, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBool_FromLong((!(!__pyx_t_2))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":146 + /* "ssh2/session.pyx":154 * self._session, blocking) * - * def get_blocking(self): # <<<<<<<<<<<<<< + * def get_blocking(self) -> bool: # <<<<<<<<<<<<<< * """Get session blocking mode enabled True/False. * */ @@ -6519,10 +6658,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_12get_blocking(struct __pyx_ob return __pyx_r; } -/* "ssh2/session.pyx":155 +/* "ssh2/session.pyx":163 * return bool(rc) * - * def set_timeout(self, long timeout): # <<<<<<<<<<<<<< + * def set_timeout(self, long timeout) -> None: # <<<<<<<<<<<<<< * """Set the timeout in milliseconds for how long a blocking * call may wait until the situation is considered an error and */ @@ -6535,7 +6674,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_14set_timeout, "Session.set_timeout(self, long timeout)\nSet the timeout in milliseconds for how long a blocking\n call may wait until the situation is considered an error and\n :py:class:`ssh2.error_codes.LIBSSH2_ERROR_TIMEOUT` is returned.\n\n By default or if timeout set is zero, blocking calls do not\n time out.\n :param timeout: Milliseconds to wait before timeout."); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_14set_timeout, "set_timeout(self, timeout: int) -> None\nSet the timeout in milliseconds for how long a blocking\n call may wait until the situation is considered an error and\n :py:class:`ssh2.error_codes.LIBSSH2_ERROR_TIMEOUT` is returned.\n\n By default or if timeout set is zero, blocking calls do not\n time out.\n :param timeout: Milliseconds to wait before timeout."); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_15set_timeout = {"set_timeout", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_15set_timeout, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_14set_timeout}; static PyObject *__pyx_pw_4ssh2_7session_7Session_15set_timeout(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6581,23 +6720,23 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 155, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 163, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set_timeout") < 0)) __PYX_ERR(1, 155, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set_timeout") < 0)) __PYX_ERR(1, 163, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - __pyx_v_timeout = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_timeout == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 155, __pyx_L3_error) + __pyx_v_timeout = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_timeout == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 163, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_timeout", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 155, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("set_timeout", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 163, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -6629,7 +6768,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_14set_timeout(struct __pyx_obj __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_timeout", 1); - /* "ssh2/session.pyx":163 + /* "ssh2/session.pyx":171 * time out. * :param timeout: Milliseconds to wait before timeout.""" * with nogil: # <<<<<<<<<<<<<< @@ -6645,17 +6784,17 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_14set_timeout(struct __pyx_obj #endif /*try:*/ { - /* "ssh2/session.pyx":164 + /* "ssh2/session.pyx":172 * :param timeout: Milliseconds to wait before timeout.""" * with nogil: * c_ssh2.libssh2_session_set_timeout(self._session, timeout) # <<<<<<<<<<<<<< * - * def get_timeout(self): + * def get_timeout(self) -> int: */ libssh2_session_set_timeout(__pyx_v_self->_session, __pyx_v_timeout); } - /* "ssh2/session.pyx":163 + /* "ssh2/session.pyx":171 * time out. * :param timeout: Milliseconds to wait before timeout.""" * with nogil: # <<<<<<<<<<<<<< @@ -6674,10 +6813,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_14set_timeout(struct __pyx_obj } } - /* "ssh2/session.pyx":155 + /* "ssh2/session.pyx":163 * return bool(rc) * - * def set_timeout(self, long timeout): # <<<<<<<<<<<<<< + * def set_timeout(self, long timeout) -> None: # <<<<<<<<<<<<<< * """Set the timeout in milliseconds for how long a blocking * call may wait until the situation is considered an error and */ @@ -6689,12 +6828,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_14set_timeout(struct __pyx_obj return __pyx_r; } -/* "ssh2/session.pyx":166 +/* "ssh2/session.pyx":174 * c_ssh2.libssh2_session_set_timeout(self._session, timeout) * - * def get_timeout(self): # <<<<<<<<<<<<<< - * """Get current session timeout setting""" - * cdef long timeout + * def get_timeout(self) -> int: # <<<<<<<<<<<<<< + * """Get current session timeout setting in milliseconds. + * */ /* Python wrapper */ @@ -6705,7 +6844,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_16get_timeout, "Session.get_timeout(self)\nGet current session timeout setting"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_16get_timeout, "get_timeout(self) -> int\nGet current session timeout setting in milliseconds.\n\n :rtype: int"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_17get_timeout = {"get_timeout", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_17get_timeout, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_16get_timeout}; static PyObject *__pyx_pw_4ssh2_7session_7Session_17get_timeout(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6749,8 +6888,8 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_16get_timeout(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_timeout", 1); - /* "ssh2/session.pyx":169 - * """Get current session timeout setting""" + /* "ssh2/session.pyx":179 + * :rtype: int""" * cdef long timeout * with nogil: # <<<<<<<<<<<<<< * timeout = c_ssh2.libssh2_session_get_timeout(self._session) @@ -6765,7 +6904,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_16get_timeout(struct __pyx_obj #endif /*try:*/ { - /* "ssh2/session.pyx":170 + /* "ssh2/session.pyx":180 * cdef long timeout * with nogil: * timeout = c_ssh2.libssh2_session_get_timeout(self._session) # <<<<<<<<<<<<<< @@ -6775,8 +6914,8 @@ 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":169 - * """Get current session timeout setting""" + /* "ssh2/session.pyx":179 + * :rtype: int""" * cdef long timeout * with nogil: # <<<<<<<<<<<<<< * timeout = c_ssh2.libssh2_session_get_timeout(self._session) @@ -6794,26 +6933,27 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_16get_timeout(struct __pyx_obj } } - /* "ssh2/session.pyx":171 + /* "ssh2/session.pyx":181 * with nogil: * timeout = c_ssh2.libssh2_session_get_timeout(self._session) * return timeout # <<<<<<<<<<<<<< * - * def userauth_authenticated(self): + * def userauth_authenticated(self) -> bool: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_timeout); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 171, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_timeout); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 181, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_t_1)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_t_1))) __PYX_ERR(1, 181, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":166 + /* "ssh2/session.pyx":174 * c_ssh2.libssh2_session_set_timeout(self._session, timeout) * - * def get_timeout(self): # <<<<<<<<<<<<<< - * """Get current session timeout setting""" - * cdef long timeout + * def get_timeout(self) -> int: # <<<<<<<<<<<<<< + * """Get current session timeout setting in milliseconds. + * */ /* function exit code */ @@ -6827,10 +6967,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_16get_timeout(struct __pyx_obj return __pyx_r; } -/* "ssh2/session.pyx":173 +/* "ssh2/session.pyx":183 * return timeout * - * def userauth_authenticated(self): # <<<<<<<<<<<<<< + * def userauth_authenticated(self) -> bool: # <<<<<<<<<<<<<< * """True/False for is user authenticated or not. * */ @@ -6843,7 +6983,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_18userauth_authenticated, "Session.userauth_authenticated(self)\nTrue/False for is user authenticated or not.\n\n :rtype: bool"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_18userauth_authenticated, "userauth_authenticated(self) -> bool\nTrue/False for is user authenticated or not.\n\n :rtype: bool"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_19userauth_authenticated = {"userauth_authenticated", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_19userauth_authenticated, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_18userauth_authenticated}; static PyObject *__pyx_pw_4ssh2_7session_7Session_19userauth_authenticated(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6888,7 +7028,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_18userauth_authenticated(struc int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_authenticated", 1); - /* "ssh2/session.pyx":178 + /* "ssh2/session.pyx":188 * :rtype: bool""" * cdef bint rc * with nogil: # <<<<<<<<<<<<<< @@ -6904,7 +7044,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_18userauth_authenticated(struc #endif /*try:*/ { - /* "ssh2/session.pyx":179 + /* "ssh2/session.pyx":189 * cdef bint rc * with nogil: * rc = c_ssh2.libssh2_userauth_authenticated(self._session) # <<<<<<<<<<<<<< @@ -6914,7 +7054,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_18userauth_authenticated(struc __pyx_v_rc = libssh2_userauth_authenticated(__pyx_v_self->_session); } - /* "ssh2/session.pyx":178 + /* "ssh2/session.pyx":188 * :rtype: bool""" * cdef bint rc * with nogil: # <<<<<<<<<<<<<< @@ -6933,25 +7073,25 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_18userauth_authenticated(struc } } - /* "ssh2/session.pyx":180 + /* "ssh2/session.pyx":190 * with nogil: * rc = c_ssh2.libssh2_userauth_authenticated(self._session) * return bool(rc) # <<<<<<<<<<<<<< * - * def userauth_list(self, username not None): + * def userauth_list(self, username not None: AnyStr) -> List[str]: */ __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(1, 180, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBool_FromLong((!(!__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":173 + /* "ssh2/session.pyx":183 * return timeout * - * def userauth_authenticated(self): # <<<<<<<<<<<<<< + * def userauth_authenticated(self) -> bool: # <<<<<<<<<<<<<< * """True/False for is user authenticated or not. * */ @@ -6967,10 +7107,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_18userauth_authenticated(struc return __pyx_r; } -/* "ssh2/session.pyx":182 +/* "ssh2/session.pyx":192 * return bool(rc) * - * def userauth_list(self, username not None): # <<<<<<<<<<<<<< + * def userauth_list(self, username not None: AnyStr) -> List[str]: # <<<<<<<<<<<<<< * """Retrieve available authentication methodslist. * */ @@ -6983,7 +7123,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_20userauth_list, "Session.userauth_list(self, username)\nRetrieve available authentication methodslist.\n\n :rtype: list"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_20userauth_list, "userauth_list(self, username: AnyStr) -> List[str]\nRetrieve available authentication methodslist.\n\n :rtype: list"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_21userauth_list = {"userauth_list", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_21userauth_list, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_20userauth_list}; static PyObject *__pyx_pw_4ssh2_7session_7Session_21userauth_list(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -7029,12 +7169,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 182, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 192, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "userauth_list") < 0)) __PYX_ERR(1, 182, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "userauth_list") < 0)) __PYX_ERR(1, 192, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; @@ -7045,7 +7185,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("userauth_list", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 182, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_list", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 192, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -7060,7 +7200,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds 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(1, 182, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(1, 192, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_20userauth_list(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_username); @@ -7096,19 +7236,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_list", 1); - /* "ssh2/session.pyx":186 + /* "ssh2/session.pyx":196 * * :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(1, 186, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 196, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":187 + /* "ssh2/session.pyx":197 * :rtype: list""" * cdef bytes b_username = to_bytes(username) * cdef char *_username = b_username # <<<<<<<<<<<<<< @@ -7117,12 +7257,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(1, 187, __pyx_L1_error) + __PYX_ERR(1, 197, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 187, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 197, __pyx_L1_error) __pyx_v__username = __pyx_t_2; - /* "ssh2/session.pyx":188 + /* "ssh2/session.pyx":198 * cdef bytes b_username = to_bytes(username) * cdef char *_username = b_username * cdef size_t username_len = len(b_username) # <<<<<<<<<<<<<< @@ -7131,12 +7271,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(1, 188, __pyx_L1_error) + __PYX_ERR(1, 198, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyBytes_GET_SIZE(__pyx_v_b_username); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 188, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBytes_GET_SIZE(__pyx_v_b_username); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 198, __pyx_L1_error) __pyx_v_username_len = __pyx_t_3; - /* "ssh2/session.pyx":191 + /* "ssh2/session.pyx":201 * cdef char *_auth * cdef str auth * with nogil: # <<<<<<<<<<<<<< @@ -7152,7 +7292,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o #endif /*try:*/ { - /* "ssh2/session.pyx":192 + /* "ssh2/session.pyx":202 * cdef str auth * with nogil: * _auth = c_ssh2.libssh2_userauth_list( # <<<<<<<<<<<<<< @@ -7162,7 +7302,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":191 + /* "ssh2/session.pyx":201 * cdef char *_auth * cdef str auth * with nogil: # <<<<<<<<<<<<<< @@ -7181,7 +7321,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o } } - /* "ssh2/session.pyx":194 + /* "ssh2/session.pyx":204 * _auth = c_ssh2.libssh2_userauth_list( * self._session, _username, username_len) * if _auth is NULL: # <<<<<<<<<<<<<< @@ -7191,7 +7331,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o __pyx_t_4 = (__pyx_v__auth == NULL); if (__pyx_t_4) { - /* "ssh2/session.pyx":195 + /* "ssh2/session.pyx":205 * self._session, _username, username_len) * if _auth is NULL: * return # <<<<<<<<<<<<<< @@ -7199,10 +7339,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o * return auth.split(',') */ __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "ssh2/session.pyx":194 + /* "ssh2/session.pyx":204 * _auth = c_ssh2.libssh2_userauth_list( * self._session, _username, username_len) * if _auth is NULL: # <<<<<<<<<<<<<< @@ -7211,41 +7351,41 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o */ } - /* "ssh2/session.pyx":196 + /* "ssh2/session.pyx":206 * 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(1, 196, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_str(__pyx_v__auth); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_1))) __PYX_ERR(1, 196, __pyx_L1_error) + if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_1))) __PYX_ERR(1, 206, __pyx_L1_error) __pyx_v_auth = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":197 + /* "ssh2/session.pyx":207 * return * auth = to_str(_auth) * return auth.split(',') # <<<<<<<<<<<<<< * - * def userauth_publickey_fromfile(self, username not None, + * def userauth_publickey_fromfile(self, username not None: AnyStr, */ __Pyx_XDECREF(__pyx_r); if (unlikely(__pyx_v_auth == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "split"); - __PYX_ERR(1, 197, __pyx_L1_error) + __PYX_ERR(1, 207, __pyx_L1_error) } - __pyx_t_1 = PyUnicode_Split(__pyx_v_auth, __Pyx_NoneAsNull(__pyx_kp_u_), -1L); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 197, __pyx_L1_error) + __pyx_t_1 = PyUnicode_Split(__pyx_v_auth, __Pyx_NoneAsNull(__pyx_kp_u_), -1L); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":182 + /* "ssh2/session.pyx":192 * return bool(rc) * - * def userauth_list(self, username not None): # <<<<<<<<<<<<<< + * def userauth_list(self, username not None: AnyStr) -> List[str]: # <<<<<<<<<<<<<< * """Retrieve available authentication methodslist. * */ @@ -7263,12 +7403,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_20userauth_list(struct __pyx_o return __pyx_r; } -/* "ssh2/session.pyx":199 +/* "ssh2/session.pyx":209 * return auth.split(',') * - * def userauth_publickey_fromfile(self, username not None, # <<<<<<<<<<<<<< - * privatekey not None, - * passphrase='', + * def userauth_publickey_fromfile(self, username not None: AnyStr, # <<<<<<<<<<<<<< + * privatekey not None: AnyStr, + * passphrase: AnyStr='', */ /* Python wrapper */ @@ -7279,7 +7419,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_22userauth_publickey_fromfile, "Session.userauth_publickey_fromfile(self, username, privatekey, passphrase=u'', publickey=None)\nAuthenticate with public key from file.\n\n :rtype: int"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_22userauth_publickey_fromfile, "userauth_publickey_fromfile(self, username: AnyStr, privatekey: AnyStr, passphrase: AnyStr = u'', publickey: AnyStr | None = None) -> int\nAuthenticate with public key from file.\n\n :rtype: int"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_23userauth_publickey_fromfile = {"userauth_publickey_fromfile", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_23userauth_publickey_fromfile, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_22userauth_publickey_fromfile}; static PyObject *__pyx_pw_4ssh2_7session_7Session_23userauth_publickey_fromfile(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -7315,10 +7455,10 @@ PyObject *__pyx_args, PyObject *__pyx_kwds PyObject **__pyx_pyargnames[] = {&__pyx_n_s_username,&__pyx_n_s_privatekey,&__pyx_n_s_passphrase,&__pyx_n_s_publickey,0}; values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_kp_u__2)); - /* "ssh2/session.pyx":202 - * privatekey not None, - * passphrase='', - * publickey=None): # <<<<<<<<<<<<<< + /* "ssh2/session.pyx":212 + * privatekey not None: AnyStr, + * passphrase: AnyStr='', + * publickey: AnyStr | None=None) -> int: # <<<<<<<<<<<<<< * """Authenticate with public key from file. * */ @@ -7344,7 +7484,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 199, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 209, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: @@ -7352,28 +7492,28 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 199, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 209, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("userauth_publickey_fromfile", 0, 2, 4, 1); __PYX_ERR(1, 199, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_publickey_fromfile", 0, 2, 4, 1); __PYX_ERR(1, 209, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_passphrase); if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 199, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 209, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_publickey); if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 199, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 209, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "userauth_publickey_fromfile") < 0)) __PYX_ERR(1, 199, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "userauth_publickey_fromfile") < 0)) __PYX_ERR(1, 209, __pyx_L3_error) } } else { switch (__pyx_nargs) { @@ -7394,7 +7534,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("userauth_publickey_fromfile", 0, 2, 4, __pyx_nargs); __PYX_ERR(1, 199, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_publickey_fromfile", 0, 2, 4, __pyx_nargs); __PYX_ERR(1, 209, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -7409,19 +7549,19 @@ PyObject *__pyx_args, PyObject *__pyx_kwds 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(1, 199, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(1, 209, __pyx_L1_error) } if (unlikely(((PyObject *)__pyx_v_privatekey) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "privatekey"); __PYX_ERR(1, 200, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "privatekey"); __PYX_ERR(1, 210, __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":199 + /* "ssh2/session.pyx":209 * return auth.split(',') * - * def userauth_publickey_fromfile(self, username not None, # <<<<<<<<<<<<<< - * privatekey not None, - * passphrase='', + * def userauth_publickey_fromfile(self, username not None: AnyStr, # <<<<<<<<<<<<<< + * privatekey not None: AnyStr, + * passphrase: AnyStr='', */ /* function exit code */ @@ -7461,19 +7601,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_publickey_fromfile", 1); - /* "ssh2/session.pyx":207 + /* "ssh2/session.pyx":217 * :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(1, 207, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":209 + /* "ssh2/session.pyx":219 * cdef bytes b_username = to_bytes(username) * cdef bytes b_publickey = to_bytes(publickey) \ * if publickey is not None else None # <<<<<<<<<<<<<< @@ -7483,20 +7623,20 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( __pyx_t_2 = (__pyx_v_publickey != Py_None); if (__pyx_t_2) { - /* "ssh2/session.pyx":208 + /* "ssh2/session.pyx":218 * 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(1, 208, __pyx_L1_error) + __pyx_t_3 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_publickey); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; } else { - /* "ssh2/session.pyx":209 + /* "ssh2/session.pyx":219 * cdef bytes b_username = to_bytes(username) * cdef bytes b_publickey = to_bytes(publickey) \ * if publickey is not None else None # <<<<<<<<<<<<<< @@ -7507,42 +7647,42 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( __pyx_t_1 = Py_None; } - /* "ssh2/session.pyx":208 + /* "ssh2/session.pyx":218 * 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) */ - if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_1))) __PYX_ERR(1, 208, __pyx_L1_error) + if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_1))) __PYX_ERR(1, 218, __pyx_L1_error) __pyx_v_b_publickey = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":210 + /* "ssh2/session.pyx":220 * 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(1, 210, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_privatekey); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_privatekey = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":211 + /* "ssh2/session.pyx":221 * 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(1, 211, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_passphrase); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_passphrase = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":212 + /* "ssh2/session.pyx":222 * cdef bytes b_privatekey = to_bytes(privatekey) * cdef bytes b_passphrase = to_bytes(passphrase) * cdef char *_username = b_username # <<<<<<<<<<<<<< @@ -7551,12 +7691,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(1, 212, __pyx_L1_error) + __PYX_ERR(1, 222, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 212, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 222, __pyx_L1_error) __pyx_v__username = __pyx_t_4; - /* "ssh2/session.pyx":213 + /* "ssh2/session.pyx":223 * cdef bytes b_passphrase = to_bytes(passphrase) * cdef char *_username = b_username * cdef char *_publickey = NULL # <<<<<<<<<<<<<< @@ -7565,7 +7705,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( */ __pyx_v__publickey = NULL; - /* "ssh2/session.pyx":214 + /* "ssh2/session.pyx":224 * cdef char *_username = b_username * cdef char *_publickey = NULL * cdef char *_privatekey = b_privatekey # <<<<<<<<<<<<<< @@ -7574,12 +7714,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(1, 214, __pyx_L1_error) + __PYX_ERR(1, 224, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_privatekey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 214, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_privatekey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 224, __pyx_L1_error) __pyx_v__privatekey = __pyx_t_4; - /* "ssh2/session.pyx":215 + /* "ssh2/session.pyx":225 * cdef char *_publickey = NULL * cdef char *_privatekey = b_privatekey * cdef char *_passphrase = b_passphrase # <<<<<<<<<<<<<< @@ -7588,12 +7728,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(1, 215, __pyx_L1_error) + __PYX_ERR(1, 225, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_passphrase); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 215, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_passphrase); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 225, __pyx_L1_error) __pyx_v__passphrase = __pyx_t_4; - /* "ssh2/session.pyx":216 + /* "ssh2/session.pyx":226 * cdef char *_privatekey = b_privatekey * cdef char *_passphrase = b_passphrase * if b_publickey is not None: # <<<<<<<<<<<<<< @@ -7603,7 +7743,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( __pyx_t_2 = (__pyx_v_b_publickey != ((PyObject*)Py_None)); if (__pyx_t_2) { - /* "ssh2/session.pyx":217 + /* "ssh2/session.pyx":227 * cdef char *_passphrase = b_passphrase * if b_publickey is not None: * _publickey = b_publickey # <<<<<<<<<<<<<< @@ -7612,12 +7752,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(1, 217, __pyx_L1_error) + __PYX_ERR(1, 227, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_publickey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 217, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_publickey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 227, __pyx_L1_error) __pyx_v__publickey = __pyx_t_4; - /* "ssh2/session.pyx":216 + /* "ssh2/session.pyx":226 * cdef char *_privatekey = b_privatekey * cdef char *_passphrase = b_passphrase * if b_publickey is not None: # <<<<<<<<<<<<<< @@ -7626,7 +7766,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( */ } - /* "ssh2/session.pyx":218 + /* "ssh2/session.pyx":228 * if b_publickey is not None: * _publickey = b_publickey * with nogil: # <<<<<<<<<<<<<< @@ -7642,7 +7782,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( #endif /*try:*/ { - /* "ssh2/session.pyx":219 + /* "ssh2/session.pyx":229 * _publickey = b_publickey * with nogil: * rc = c_ssh2.libssh2_userauth_publickey_fromfile( # <<<<<<<<<<<<<< @@ -7652,7 +7792,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":218 + /* "ssh2/session.pyx":228 * if b_publickey is not None: * _publickey = b_publickey * with nogil: # <<<<<<<<<<<<<< @@ -7671,27 +7811,28 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( } } - /* "ssh2/session.pyx":221 + /* "ssh2/session.pyx":231 * rc = c_ssh2.libssh2_userauth_publickey_fromfile( * self._session, _username, _publickey, _privatekey, _passphrase) * return handle_error_codes(rc) # <<<<<<<<<<<<<< * - * def userauth_publickey(self, username not None, + * def userauth_publickey(self, username not None: AnyStr, */ __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(1, 221, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 221, __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, 231, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 231, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_t_1)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_t_1))) __PYX_ERR(1, 231, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":199 + /* "ssh2/session.pyx":209 * return auth.split(',') * - * def userauth_publickey_fromfile(self, username not None, # <<<<<<<<<<<<<< - * privatekey not None, - * passphrase='', + * def userauth_publickey_fromfile(self, username not None: AnyStr, # <<<<<<<<<<<<<< + * privatekey not None: AnyStr, + * passphrase: AnyStr='', */ /* function exit code */ @@ -7710,11 +7851,11 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_22userauth_publickey_fromfile( return __pyx_r; } -/* "ssh2/session.pyx":223 +/* "ssh2/session.pyx":233 * return handle_error_codes(rc) * - * def userauth_publickey(self, username not None, # <<<<<<<<<<<<<< - * bytes pubkeydata not None): + * def userauth_publickey(self, username not None: AnyStr, # <<<<<<<<<<<<<< + * bytes pubkeydata not None) -> int: * """Perform public key authentication with provided public key data */ @@ -7726,7 +7867,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_24userauth_publickey, "Session.userauth_publickey(self, username, bytes pubkeydata)\nPerform public key authentication with provided public key data\n\n :param username: User name to authenticate as\n :type username: str\n :param pubkeydata: Public key data\n :type pubkeydata: bytes\n\n :rtype: int"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_24userauth_publickey, "userauth_publickey(self, username: AnyStr, pubkeydata: bytes) -> int\nPerform public key authentication with provided public key data\n\n :param username: User name to authenticate as\n :type username: str\n :param pubkeydata: Public key data\n :type pubkeydata: bytes\n\n :rtype: int"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_25userauth_publickey = {"userauth_publickey", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_25userauth_publickey, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_24userauth_publickey}; static PyObject *__pyx_pw_4ssh2_7session_7Session_25userauth_publickey(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -7775,7 +7916,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 223, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 233, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: @@ -7783,14 +7924,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 223, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 233, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("userauth_publickey", 1, 2, 2, 1); __PYX_ERR(1, 223, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_publickey", 1, 2, 2, 1); __PYX_ERR(1, 233, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "userauth_publickey") < 0)) __PYX_ERR(1, 223, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "userauth_publickey") < 0)) __PYX_ERR(1, 233, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; @@ -7803,7 +7944,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("userauth_publickey", 1, 2, 2, __pyx_nargs); __PYX_ERR(1, 223, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_publickey", 1, 2, 2, __pyx_nargs); __PYX_ERR(1, 233, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -7818,9 +7959,9 @@ PyObject *__pyx_args, PyObject *__pyx_kwds 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(1, 223, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(1, 233, __pyx_L1_error) } - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pubkeydata), (&PyBytes_Type), 0, "pubkeydata", 1))) __PYX_ERR(1, 224, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pubkeydata), (&PyBytes_Type), 0, "pubkeydata", 1))) __PYX_ERR(1, 234, __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 */ @@ -7856,19 +7997,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_24userauth_publickey(struct __ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_publickey", 1); - /* "ssh2/session.pyx":234 + /* "ssh2/session.pyx":244 * :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(1, 234, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 244, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":235 + /* "ssh2/session.pyx":245 * cdef int rc * cdef bytes b_username = to_bytes(username) * cdef char *_username = b_username # <<<<<<<<<<<<<< @@ -7877,32 +8018,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(1, 235, __pyx_L1_error) + __PYX_ERR(1, 245, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 235, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 245, __pyx_L1_error) __pyx_v__username = __pyx_t_2; - /* "ssh2/session.pyx":236 + /* "ssh2/session.pyx":246 * 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(1, 236, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBytes_AsWritableUString(__pyx_v_pubkeydata); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(1, 246, __pyx_L1_error) __pyx_v__pubkeydata = __pyx_t_3; - /* "ssh2/session.pyx":237 + /* "ssh2/session.pyx":247 * 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 = __Pyx_PyBytes_GET_SIZE(__pyx_v_pubkeydata); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 237, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_GET_SIZE(__pyx_v_pubkeydata); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 247, __pyx_L1_error) __pyx_v_pubkeydata_len = __pyx_t_4; - /* "ssh2/session.pyx":238 + /* "ssh2/session.pyx":248 * cdef unsigned char *_pubkeydata = pubkeydata * cdef size_t pubkeydata_len = len(pubkeydata) * with nogil: # <<<<<<<<<<<<<< @@ -7918,7 +8059,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_24userauth_publickey(struct __ #endif /*try:*/ { - /* "ssh2/session.pyx":239 + /* "ssh2/session.pyx":249 * cdef size_t pubkeydata_len = len(pubkeydata) * with nogil: * rc = c_ssh2.libssh2_userauth_publickey( # <<<<<<<<<<<<<< @@ -7928,7 +8069,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":238 + /* "ssh2/session.pyx":248 * cdef unsigned char *_pubkeydata = pubkeydata * cdef size_t pubkeydata_len = len(pubkeydata) * with nogil: # <<<<<<<<<<<<<< @@ -7947,7 +8088,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_24userauth_publickey(struct __ } } - /* "ssh2/session.pyx":242 + /* "ssh2/session.pyx":252 * self._session, _username, _pubkeydata, * pubkeydata_len, NULL, NULL) * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -7955,18 +8096,19 @@ 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(1, 242, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 242, __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, 252, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_t_1)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_t_1))) __PYX_ERR(1, 252, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":223 + /* "ssh2/session.pyx":233 * return handle_error_codes(rc) * - * def userauth_publickey(self, username not None, # <<<<<<<<<<<<<< - * bytes pubkeydata not None): + * def userauth_publickey(self, username not None: AnyStr, # <<<<<<<<<<<<<< + * bytes pubkeydata not None) -> int: * """Perform public key authentication with provided public key data */ @@ -7982,12 +8124,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_24userauth_publickey(struct __ return __pyx_r; } -/* "ssh2/session.pyx":244 +/* "ssh2/session.pyx":254 * return handle_error_codes(rc) * * def userauth_hostbased_fromfile(self, # <<<<<<<<<<<<<< - * username not None, - * privatekey not None, + * username not None: AnyStr, + * privatekey not None: AnyStr, */ /* Python wrapper */ @@ -7998,7 +8140,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_26userauth_hostbased_fromfile, "Session.userauth_hostbased_fromfile(self, username, privatekey, hostname, publickey=None, passphrase=u'')"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_26userauth_hostbased_fromfile, "userauth_hostbased_fromfile(self, username: AnyStr, privatekey: AnyStr, hostname: AnyStr, publickey: AnyStr | None = None, passphrase: str = u'') -> int"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_27userauth_hostbased_fromfile = {"userauth_hostbased_fromfile", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_27userauth_hostbased_fromfile, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_26userauth_hostbased_fromfile}; static PyObject *__pyx_pw_4ssh2_7session_7Session_27userauth_hostbased_fromfile(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -8034,15 +8176,15 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_username,&__pyx_n_s_privatekey,&__pyx_n_s_hostname,&__pyx_n_s_publickey,&__pyx_n_s_passphrase,0}; - /* "ssh2/session.pyx":248 - * privatekey not None, - * hostname not None, - * publickey=None, # <<<<<<<<<<<<<< - * passphrase=''): + /* "ssh2/session.pyx":258 + * privatekey not None: AnyStr, + * hostname not None: AnyStr, + * publickey: AnyStr | None=None, # <<<<<<<<<<<<<< + * passphrase: str='') -> int: * cdef int rc */ values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); - values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_kp_u__2)); + values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)__pyx_kp_u__2)); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { @@ -8066,7 +8208,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 244, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 254, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: @@ -8074,9 +8216,9 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 244, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 254, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("userauth_hostbased_fromfile", 0, 3, 5, 1); __PYX_ERR(1, 244, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_hostbased_fromfile", 0, 3, 5, 1); __PYX_ERR(1, 254, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -8084,28 +8226,28 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 244, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 254, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("userauth_hostbased_fromfile", 0, 3, 5, 2); __PYX_ERR(1, 244, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_hostbased_fromfile", 0, 3, 5, 2); __PYX_ERR(1, 254, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_publickey); if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 244, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 254, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_passphrase); if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 244, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 254, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "userauth_hostbased_fromfile") < 0)) __PYX_ERR(1, 244, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "userauth_hostbased_fromfile") < 0)) __PYX_ERR(1, 254, __pyx_L3_error) } } else { switch (__pyx_nargs) { @@ -8124,11 +8266,11 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __pyx_v_privatekey = values[1]; __pyx_v_hostname = values[2]; __pyx_v_publickey = values[3]; - __pyx_v_passphrase = values[4]; + __pyx_v_passphrase = ((PyObject*)values[4]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("userauth_hostbased_fromfile", 0, 3, 5, __pyx_nargs); __PYX_ERR(1, 244, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_hostbased_fromfile", 0, 3, 5, __pyx_nargs); __PYX_ERR(1, 254, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -8143,22 +8285,23 @@ PyObject *__pyx_args, PyObject *__pyx_kwds 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(1, 245, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(1, 255, __pyx_L1_error) } if (unlikely(((PyObject *)__pyx_v_privatekey) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "privatekey"); __PYX_ERR(1, 246, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "privatekey"); __PYX_ERR(1, 256, __pyx_L1_error) } if (unlikely(((PyObject *)__pyx_v_hostname) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "hostname"); __PYX_ERR(1, 247, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "hostname"); __PYX_ERR(1, 257, __pyx_L1_error) } + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_passphrase), (&PyUnicode_Type), 0, "passphrase", 1))) __PYX_ERR(1, 259, __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":244 + /* "ssh2/session.pyx":254 * return handle_error_codes(rc) * * def userauth_hostbased_fromfile(self, # <<<<<<<<<<<<<< - * username not None, - * privatekey not None, + * username not None: AnyStr, + * privatekey not None: AnyStr, */ /* function exit code */ @@ -8200,19 +8343,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_hostbased_fromfile", 1); - /* "ssh2/session.pyx":251 - * passphrase=''): + /* "ssh2/session.pyx":261 + * passphrase: str='') -> 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(1, 251, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 261, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":253 + /* "ssh2/session.pyx":263 * cdef bytes b_username = to_bytes(username) * cdef bytes b_publickey = to_bytes(publickey) \ * if publickey is not None else None # <<<<<<<<<<<<<< @@ -8222,20 +8365,20 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( __pyx_t_2 = (__pyx_v_publickey != Py_None); if (__pyx_t_2) { - /* "ssh2/session.pyx":252 + /* "ssh2/session.pyx":262 * 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(1, 252, __pyx_L1_error) + __pyx_t_3 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_publickey); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 262, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; } else { - /* "ssh2/session.pyx":253 + /* "ssh2/session.pyx":263 * cdef bytes b_username = to_bytes(username) * cdef bytes b_publickey = to_bytes(publickey) \ * if publickey is not None else None # <<<<<<<<<<<<<< @@ -8246,54 +8389,54 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( __pyx_t_1 = Py_None; } - /* "ssh2/session.pyx":252 + /* "ssh2/session.pyx":262 * 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) */ - if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_1))) __PYX_ERR(1, 252, __pyx_L1_error) + if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_1))) __PYX_ERR(1, 262, __pyx_L1_error) __pyx_v_b_publickey = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":254 + /* "ssh2/session.pyx":264 * 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(1, 254, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_privatekey); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 264, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_privatekey = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":255 + /* "ssh2/session.pyx":265 * 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(1, 255, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_passphrase); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 265, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_passphrase = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":256 + /* "ssh2/session.pyx":266 * 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(1, 256, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_hostname); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 266, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_hostname = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":257 + /* "ssh2/session.pyx":267 * cdef bytes b_passphrase = to_bytes(passphrase) * cdef bytes b_hostname = to_bytes(hostname) * cdef char *_username = b_username # <<<<<<<<<<<<<< @@ -8302,12 +8445,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(1, 257, __pyx_L1_error) + __PYX_ERR(1, 267, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 257, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 267, __pyx_L1_error) __pyx_v__username = __pyx_t_4; - /* "ssh2/session.pyx":258 + /* "ssh2/session.pyx":268 * cdef bytes b_hostname = to_bytes(hostname) * cdef char *_username = b_username * cdef char *_publickey = NULL # <<<<<<<<<<<<<< @@ -8316,7 +8459,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( */ __pyx_v__publickey = NULL; - /* "ssh2/session.pyx":259 + /* "ssh2/session.pyx":269 * cdef char *_username = b_username * cdef char *_publickey = NULL * cdef char *_privatekey = b_privatekey # <<<<<<<<<<<<<< @@ -8325,12 +8468,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(1, 259, __pyx_L1_error) + __PYX_ERR(1, 269, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_privatekey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 259, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_privatekey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 269, __pyx_L1_error) __pyx_v__privatekey = __pyx_t_4; - /* "ssh2/session.pyx":260 + /* "ssh2/session.pyx":270 * cdef char *_publickey = NULL * cdef char *_privatekey = b_privatekey * cdef char *_passphrase = b_passphrase # <<<<<<<<<<<<<< @@ -8339,12 +8482,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(1, 260, __pyx_L1_error) + __PYX_ERR(1, 270, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_passphrase); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 260, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_passphrase); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 270, __pyx_L1_error) __pyx_v__passphrase = __pyx_t_4; - /* "ssh2/session.pyx":261 + /* "ssh2/session.pyx":271 * cdef char *_privatekey = b_privatekey * cdef char *_passphrase = b_passphrase * cdef char *_hostname = b_hostname # <<<<<<<<<<<<<< @@ -8353,12 +8496,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(1, 261, __pyx_L1_error) + __PYX_ERR(1, 271, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_hostname); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 261, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_hostname); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 271, __pyx_L1_error) __pyx_v__hostname = __pyx_t_4; - /* "ssh2/session.pyx":262 + /* "ssh2/session.pyx":272 * cdef char *_passphrase = b_passphrase * cdef char *_hostname = b_hostname * if b_publickey is not None: # <<<<<<<<<<<<<< @@ -8368,7 +8511,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( __pyx_t_2 = (__pyx_v_b_publickey != ((PyObject*)Py_None)); if (__pyx_t_2) { - /* "ssh2/session.pyx":263 + /* "ssh2/session.pyx":273 * cdef char *_hostname = b_hostname * if b_publickey is not None: * _publickey = b_publickey # <<<<<<<<<<<<<< @@ -8377,12 +8520,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(1, 263, __pyx_L1_error) + __PYX_ERR(1, 273, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_publickey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 263, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_publickey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 273, __pyx_L1_error) __pyx_v__publickey = __pyx_t_4; - /* "ssh2/session.pyx":262 + /* "ssh2/session.pyx":272 * cdef char *_passphrase = b_passphrase * cdef char *_hostname = b_hostname * if b_publickey is not None: # <<<<<<<<<<<<<< @@ -8391,7 +8534,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( */ } - /* "ssh2/session.pyx":264 + /* "ssh2/session.pyx":274 * if b_publickey is not None: * _publickey = b_publickey * with nogil: # <<<<<<<<<<<<<< @@ -8407,7 +8550,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( #endif /*try:*/ { - /* "ssh2/session.pyx":265 + /* "ssh2/session.pyx":275 * _publickey = b_publickey * with nogil: * rc = c_ssh2.libssh2_userauth_hostbased_fromfile( # <<<<<<<<<<<<<< @@ -8417,7 +8560,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":264 + /* "ssh2/session.pyx":274 * if b_publickey is not None: * _publickey = b_publickey * with nogil: # <<<<<<<<<<<<<< @@ -8436,7 +8579,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( } } - /* "ssh2/session.pyx":268 + /* "ssh2/session.pyx":278 * self._session, _username, _publickey, * _privatekey, _passphrase, _hostname) * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -8444,19 +8587,20 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( * def userauth_publickey_frommemory( */ __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(1, 268, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 268, __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, 278, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 278, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_t_1)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_t_1))) __PYX_ERR(1, 278, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":244 + /* "ssh2/session.pyx":254 * return handle_error_codes(rc) * * def userauth_hostbased_fromfile(self, # <<<<<<<<<<<<<< - * username not None, - * privatekey not None, + * username not None: AnyStr, + * privatekey not None: AnyStr, */ /* function exit code */ @@ -8476,12 +8620,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_26userauth_hostbased_fromfile( return __pyx_r; } -/* "ssh2/session.pyx":270 +/* "ssh2/session.pyx":280 * return handle_error_codes(rc) * * def userauth_publickey_frommemory( # <<<<<<<<<<<<<< - * self, username, bytes privatekeyfiledata, - * passphrase='', bytes publickeyfiledata=None): + * self, username: AnyStr, bytes privatekeyfiledata, + * passphrase: str='', bytes publickeyfiledata: bytes | None=None) -> int: */ /* Python wrapper */ @@ -8492,7 +8636,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_28userauth_publickey_frommemory, "Session.userauth_publickey_frommemory(self, username, bytes privatekeyfiledata, passphrase=u'', bytes publickeyfiledata=None)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_28userauth_publickey_frommemory, "userauth_publickey_frommemory(self, username: AnyStr, privatekeyfiledata: bytes, passphrase: str = u'', publickeyfiledata: bytes | None = None) -> int"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_29userauth_publickey_frommemory = {"userauth_publickey_frommemory", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_29userauth_publickey_frommemory, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_28userauth_publickey_frommemory}; static PyObject *__pyx_pw_4ssh2_7session_7Session_29userauth_publickey_frommemory(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -8526,12 +8670,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_username,&__pyx_n_s_privatekeyfiledata,&__pyx_n_s_passphrase,&__pyx_n_s_publickeyfiledata,0}; - values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_kp_u__2)); + values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)__pyx_kp_u__2)); - /* "ssh2/session.pyx":272 + /* "ssh2/session.pyx":282 * def userauth_publickey_frommemory( - * self, username, bytes privatekeyfiledata, - * passphrase='', bytes publickeyfiledata=None): # <<<<<<<<<<<<<< + * self, username: AnyStr, bytes privatekeyfiledata, + * passphrase: str='', bytes publickeyfiledata: bytes | None=None) -> int: # <<<<<<<<<<<<<< * cdef int rc * cdef bytes b_username = to_bytes(username) */ @@ -8557,7 +8701,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 270, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 280, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: @@ -8565,28 +8709,28 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 270, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 280, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("userauth_publickey_frommemory", 0, 2, 4, 1); __PYX_ERR(1, 270, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_publickey_frommemory", 0, 2, 4, 1); __PYX_ERR(1, 280, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_passphrase); if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 270, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 280, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_publickeyfiledata); if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 270, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 280, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "userauth_publickey_frommemory") < 0)) __PYX_ERR(1, 270, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "userauth_publickey_frommemory") < 0)) __PYX_ERR(1, 280, __pyx_L3_error) } } else { switch (__pyx_nargs) { @@ -8602,12 +8746,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } __pyx_v_username = values[0]; __pyx_v_privatekeyfiledata = ((PyObject*)values[1]); - __pyx_v_passphrase = values[2]; + __pyx_v_passphrase = ((PyObject*)values[2]); __pyx_v_publickeyfiledata = ((PyObject*)values[3]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("userauth_publickey_frommemory", 0, 2, 4, __pyx_nargs); __PYX_ERR(1, 270, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_publickey_frommemory", 0, 2, 4, __pyx_nargs); __PYX_ERR(1, 280, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -8621,16 +8765,17 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_privatekeyfiledata), (&PyBytes_Type), 1, "privatekeyfiledata", 1))) __PYX_ERR(1, 271, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_publickeyfiledata), (&PyBytes_Type), 1, "publickeyfiledata", 1))) __PYX_ERR(1, 272, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_privatekeyfiledata), (&PyBytes_Type), 1, "privatekeyfiledata", 1))) __PYX_ERR(1, 281, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_passphrase), (&PyUnicode_Type), 0, "passphrase", 1))) __PYX_ERR(1, 282, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_publickeyfiledata), (&PyBytes_Type), 1, "publickeyfiledata", 1))) __PYX_ERR(1, 282, __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":270 + /* "ssh2/session.pyx":280 * return handle_error_codes(rc) * * def userauth_publickey_frommemory( # <<<<<<<<<<<<<< - * self, username, bytes privatekeyfiledata, - * passphrase='', bytes publickeyfiledata=None): + * self, username: AnyStr, bytes privatekeyfiledata, + * passphrase: str='', bytes publickeyfiledata: bytes | None=None) -> int: */ /* function exit code */ @@ -8672,31 +8817,31 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_publickey_frommemory", 1); - /* "ssh2/session.pyx":274 - * passphrase='', bytes publickeyfiledata=None): + /* "ssh2/session.pyx":284 + * passphrase: str='', bytes publickeyfiledata: bytes | None=None) -> int: * 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(1, 274, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 284, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":275 + /* "ssh2/session.pyx":285 * 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(1, 275, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_passphrase); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 285, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_passphrase = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":276 + /* "ssh2/session.pyx":286 * cdef bytes b_username = to_bytes(username) * cdef bytes b_passphrase = to_bytes(passphrase) * cdef char *_username = b_username # <<<<<<<<<<<<<< @@ -8705,12 +8850,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(1, 276, __pyx_L1_error) + __PYX_ERR(1, 286, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 276, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 286, __pyx_L1_error) __pyx_v__username = __pyx_t_2; - /* "ssh2/session.pyx":277 + /* "ssh2/session.pyx":287 * cdef bytes b_passphrase = to_bytes(passphrase) * cdef char *_username = b_username * cdef char *_passphrase = b_passphrase # <<<<<<<<<<<<<< @@ -8719,12 +8864,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(1, 277, __pyx_L1_error) + __PYX_ERR(1, 287, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_passphrase); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 277, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_passphrase); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 287, __pyx_L1_error) __pyx_v__passphrase = __pyx_t_2; - /* "ssh2/session.pyx":278 + /* "ssh2/session.pyx":288 * cdef char *_username = b_username * cdef char *_passphrase = b_passphrase * cdef char *_publickeyfiledata = NULL # <<<<<<<<<<<<<< @@ -8733,7 +8878,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor */ __pyx_v__publickeyfiledata = NULL; - /* "ssh2/session.pyx":279 + /* "ssh2/session.pyx":289 * cdef char *_passphrase = b_passphrase * cdef char *_publickeyfiledata = NULL * cdef char *_privatekeyfiledata = privatekeyfiledata # <<<<<<<<<<<<<< @@ -8742,12 +8887,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(1, 279, __pyx_L1_error) + __PYX_ERR(1, 289, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_privatekeyfiledata); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 279, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_privatekeyfiledata); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 289, __pyx_L1_error) __pyx_v__privatekeyfiledata = __pyx_t_2; - /* "ssh2/session.pyx":281 + /* "ssh2/session.pyx":291 * cdef char *_privatekeyfiledata = privatekeyfiledata * cdef size_t username_len, privatekeydata_len * cdef size_t pubkeydata_len = 0 # <<<<<<<<<<<<<< @@ -8756,7 +8901,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor */ __pyx_v_pubkeydata_len = 0; - /* "ssh2/session.pyx":283 + /* "ssh2/session.pyx":293 * cdef size_t pubkeydata_len = 0 * username_len, privatekeydata_len = \ * len(b_username), len(privatekeyfiledata) # <<<<<<<<<<<<<< @@ -8765,18 +8910,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(1, 283, __pyx_L1_error) + __PYX_ERR(1, 293, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyBytes_GET_SIZE(__pyx_v_b_username); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 283, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBytes_GET_SIZE(__pyx_v_b_username); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 293, __pyx_L1_error) if (unlikely(__pyx_v_privatekeyfiledata == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(1, 283, __pyx_L1_error) + __PYX_ERR(1, 293, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_GET_SIZE(__pyx_v_privatekeyfiledata); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 283, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_GET_SIZE(__pyx_v_privatekeyfiledata); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 293, __pyx_L1_error) __pyx_v_username_len = __pyx_t_3; __pyx_v_privatekeydata_len = __pyx_t_4; - /* "ssh2/session.pyx":284 + /* "ssh2/session.pyx":294 * username_len, privatekeydata_len = \ * len(b_username), len(privatekeyfiledata) * if publickeyfiledata is not None: # <<<<<<<<<<<<<< @@ -8786,7 +8931,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor __pyx_t_5 = (__pyx_v_publickeyfiledata != ((PyObject*)Py_None)); if (__pyx_t_5) { - /* "ssh2/session.pyx":285 + /* "ssh2/session.pyx":295 * len(b_username), len(privatekeyfiledata) * if publickeyfiledata is not None: * _publickeyfiledata = publickeyfiledata # <<<<<<<<<<<<<< @@ -8795,12 +8940,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(1, 285, __pyx_L1_error) + __PYX_ERR(1, 295, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_publickeyfiledata); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 285, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_publickeyfiledata); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 295, __pyx_L1_error) __pyx_v__publickeyfiledata = __pyx_t_2; - /* "ssh2/session.pyx":286 + /* "ssh2/session.pyx":296 * if publickeyfiledata is not None: * _publickeyfiledata = publickeyfiledata * pubkeydata_len = len(publickeyfiledata) # <<<<<<<<<<<<<< @@ -8809,12 +8954,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(1, 286, __pyx_L1_error) + __PYX_ERR(1, 296, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_GET_SIZE(__pyx_v_publickeyfiledata); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 286, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_GET_SIZE(__pyx_v_publickeyfiledata); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 296, __pyx_L1_error) __pyx_v_pubkeydata_len = __pyx_t_4; - /* "ssh2/session.pyx":284 + /* "ssh2/session.pyx":294 * username_len, privatekeydata_len = \ * len(b_username), len(privatekeyfiledata) * if publickeyfiledata is not None: # <<<<<<<<<<<<<< @@ -8823,7 +8968,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor */ } - /* "ssh2/session.pyx":287 + /* "ssh2/session.pyx":297 * _publickeyfiledata = publickeyfiledata * pubkeydata_len = len(publickeyfiledata) * with nogil: # <<<<<<<<<<<<<< @@ -8839,7 +8984,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor #endif /*try:*/ { - /* "ssh2/session.pyx":288 + /* "ssh2/session.pyx":298 * pubkeydata_len = len(publickeyfiledata) * with nogil: * rc = c_ssh2.libssh2_userauth_publickey_frommemory( # <<<<<<<<<<<<<< @@ -8849,7 +8994,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":287 + /* "ssh2/session.pyx":297 * _publickeyfiledata = publickeyfiledata * pubkeydata_len = len(publickeyfiledata) * with nogil: # <<<<<<<<<<<<<< @@ -8868,27 +9013,28 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor } } - /* "ssh2/session.pyx":292 + /* "ssh2/session.pyx":302 * pubkeydata_len, _privatekeyfiledata, * privatekeydata_len, _passphrase) * return handle_error_codes(rc) # <<<<<<<<<<<<<< * - * def userauth_password(self, username not None, password not None): + * def userauth_password(self, username not None: AnyStr, password not None: AnyStr) -> int: */ __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(1, 292, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 292, __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, 302, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_t_1)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_t_1))) __PYX_ERR(1, 302, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":270 + /* "ssh2/session.pyx":280 * return handle_error_codes(rc) * * def userauth_publickey_frommemory( # <<<<<<<<<<<<<< - * self, username, bytes privatekeyfiledata, - * passphrase='', bytes publickeyfiledata=None): + * self, username: AnyStr, bytes privatekeyfiledata, + * passphrase: str='', bytes publickeyfiledata: bytes | None=None) -> int: */ /* function exit code */ @@ -8904,10 +9050,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_publickey_frommemor return __pyx_r; } -/* "ssh2/session.pyx":294 +/* "ssh2/session.pyx":304 * return handle_error_codes(rc) * - * def userauth_password(self, username not None, password not None): # <<<<<<<<<<<<<< + * def userauth_password(self, username not None: AnyStr, password not None: AnyStr) -> int: # <<<<<<<<<<<<<< * """Perform password authentication * */ @@ -8920,7 +9066,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_30userauth_password, "Session.userauth_password(self, username, password)\nPerform password authentication\n\n :param username: User name to authenticate.\n :type username: str\n :param password: Password\n :type password: str"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_30userauth_password, "userauth_password(self, username: AnyStr, password: AnyStr) -> int\nPerform password authentication\n\n :param username: User name to authenticate.\n :type username: str\n :param password: Password\n :type password: str"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_31userauth_password = {"userauth_password", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_31userauth_password, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_30userauth_password}; static PyObject *__pyx_pw_4ssh2_7session_7Session_31userauth_password(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -8969,7 +9115,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 294, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 304, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: @@ -8977,14 +9123,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 294, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 304, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("userauth_password", 1, 2, 2, 1); __PYX_ERR(1, 294, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_password", 1, 2, 2, 1); __PYX_ERR(1, 304, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "userauth_password") < 0)) __PYX_ERR(1, 294, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "userauth_password") < 0)) __PYX_ERR(1, 304, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; @@ -8997,7 +9143,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("userauth_password", 1, 2, 2, __pyx_nargs); __PYX_ERR(1, 294, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_password", 1, 2, 2, __pyx_nargs); __PYX_ERR(1, 304, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -9012,10 +9158,10 @@ PyObject *__pyx_args, PyObject *__pyx_kwds 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(1, 294, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(1, 304, __pyx_L1_error) } if (unlikely(((PyObject *)__pyx_v_password) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "password"); __PYX_ERR(1, 294, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "password"); __PYX_ERR(1, 304, __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); @@ -9051,31 +9197,31 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_30userauth_password(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("userauth_password", 1); - /* "ssh2/session.pyx":302 + /* "ssh2/session.pyx":312 * :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(1, 302, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 312, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":303 + /* "ssh2/session.pyx":313 * 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(1, 303, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_password); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 313, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_password = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":304 + /* "ssh2/session.pyx":314 * cdef bytes b_username = to_bytes(username) * cdef bytes b_password = to_bytes(password) * cdef const char *_username = b_username # <<<<<<<<<<<<<< @@ -9084,12 +9230,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(1, 304, __pyx_L1_error) + __PYX_ERR(1, 314, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 304, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 314, __pyx_L1_error) __pyx_v__username = __pyx_t_2; - /* "ssh2/session.pyx":305 + /* "ssh2/session.pyx":315 * cdef bytes b_password = to_bytes(password) * cdef const char *_username = b_username * cdef const char *_password = b_password # <<<<<<<<<<<<<< @@ -9098,12 +9244,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(1, 305, __pyx_L1_error) + __PYX_ERR(1, 315, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyBytes_AsString(__pyx_v_b_password); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(1, 305, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBytes_AsString(__pyx_v_b_password); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(1, 315, __pyx_L1_error) __pyx_v__password = __pyx_t_3; - /* "ssh2/session.pyx":306 + /* "ssh2/session.pyx":316 * cdef const char *_username = b_username * cdef const char *_password = b_password * with nogil: # <<<<<<<<<<<<<< @@ -9119,7 +9265,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_30userauth_password(struct __p #endif /*try:*/ { - /* "ssh2/session.pyx":307 + /* "ssh2/session.pyx":317 * cdef const char *_password = b_password * with nogil: * rc = c_ssh2.libssh2_userauth_password( # <<<<<<<<<<<<<< @@ -9129,7 +9275,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":306 + /* "ssh2/session.pyx":316 * cdef const char *_username = b_username * cdef const char *_password = b_password * with nogil: # <<<<<<<<<<<<<< @@ -9148,25 +9294,26 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_30userauth_password(struct __p } } - /* "ssh2/session.pyx":309 + /* "ssh2/session.pyx":319 * rc = c_ssh2.libssh2_userauth_password( * self._session, _username, _password) * return handle_error_codes(rc) # <<<<<<<<<<<<<< * - * def userauth_keyboardinteractive(self, username not None, + * def userauth_keyboardinteractive(self, username not None: AnyStr, */ __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(1, 309, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 309, __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, 319, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 319, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_t_1)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_t_1))) __PYX_ERR(1, 319, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":294 + /* "ssh2/session.pyx":304 * return handle_error_codes(rc) * - * def userauth_password(self, username not None, password not None): # <<<<<<<<<<<<<< + * def userauth_password(self, username not None: AnyStr, password not None: AnyStr) -> int: # <<<<<<<<<<<<<< * """Perform password authentication * */ @@ -9184,11 +9331,11 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_30userauth_password(struct __p return __pyx_r; } -/* "ssh2/session.pyx":311 +/* "ssh2/session.pyx":321 * return handle_error_codes(rc) * - * def userauth_keyboardinteractive(self, username not None, # <<<<<<<<<<<<<< - * password not None): + * def userauth_keyboardinteractive(self, username not None: AnyStr, # <<<<<<<<<<<<<< + * password not None: AnyStr) -> int: * """Perform keyboard-interactive authentication */ @@ -9200,7 +9347,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_32userauth_keyboardinteractive, "Session.userauth_keyboardinteractive(self, username, password)\nPerform keyboard-interactive authentication\n\n :param username: User name to authenticate.\n :type username: str\n :param password: Password\n :type password: str\n "); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_32userauth_keyboardinteractive, "userauth_keyboardinteractive(self, username: AnyStr, password: AnyStr) -> int\nPerform keyboard-interactive authentication\n\n :param username: User name to authenticate.\n :type username: str\n :param password: Password\n :type password: str\n "); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_33userauth_keyboardinteractive = {"userauth_keyboardinteractive", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_33userauth_keyboardinteractive, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_32userauth_keyboardinteractive}; static PyObject *__pyx_pw_4ssh2_7session_7Session_33userauth_keyboardinteractive(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -9249,7 +9396,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 311, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 321, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: @@ -9257,14 +9404,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 311, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 321, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("userauth_keyboardinteractive", 1, 2, 2, 1); __PYX_ERR(1, 311, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_keyboardinteractive", 1, 2, 2, 1); __PYX_ERR(1, 321, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "userauth_keyboardinteractive") < 0)) __PYX_ERR(1, 311, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "userauth_keyboardinteractive") < 0)) __PYX_ERR(1, 321, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; @@ -9277,7 +9424,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("userauth_keyboardinteractive", 1, 2, 2, __pyx_nargs); __PYX_ERR(1, 311, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("userauth_keyboardinteractive", 1, 2, 2, __pyx_nargs); __PYX_ERR(1, 321, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -9292,10 +9439,10 @@ PyObject *__pyx_args, PyObject *__pyx_kwds 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(1, 311, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(1, 321, __pyx_L1_error) } if (unlikely(((PyObject *)__pyx_v_password) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "password"); __PYX_ERR(1, 312, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "password"); __PYX_ERR(1, 322, __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); @@ -9314,7 +9461,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -/* "ssh2/session.pyx":324 +/* "ssh2/session.pyx":334 * cdef const char *_username = b_username * * def passwd(): # <<<<<<<<<<<<<< @@ -9350,7 +9497,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":325 + /* "ssh2/session.pyx":335 * * def passwd(): * return password # <<<<<<<<<<<<<< @@ -9358,12 +9505,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(1, 325, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_v_password)) { __Pyx_RaiseClosureNameError("password"); __PYX_ERR(1, 335, __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":324 + /* "ssh2/session.pyx":334 * cdef const char *_username = b_username * * def passwd(): # <<<<<<<<<<<<<< @@ -9381,11 +9528,11 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_28userauth_keyboardinteractive return __pyx_r; } -/* "ssh2/session.pyx":311 +/* "ssh2/session.pyx":321 * return handle_error_codes(rc) * - * def userauth_keyboardinteractive(self, username not None, # <<<<<<<<<<<<<< - * password not None): + * def userauth_keyboardinteractive(self, username not None: AnyStr, # <<<<<<<<<<<<<< + * password not None: AnyStr) -> int: * """Perform keyboard-interactive authentication */ @@ -9408,7 +9555,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(1, 311, __pyx_L1_error) + __PYX_ERR(1, 321, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -9416,19 +9563,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":321 + /* "ssh2/session.pyx":331 * """ * 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(1, 321, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 331, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_username = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":322 + /* "ssh2/session.pyx":332 * cdef int rc * cdef bytes b_username = to_bytes(username) * cdef const char *_username = b_username # <<<<<<<<<<<<<< @@ -9437,24 +9584,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(1, 322, __pyx_L1_error) + __PYX_ERR(1, 332, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 322, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_b_username); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 332, __pyx_L1_error) __pyx_v__username = __pyx_t_2; - /* "ssh2/session.pyx":324 + /* "ssh2/session.pyx":334 * 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(1, 324, __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__3)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 334, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_passwd = __pyx_t_1; __pyx_t_1 = 0; - /* "ssh2/session.pyx":327 + /* "ssh2/session.pyx":337 * return password * * self._kbd_callback = passwd # <<<<<<<<<<<<<< @@ -9467,7 +9614,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":328 + /* "ssh2/session.pyx":338 * * self._kbd_callback = passwd * rc = c_ssh2.libssh2_userauth_keyboard_interactive( # <<<<<<<<<<<<<< @@ -9476,7 +9623,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":330 + /* "ssh2/session.pyx":340 * rc = c_ssh2.libssh2_userauth_keyboard_interactive( * self._session, _username, &kbd_callback) * self._kbd_callback = None # <<<<<<<<<<<<<< @@ -9489,26 +9636,27 @@ 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":331 + /* "ssh2/session.pyx":341 * self._session, _username, &kbd_callback) * self._kbd_callback = None * return handle_error_codes(rc) # <<<<<<<<<<<<<< * - * def agent_init(self): + * def agent_init(self) -> "Agent": */ __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(1, 331, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 331, __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, 341, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 341, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_t_1)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_t_1))) __PYX_ERR(1, 341, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":311 + /* "ssh2/session.pyx":321 * return handle_error_codes(rc) * - * def userauth_keyboardinteractive(self, username not None, # <<<<<<<<<<<<<< - * password not None): + * def userauth_keyboardinteractive(self, username not None: AnyStr, # <<<<<<<<<<<<<< + * password not None: AnyStr) -> int: * """Perform keyboard-interactive authentication */ @@ -9526,10 +9674,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_32userauth_keyboardinteractive return __pyx_r; } -/* "ssh2/session.pyx":333 +/* "ssh2/session.pyx":343 * return handle_error_codes(rc) * - * def agent_init(self): # <<<<<<<<<<<<<< + * def agent_init(self) -> "Agent": # <<<<<<<<<<<<<< * """Initialise SSH agent. * */ @@ -9542,7 +9690,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_34agent_init, "Session.agent_init(self)\nInitialise SSH agent.\n\n :rtype: :py:class:`ssh2.agent.Agent`\n "); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_34agent_init, "agent_init(self) -> 'Agent'\nInitialise SSH agent.\n\n :rtype: :py:class:`ssh2.agent.Agent`\n "); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_35agent_init = {"agent_init", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_35agent_init, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_34agent_init}; static PyObject *__pyx_pw_4ssh2_7session_7Session_35agent_init(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -9587,7 +9735,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_34agent_init(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("agent_init", 1); - /* "ssh2/session.pyx":339 + /* "ssh2/session.pyx":349 * """ * cdef c_ssh2.LIBSSH2_AGENT *agent * with nogil: # <<<<<<<<<<<<<< @@ -9603,18 +9751,18 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_34agent_init(struct __pyx_obj_ #endif /*try:*/ { - /* "ssh2/session.pyx":340 + /* "ssh2/session.pyx":350 * 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(1, 340, __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, 350, __pyx_L4_error) __pyx_v_agent = __pyx_t_1; } - /* "ssh2/session.pyx":339 + /* "ssh2/session.pyx":349 * """ * cdef c_ssh2.LIBSSH2_AGENT *agent * with nogil: # <<<<<<<<<<<<<< @@ -9640,24 +9788,24 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_34agent_init(struct __pyx_obj_ } } - /* "ssh2/session.pyx":341 + /* "ssh2/session.pyx":351 * with nogil: * agent = agent_init(self._session) * return PyAgent(agent, self) # <<<<<<<<<<<<<< * - * def agent_auth(self, username not None): + * def agent_auth(self, username not None: AnyStr) -> 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(1, 341, __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, 351, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":333 + /* "ssh2/session.pyx":343 * return handle_error_codes(rc) * - * def agent_init(self): # <<<<<<<<<<<<<< + * def agent_init(self) -> "Agent": # <<<<<<<<<<<<<< * """Initialise SSH agent. * */ @@ -9673,10 +9821,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_34agent_init(struct __pyx_obj_ return __pyx_r; } -/* "ssh2/session.pyx":343 +/* "ssh2/session.pyx":353 * return PyAgent(agent, self) * - * def agent_auth(self, username not None): # <<<<<<<<<<<<<< + * def agent_auth(self, username not None: AnyStr) -> None: # <<<<<<<<<<<<<< * """Convenience function for performing user authentication via SSH Agent. * */ @@ -9689,7 +9837,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_36agent_auth, "Session.agent_auth(self, username)\nConvenience function for performing user authentication via SSH Agent.\n\n Initialises, connects to, gets list of identities from and attempts\n authentication with each identity from SSH agent.\n\n Note that agent connections cannot be used in non-blocking mode -\n clients should call `set_blocking(0)` *after* calling this function.\n\n On completion, or any errors, agent is disconnected and resources freed.\n\n All steps are performed in C space which makes this function perform\n better than calling the individual Agent class functions from\n Python.\n\n :raises: :py:class:`MemoryError` on error initialising agent\n :raises: :py:class:`ssh2.exceptions.AgentConnectionError` on error\n connecting to agent\n :raises: :py:class:`ssh2.exceptions.AgentListIdentitiesError` on error\n getting identities from agent\n :raises: :py:class:`ssh2.exceptions.AgentAuthenticationError` on no\n successful authentication with all available identities.\n :raises: :py:class:`ssh2.exceptions.AgentGetIdentityError` on error\n getting known identity from agent\n\n :rtype: None"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_36agent_auth, "agent_auth(self, username: AnyStr) -> None\nConvenience function for performing user authentication via SSH Agent.\n\n Initialises, connects to, gets list of identities from and attempts\n authentication with each identity from SSH agent in order.\n\n Note that agent connections cannot be used in non-blocking mode -\n clients should call `set_blocking(0)` *after* calling this function.\n\n On completion, or any errors, agent is disconnected and resources freed.\n\n All steps are performed in C space which makes this function perform\n better than calling the individual Agent class functions from\n Python.\n\n :param username: The username to connect to agent as.\n\n :raises: :py:class:`MemoryError` on error initialising agent\n :raises: :py:class:`ssh2.exceptions.AgentConnectionError` on error\n connecting to agent\n :raises: :py:class:`ssh2.exceptions.AgentListIdentitiesError` on error\n getting identities from agent\n :raises: :py:class:`ssh2.exceptions.AgentAuthenticationError` on no\n successful authentication with all available identities.\n :raises: :py:class:`ssh2.exceptions.AgentGetIdentityError` on error\n getting known identity from agent\n\n :rtype: None"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_37agent_auth = {"agent_auth", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_37agent_auth, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_36agent_auth}; static PyObject *__pyx_pw_4ssh2_7session_7Session_37agent_auth(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -9735,12 +9883,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 343, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 353, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "agent_auth") < 0)) __PYX_ERR(1, 343, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "agent_auth") < 0)) __PYX_ERR(1, 353, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; @@ -9751,7 +9899,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("agent_auth", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 343, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("agent_auth", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 353, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -9766,7 +9914,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds 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(1, 343, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "username"); __PYX_ERR(1, 353, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_36agent_auth(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_username); @@ -9802,19 +9950,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("agent_auth", 1); - /* "ssh2/session.pyx":369 + /* "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(1, 369, __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":370 + /* "ssh2/session.pyx":382 * :rtype: None""" * cdef bytes b_username = to_bytes(username) * cdef char *_username = b_username # <<<<<<<<<<<<<< @@ -9823,12 +9971,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(1, 370, __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(1, 370, __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":371 + /* "ssh2/session.pyx":383 * cdef bytes b_username = to_bytes(username) * cdef char *_username = b_username * cdef c_ssh2.LIBSSH2_AGENT *agent = NULL # <<<<<<<<<<<<<< @@ -9837,7 +9985,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ */ __pyx_v_agent = NULL; - /* "ssh2/session.pyx":372 + /* "ssh2/session.pyx":384 * cdef char *_username = b_username * cdef c_ssh2.LIBSSH2_AGENT *agent = NULL * cdef c_ssh2.libssh2_agent_publickey *identity = NULL # <<<<<<<<<<<<<< @@ -9846,7 +9994,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ */ __pyx_v_identity = NULL; - /* "ssh2/session.pyx":373 + /* "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 # <<<<<<<<<<<<<< @@ -9855,17 +10003,17 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ */ __pyx_v_prev = NULL; - /* "ssh2/session.pyx":374 + /* "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(1, 374, __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":375 + /* "ssh2/session.pyx":387 * cdef c_ssh2.libssh2_agent_publickey *prev = NULL * agent = init_connect_agent(self._session) * with nogil: # <<<<<<<<<<<<<< @@ -9881,17 +10029,17 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ #endif /*try:*/ { - /* "ssh2/session.pyx":376 + /* "ssh2/session.pyx":388 * agent = init_connect_agent(self._session) * with nogil: * agent_auth(_username, agent) # <<<<<<<<<<<<<< * - * def open_session(self): + * def open_session(self) -> "Channel" | None: */ - __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, 376, __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":375 + /* "ssh2/session.pyx":387 * cdef c_ssh2.libssh2_agent_publickey *prev = NULL * agent = init_connect_agent(self._session) * with nogil: # <<<<<<<<<<<<<< @@ -9917,10 +10065,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ } } - /* "ssh2/session.pyx":343 + /* "ssh2/session.pyx":353 * return PyAgent(agent, self) * - * def agent_auth(self, username not None): # <<<<<<<<<<<<<< + * def agent_auth(self, username not None: AnyStr) -> None: # <<<<<<<<<<<<<< * """Convenience function for performing user authentication via SSH Agent. * */ @@ -9939,10 +10087,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_36agent_auth(struct __pyx_obj_ return __pyx_r; } -/* "ssh2/session.pyx":378 +/* "ssh2/session.pyx":390 * agent_auth(_username, agent) * - * def open_session(self): # <<<<<<<<<<<<<< + * def open_session(self) -> "Channel" | None: # <<<<<<<<<<<<<< * """Open new channel session. * */ @@ -9955,7 +10103,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_38open_session, "Session.open_session(self)\nOpen new channel session.\n\n :rtype: :py:class:`ssh2.channel.Channel`\n "); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_38open_session, "open_session(self) -> 'Channel' | None\nOpen new channel session.\n\n :rtype: :py:class:`ssh2.channel.Channel`\n "); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_39open_session = {"open_session", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_39open_session, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_38open_session}; static PyObject *__pyx_pw_4ssh2_7session_7Session_39open_session(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -10001,7 +10149,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob int __pyx_clineno = 0; __Pyx_RefNannySetupContext("open_session", 1); - /* "ssh2/session.pyx":384 + /* "ssh2/session.pyx":396 * """ * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -10017,7 +10165,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob #endif /*try:*/ { - /* "ssh2/session.pyx":385 + /* "ssh2/session.pyx":397 * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: * channel = c_ssh2.libssh2_channel_open_session( # <<<<<<<<<<<<<< @@ -10027,7 +10175,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":384 + /* "ssh2/session.pyx":396 * """ * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -10046,7 +10194,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob } } - /* "ssh2/session.pyx":387 + /* "ssh2/session.pyx":399 * channel = c_ssh2.libssh2_channel_open_session( * self._session) * if channel is NULL: # <<<<<<<<<<<<<< @@ -10056,7 +10204,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob __pyx_t_1 = (__pyx_v_channel == NULL); if (__pyx_t_1) { - /* "ssh2/session.pyx":388 + /* "ssh2/session.pyx":400 * self._session) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -10065,29 +10213,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":389 + /* "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(1, 388, __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":388 + /* "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(1, 388, __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":387 + /* "ssh2/session.pyx":399 * channel = c_ssh2.libssh2_channel_open_session( * self._session) * if channel is NULL: # <<<<<<<<<<<<<< @@ -10096,24 +10244,24 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob */ } - /* "ssh2/session.pyx":390 + /* "ssh2/session.pyx":402 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self) # <<<<<<<<<<<<<< * - * def direct_tcpip_ex(self, host not None, int port, + * def direct_tcpip_ex(self, host not None: AnyStr, 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(1, 390, __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":378 + /* "ssh2/session.pyx":390 * agent_auth(_username, agent) * - * def open_session(self): # <<<<<<<<<<<<<< + * def open_session(self) -> "Channel" | None: # <<<<<<<<<<<<<< * """Open new channel session. * */ @@ -10129,12 +10277,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_38open_session(struct __pyx_ob return __pyx_r; } -/* "ssh2/session.pyx":392 +/* "ssh2/session.pyx":404 * return PyChannel(channel, self) * - * def direct_tcpip_ex(self, host not None, int port, # <<<<<<<<<<<<<< - * shost not None, int sport): - * cdef c_ssh2.LIBSSH2_CHANNEL *channel + * def direct_tcpip_ex(self, host not None: AnyStr, int port, # <<<<<<<<<<<<<< + * shost not None: AnyStr, int sport) -> "Channel" | None: + * """Open direct TCP/IP channel to host:port and open listening connection */ /* Python wrapper */ @@ -10145,7 +10293,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_40direct_tcpip_ex, "Session.direct_tcpip_ex(self, host, int port, shost, int sport)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_40direct_tcpip_ex, "direct_tcpip_ex(self, host: AnyStr, port: int, shost: AnyStr, sport: int) -> 'Channel' | None\nOpen direct TCP/IP channel to host:port and open listening connection\n on shost:sport on the source host, meaning client side.\n\n Resulting connection is therefor shost:sport -> host:port.\n\n :rtype: :py:class:`ssh2.channel.Channel` or None\n "); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_41direct_tcpip_ex = {"direct_tcpip_ex", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_41direct_tcpip_ex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_40direct_tcpip_ex}; static PyObject *__pyx_pw_4ssh2_7session_7Session_41direct_tcpip_ex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -10200,7 +10348,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 392, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 404, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: @@ -10208,9 +10356,9 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 392, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 404, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, 1); __PYX_ERR(1, 392, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, 1); __PYX_ERR(1, 404, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -10218,9 +10366,9 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 392, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 404, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, 2); __PYX_ERR(1, 392, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, 2); __PYX_ERR(1, 404, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: @@ -10228,14 +10376,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 392, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 404, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, 3); __PYX_ERR(1, 392, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, 3); __PYX_ERR(1, 404, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "direct_tcpip_ex") < 0)) __PYX_ERR(1, 392, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "direct_tcpip_ex") < 0)) __PYX_ERR(1, 404, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 4)) { goto __pyx_L5_argtuple_error; @@ -10246,13 +10394,13 @@ PyObject *__pyx_args, PyObject *__pyx_kwds values[3] = __Pyx_Arg_FASTCALL(__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(1, 392, __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(1, 393, __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_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, __pyx_nargs); __PYX_ERR(1, 392, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("direct_tcpip_ex", 1, 4, 4, __pyx_nargs); __PYX_ERR(1, 404, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -10267,10 +10415,10 @@ PyObject *__pyx_args, PyObject *__pyx_kwds 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(1, 392, __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(1, 393, __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); @@ -10306,31 +10454,31 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("direct_tcpip_ex", 1); - /* "ssh2/session.pyx":395 - * shost not None, int sport): + /* "ssh2/session.pyx":415 + * * 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(1, 395, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_host); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 415, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_host = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":396 + /* "ssh2/session.pyx":416 * 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(1, 396, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_shost); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 416, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_shost = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":397 + /* "ssh2/session.pyx":417 * cdef bytes b_host = to_bytes(host) * cdef bytes b_shost = to_bytes(shost) * cdef char *_host = b_host # <<<<<<<<<<<<<< @@ -10339,12 +10487,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(1, 397, __pyx_L1_error) + __PYX_ERR(1, 417, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_host); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 397, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_host); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 417, __pyx_L1_error) __pyx_v__host = __pyx_t_2; - /* "ssh2/session.pyx":398 + /* "ssh2/session.pyx":418 * cdef bytes b_shost = to_bytes(shost) * cdef char *_host = b_host * cdef char *_shost = b_shost # <<<<<<<<<<<<<< @@ -10353,12 +10501,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(1, 398, __pyx_L1_error) + __PYX_ERR(1, 418, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_shost); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 398, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_shost); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 418, __pyx_L1_error) __pyx_v__shost = __pyx_t_2; - /* "ssh2/session.pyx":399 + /* "ssh2/session.pyx":419 * cdef char *_host = b_host * cdef char *_shost = b_shost * with nogil: # <<<<<<<<<<<<<< @@ -10374,7 +10522,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx #endif /*try:*/ { - /* "ssh2/session.pyx":400 + /* "ssh2/session.pyx":420 * cdef char *_shost = b_shost * with nogil: * channel = c_ssh2.libssh2_channel_direct_tcpip_ex( # <<<<<<<<<<<<<< @@ -10384,7 +10532,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":399 + /* "ssh2/session.pyx":419 * cdef char *_host = b_host * cdef char *_shost = b_shost * with nogil: # <<<<<<<<<<<<<< @@ -10403,7 +10551,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx } } - /* "ssh2/session.pyx":402 + /* "ssh2/session.pyx":422 * channel = c_ssh2.libssh2_channel_direct_tcpip_ex( * self._session, _host, port, _shost, sport) * if channel is NULL: # <<<<<<<<<<<<<< @@ -10413,7 +10561,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx __pyx_t_3 = (__pyx_v_channel == NULL); if (__pyx_t_3) { - /* "ssh2/session.pyx":403 + /* "ssh2/session.pyx":423 * self._session, _host, port, _shost, sport) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -10422,29 +10570,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":404 + /* "ssh2/session.pyx":424 * 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(1, 403, __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, 423, __pyx_L1_error) - /* "ssh2/session.pyx":403 + /* "ssh2/session.pyx":423 * 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(1, 403, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 423, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":402 + /* "ssh2/session.pyx":422 * channel = c_ssh2.libssh2_channel_direct_tcpip_ex( * self._session, _host, port, _shost, sport) * if channel is NULL: # <<<<<<<<<<<<<< @@ -10453,26 +10601,26 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx */ } - /* "ssh2/session.pyx":405 + /* "ssh2/session.pyx":425 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self) # <<<<<<<<<<<<<< * - * def direct_tcpip(self, host not None, int port): + * def direct_tcpip(self, host not None: AnyStr, int port) -> "Channel" | None: */ __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(1, 405, __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, 425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":392 + /* "ssh2/session.pyx":404 * return PyChannel(channel, self) * - * def direct_tcpip_ex(self, host not None, int port, # <<<<<<<<<<<<<< - * shost not None, int sport): - * cdef c_ssh2.LIBSSH2_CHANNEL *channel + * def direct_tcpip_ex(self, host not None: AnyStr, int port, # <<<<<<<<<<<<<< + * shost not None: AnyStr, int sport) -> "Channel" | None: + * """Open direct TCP/IP channel to host:port and open listening connection */ /* function exit code */ @@ -10488,10 +10636,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_40direct_tcpip_ex(struct __pyx return __pyx_r; } -/* "ssh2/session.pyx":407 +/* "ssh2/session.pyx":427 * return PyChannel(channel, self) * - * def direct_tcpip(self, host not None, int port): # <<<<<<<<<<<<<< + * def direct_tcpip(self, host not None: AnyStr, int port) -> "Channel" | None: # <<<<<<<<<<<<<< * """Open direct TCP/IP channel to host:port * */ @@ -10504,7 +10652,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_42direct_tcpip, "Session.direct_tcpip(self, host, int port)\nOpen direct TCP/IP channel to host:port\n\n Channel will be listening on an available open port on client side\n as assigned by OS.\n "); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_42direct_tcpip, "direct_tcpip(self, host: AnyStr, port: int) -> 'Channel' | None\nOpen direct TCP/IP channel to host:port\n\n Channel will be listening on an available open port on client side\n as assigned by OS, if available.\n\n :rtype: :py:class:`ssh2.channel.Channel or None\n "); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_43direct_tcpip = {"direct_tcpip", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_43direct_tcpip, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_42direct_tcpip}; static PyObject *__pyx_pw_4ssh2_7session_7Session_43direct_tcpip(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -10553,7 +10701,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 407, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 427, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: @@ -10561,14 +10709,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 407, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 427, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("direct_tcpip", 1, 2, 2, 1); __PYX_ERR(1, 407, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("direct_tcpip", 1, 2, 2, 1); __PYX_ERR(1, 427, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "direct_tcpip") < 0)) __PYX_ERR(1, 407, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "direct_tcpip") < 0)) __PYX_ERR(1, 427, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; @@ -10577,11 +10725,11 @@ PyObject *__pyx_args, PyObject *__pyx_kwds values[1] = __Pyx_Arg_FASTCALL(__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(1, 407, __pyx_L3_error) + __pyx_v_port = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 427, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("direct_tcpip", 1, 2, 2, __pyx_nargs); __PYX_ERR(1, 407, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("direct_tcpip", 1, 2, 2, __pyx_nargs); __PYX_ERR(1, 427, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -10596,7 +10744,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds 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(1, 407, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "host"); __PYX_ERR(1, 427, __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); @@ -10630,19 +10778,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob int __pyx_clineno = 0; __Pyx_RefNannySetupContext("direct_tcpip", 1); - /* "ssh2/session.pyx":414 + /* "ssh2/session.pyx":436 * """ * 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(1, 414, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_host); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 436, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_host = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":415 + /* "ssh2/session.pyx":437 * cdef c_ssh2.LIBSSH2_CHANNEL *channel * cdef bytes b_host = to_bytes(host) * cdef char *_host = b_host # <<<<<<<<<<<<<< @@ -10651,12 +10799,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(1, 415, __pyx_L1_error) + __PYX_ERR(1, 437, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_host); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 415, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_host); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 437, __pyx_L1_error) __pyx_v__host = __pyx_t_2; - /* "ssh2/session.pyx":416 + /* "ssh2/session.pyx":438 * cdef bytes b_host = to_bytes(host) * cdef char *_host = b_host * with nogil: # <<<<<<<<<<<<<< @@ -10672,7 +10820,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob #endif /*try:*/ { - /* "ssh2/session.pyx":417 + /* "ssh2/session.pyx":439 * cdef char *_host = b_host * with nogil: * channel = c_ssh2.libssh2_channel_direct_tcpip( # <<<<<<<<<<<<<< @@ -10682,7 +10830,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":416 + /* "ssh2/session.pyx":438 * cdef bytes b_host = to_bytes(host) * cdef char *_host = b_host * with nogil: # <<<<<<<<<<<<<< @@ -10701,7 +10849,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob } } - /* "ssh2/session.pyx":419 + /* "ssh2/session.pyx":441 * channel = c_ssh2.libssh2_channel_direct_tcpip( * self._session, _host, port) * if channel is NULL: # <<<<<<<<<<<<<< @@ -10711,7 +10859,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob __pyx_t_3 = (__pyx_v_channel == NULL); if (__pyx_t_3) { - /* "ssh2/session.pyx":420 + /* "ssh2/session.pyx":442 * self._session, _host, port) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -10720,29 +10868,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":421 + /* "ssh2/session.pyx":443 * 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(1, 420, __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, 442, __pyx_L1_error) - /* "ssh2/session.pyx":420 + /* "ssh2/session.pyx":442 * 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(1, 420, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 442, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":419 + /* "ssh2/session.pyx":441 * channel = c_ssh2.libssh2_channel_direct_tcpip( * self._session, _host, port) * if channel is NULL: # <<<<<<<<<<<<<< @@ -10751,24 +10899,24 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob */ } - /* "ssh2/session.pyx":422 + /* "ssh2/session.pyx":444 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self) # <<<<<<<<<<<<<< * - * def block_directions(self): + * def block_directions(self) -> int: */ __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(1, 422, __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, 444, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":407 + /* "ssh2/session.pyx":427 * return PyChannel(channel, self) * - * def direct_tcpip(self, host not None, int port): # <<<<<<<<<<<<<< + * def direct_tcpip(self, host not None: AnyStr, int port) -> "Channel" | None: # <<<<<<<<<<<<<< * """Open direct TCP/IP channel to host:port * */ @@ -10785,10 +10933,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_42direct_tcpip(struct __pyx_ob return __pyx_r; } -/* "ssh2/session.pyx":424 +/* "ssh2/session.pyx":446 * return PyChannel(channel, self) * - * def block_directions(self): # <<<<<<<<<<<<<< + * def block_directions(self) -> int: # <<<<<<<<<<<<<< * """Get blocked directions for the current session. * */ @@ -10801,7 +10949,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_44block_directions, "Session.block_directions(self)\nGet blocked directions for the current session.\n\n From libssh2 documentation:\n\n Can be a combination of:\n\n ``ssh2.session.LIBSSH2_SESSION_BLOCK_INBOUND``: Inbound direction\n blocked.\n\n ``ssh2.session.LIBSSH2_SESSION_BLOCK_OUTBOUND``: Outbound direction\n blocked.\n\n Application should wait for data to be available for socket prior to\n calling a libssh2 function again. If ``LIBSSH2_SESSION_BLOCK_INBOUND``\n is set select should contain the session socket in readfds set.\n\n Correspondingly in case of ``LIBSSH2_SESSION_BLOCK_OUTBOUND`` writefds\n set should contain the socket.\n\n :rtype: int"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_44block_directions, "block_directions(self) -> int\nGet blocked directions for the current session.\n\n From libssh2 documentation:\n\n Can be a combination of:\n\n ``ssh2.session.LIBSSH2_SESSION_BLOCK_INBOUND``: Inbound direction\n blocked.\n\n ``ssh2.session.LIBSSH2_SESSION_BLOCK_OUTBOUND``: Outbound direction\n blocked.\n\n Application should wait for data to be available for socket prior to\n calling a libssh2 function again. If ``LIBSSH2_SESSION_BLOCK_INBOUND``\n is set select/poll should contain the session socket in readfds set.\n\n Correspondingly in case of ``LIBSSH2_SESSION_BLOCK_OUTBOUND`` writefds\n set should contain the socket.\n\n :rtype: int"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_45block_directions = {"block_directions", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_45block_directions, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_44block_directions}; static PyObject *__pyx_pw_4ssh2_7session_7Session_45block_directions(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -10845,7 +10993,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_44block_directions(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("block_directions", 1); - /* "ssh2/session.pyx":446 + /* "ssh2/session.pyx":468 * :rtype: int""" * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -10861,7 +11009,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_44block_directions(struct __py #endif /*try:*/ { - /* "ssh2/session.pyx":447 + /* "ssh2/session.pyx":469 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_session_block_directions( # <<<<<<<<<<<<<< @@ -10871,7 +11019,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":446 + /* "ssh2/session.pyx":468 * :rtype: int""" * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -10890,24 +11038,25 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_44block_directions(struct __py } } - /* "ssh2/session.pyx":449 + /* "ssh2/session.pyx":471 * rc = c_ssh2.libssh2_session_block_directions( * self._session) * return rc # <<<<<<<<<<<<<< * - * def forward_listen(self, int port): + * def forward_listen(self, int port) -> "Listener" | None: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 471, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_t_1)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_t_1))) __PYX_ERR(1, 471, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":424 + /* "ssh2/session.pyx":446 * return PyChannel(channel, self) * - * def block_directions(self): # <<<<<<<<<<<<<< + * def block_directions(self) -> int: # <<<<<<<<<<<<<< * """Get blocked directions for the current session. * */ @@ -10923,10 +11072,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_44block_directions(struct __py return __pyx_r; } -/* "ssh2/session.pyx":451 +/* "ssh2/session.pyx":473 * return rc * - * def forward_listen(self, int port): # <<<<<<<<<<<<<< + * def forward_listen(self, int port) -> "Listener" | None: # <<<<<<<<<<<<<< * """Create forward listener on port. * */ @@ -10939,7 +11088,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_46forward_listen, "Session.forward_listen(self, int port)\nCreate forward listener on port.\n\n :param port: Port to listen on.\n :type port: int\n\n :rtype: :py:class:`ssh2.listener.Listener` or None"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_46forward_listen, "forward_listen(self, port: int) -> 'Listener' | None\nCreate forward listener on port.\n\n :param port: Port to listen on.\n :type port: int\n\n :rtype: :py:class:`ssh2.listener.Listener` or None"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_47forward_listen = {"forward_listen", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_47forward_listen, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_46forward_listen}; static PyObject *__pyx_pw_4ssh2_7session_7Session_47forward_listen(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -10985,23 +11134,23 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 451, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 473, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "forward_listen") < 0)) __PYX_ERR(1, 451, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "forward_listen") < 0)) __PYX_ERR(1, 473, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - __pyx_v_port = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 451, __pyx_L3_error) + __pyx_v_port = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 473, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("forward_listen", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 451, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("forward_listen", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 473, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -11040,7 +11189,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("forward_listen", 1); - /* "ssh2/session.pyx":459 + /* "ssh2/session.pyx":481 * :rtype: :py:class:`ssh2.listener.Listener` or None""" * cdef c_ssh2.LIBSSH2_LISTENER *listener * with nogil: # <<<<<<<<<<<<<< @@ -11056,7 +11205,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ #endif /*try:*/ { - /* "ssh2/session.pyx":460 + /* "ssh2/session.pyx":482 * cdef c_ssh2.LIBSSH2_LISTENER *listener * with nogil: * listener = c_ssh2.libssh2_channel_forward_listen( # <<<<<<<<<<<<<< @@ -11066,7 +11215,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":459 + /* "ssh2/session.pyx":481 * :rtype: :py:class:`ssh2.listener.Listener` or None""" * cdef c_ssh2.LIBSSH2_LISTENER *listener * with nogil: # <<<<<<<<<<<<<< @@ -11085,7 +11234,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ } } - /* "ssh2/session.pyx":462 + /* "ssh2/session.pyx":484 * listener = c_ssh2.libssh2_channel_forward_listen( * self._session, port) * if listener is NULL: # <<<<<<<<<<<<<< @@ -11095,7 +11244,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ __pyx_t_1 = (__pyx_v_listener == NULL); if (__pyx_t_1) { - /* "ssh2/session.pyx":463 + /* "ssh2/session.pyx":485 * self._session, port) * if listener is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -11104,29 +11253,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":464 + /* "ssh2/session.pyx":486 * 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(1, 463, __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, 485, __pyx_L1_error) - /* "ssh2/session.pyx":463 + /* "ssh2/session.pyx":485 * 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(1, 463, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 485, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":462 + /* "ssh2/session.pyx":484 * listener = c_ssh2.libssh2_channel_forward_listen( * self._session, port) * if listener is NULL: # <<<<<<<<<<<<<< @@ -11135,24 +11284,24 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ */ } - /* "ssh2/session.pyx":465 + /* "ssh2/session.pyx":487 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyListener(listener, self) # <<<<<<<<<<<<<< * - * def forward_listen_ex(self, int queue_maxsize, host=None, int port=0): + * def forward_listen_ex(self, int queue_maxsize, host: AnyStr | None=None, */ __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(1, 465, __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, 487, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":451 + /* "ssh2/session.pyx":473 * return rc * - * def forward_listen(self, int port): # <<<<<<<<<<<<<< + * def forward_listen(self, int port) -> "Listener" | None: # <<<<<<<<<<<<<< * """Create forward listener on port. * */ @@ -11168,12 +11317,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_46forward_listen(struct __pyx_ return __pyx_r; } -/* "ssh2/session.pyx":467 +/* "ssh2/session.pyx":489 * return PyListener(listener, self) * - * def forward_listen_ex(self, int queue_maxsize, host=None, int port=0): # <<<<<<<<<<<<<< + * def forward_listen_ex(self, int queue_maxsize, host: AnyStr | None=None, # <<<<<<<<<<<<<< + * int port=0) -> Tuple["Listener", int] | None: * """ - * Instruct the remote SSH server to begin listening for inbound */ /* Python wrapper */ @@ -11184,7 +11333,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_48forward_listen_ex, "Session.forward_listen_ex(self, int queue_maxsize, host=None, int port=0)\n\n Instruct the remote SSH server to begin listening for inbound\n TCP/IP connections. New connections will be queued by the library\n until accepted by ``ssh2.channel.Channel.forward_accept``.\n\n :param queue_maxsize: Maximum number of pending connections to queue\n before rejecting further attempts.\n :type queue_maxsize: int\n :param host: Address to bind to on the remote host. Binding\n to 0.0.0.0 (default when `None` is passed) will bind to all available\n addresses.\n :type host: str\n :param port: port to bind to on the remote host. When 0 is passed\n (the default), the remote host will select the first available\n dynamic port.\n :type port: int\n :returns: (listener, bound_port) tuple where bound_port is the\n listen port bound on the remote host. Useful when requesting\n dynamic port numbers.\n :rtype: (:py:class:`ssh2.listener.Listener`, int)\n "); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_48forward_listen_ex, "forward_listen_ex(self, queue_maxsize: int, host: AnyStr | None = None, port: int = 0) -> Tuple['Listener', int] | None\n\n Instruct the remote SSH server to begin listening for inbound\n TCP/IP connections. New connections will be queued by the library\n until accepted by ``ssh2.channel.Channel.forward_accept``.\n\n :param queue_maxsize: Maximum number of pending connections to queue\n before rejecting further attempts.\n :type queue_maxsize: int\n :param host: Address to bind to on the remote host. Binding\n to 0.0.0.0 (default when `None` is passed) will bind to all available\n addresses.\n :type host: str\n :param port: port to bind to on the remote host. When 0 is passed\n (the default), the remote host will select the first available\n dynamic port.\n :type port: int\n :returns: (listener, bound_port) tuple where bound_port is the\n listen port bound on the remote host. Useful when requesting\n dynamic port numbers.\n :rtype: (:py:class:`ssh2.listener.Listener`, int) or None\n "); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_49forward_listen_ex = {"forward_listen_ex", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_49forward_listen_ex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_48forward_listen_ex}; static PyObject *__pyx_pw_4ssh2_7session_7Session_49forward_listen_ex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -11237,26 +11386,26 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 467, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 489, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_host); if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 467, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 489, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_port); if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 467, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 489, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "forward_listen_ex") < 0)) __PYX_ERR(1, 467, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "forward_listen_ex") < 0)) __PYX_ERR(1, 489, __pyx_L3_error) } } else { switch (__pyx_nargs) { @@ -11269,17 +11418,17 @@ PyObject *__pyx_args, PyObject *__pyx_kwds 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(1, 467, __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, 489, __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(1, 467, __pyx_L3_error) + __pyx_v_port = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 490, __pyx_L3_error) } else { __pyx_v_port = ((int)0); } } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("forward_listen_ex", 0, 1, 3, __pyx_nargs); __PYX_ERR(1, 467, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("forward_listen_ex", 0, 1, 3, __pyx_nargs); __PYX_ERR(1, 489, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -11324,7 +11473,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("forward_listen_ex", 1); - /* "ssh2/session.pyx":490 + /* "ssh2/session.pyx":513 * """ * cdef c_ssh2.LIBSSH2_LISTENER *listener * cdef bytes b_host = None if host is None else to_bytes(host) # <<<<<<<<<<<<<< @@ -11336,16 +11485,16 @@ 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(1, 490, __pyx_L1_error) + __pyx_t_3 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_host); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 513, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; } - if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_1))) __PYX_ERR(1, 490, __pyx_L1_error) + if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_1))) __PYX_ERR(1, 513, __pyx_L1_error) __pyx_v_b_host = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":491 + /* "ssh2/session.pyx":514 * cdef c_ssh2.LIBSSH2_LISTENER *listener * cdef bytes b_host = None if host is None else to_bytes(host) * cdef char *_host = NULL # <<<<<<<<<<<<<< @@ -11354,7 +11503,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p */ __pyx_v__host = NULL; - /* "ssh2/session.pyx":492 + /* "ssh2/session.pyx":515 * cdef bytes b_host = None if host is None else to_bytes(host) * cdef char *_host = NULL * if b_host is not None: # <<<<<<<<<<<<<< @@ -11364,7 +11513,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p __pyx_t_2 = (__pyx_v_b_host != ((PyObject*)Py_None)); if (__pyx_t_2) { - /* "ssh2/session.pyx":493 + /* "ssh2/session.pyx":516 * cdef char *_host = NULL * if b_host is not None: * _host = b_host # <<<<<<<<<<<<<< @@ -11373,12 +11522,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(1, 493, __pyx_L1_error) + __PYX_ERR(1, 516, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_host); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 493, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_host); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 516, __pyx_L1_error) __pyx_v__host = __pyx_t_4; - /* "ssh2/session.pyx":492 + /* "ssh2/session.pyx":515 * cdef bytes b_host = None if host is None else to_bytes(host) * cdef char *_host = NULL * if b_host is not None: # <<<<<<<<<<<<<< @@ -11387,7 +11536,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p */ } - /* "ssh2/session.pyx":494 + /* "ssh2/session.pyx":517 * if b_host is not None: * _host = b_host * cdef int bound_port = 0 # <<<<<<<<<<<<<< @@ -11396,7 +11545,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p */ __pyx_v_bound_port = 0; - /* "ssh2/session.pyx":495 + /* "ssh2/session.pyx":518 * _host = b_host * cdef int bound_port = 0 * with nogil: # <<<<<<<<<<<<<< @@ -11412,7 +11561,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p #endif /*try:*/ { - /* "ssh2/session.pyx":496 + /* "ssh2/session.pyx":519 * cdef int bound_port = 0 * with nogil: * listener = c_ssh2.libssh2_channel_forward_listen_ex( # <<<<<<<<<<<<<< @@ -11422,7 +11571,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":495 + /* "ssh2/session.pyx":518 * _host = b_host * cdef int bound_port = 0 * with nogil: # <<<<<<<<<<<<<< @@ -11441,7 +11590,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p } } - /* "ssh2/session.pyx":498 + /* "ssh2/session.pyx":521 * listener = c_ssh2.libssh2_channel_forward_listen_ex( * self._session, _host, port, &bound_port, queue_maxsize) * if listener is NULL: # <<<<<<<<<<<<<< @@ -11451,7 +11600,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p __pyx_t_2 = (__pyx_v_listener == NULL); if (__pyx_t_2) { - /* "ssh2/session.pyx":499 + /* "ssh2/session.pyx":522 * self._session, _host, port, &bound_port, queue_maxsize) * if listener is NULL: * return (handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -11460,37 +11609,37 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":500 + /* "ssh2/session.pyx":523 * 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_5 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 499, __pyx_L1_error) + __pyx_t_5 = __pyx_f_4ssh2_5utils_handle_error_codes(libssh2_session_last_errno(__pyx_v_self->_session), 0); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 522, __pyx_L1_error) - /* "ssh2/session.pyx":499 + /* "ssh2/session.pyx":522 * 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_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 499, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 522, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 499, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 522, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(1, 499, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(1, 522, __pyx_L1_error); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0)) __PYX_ERR(1, 499, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0)) __PYX_ERR(1, 522, __pyx_L1_error); __pyx_t_1 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":498 + /* "ssh2/session.pyx":521 * listener = c_ssh2.libssh2_channel_forward_listen_ex( * self._session, _host, port, &bound_port, queue_maxsize) * if listener is NULL: # <<<<<<<<<<<<<< @@ -11499,36 +11648,36 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p */ } - /* "ssh2/session.pyx":501 + /* "ssh2/session.pyx":524 * return (handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)), 0) * return (PyListener(listener, self), bound_port) # <<<<<<<<<<<<<< * - * def sftp_init(self): + * def sftp_init(self) -> "SFTP": */ __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(1, 501, __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, 524, __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(1, 501, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_bound_port); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 524, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 501, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 524, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_3); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3)) __PYX_ERR(1, 501, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3)) __PYX_ERR(1, 524, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1)) __PYX_ERR(1, 501, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1)) __PYX_ERR(1, 524, __pyx_L1_error); __pyx_t_3 = 0; __pyx_t_1 = 0; __pyx_r = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":467 + /* "ssh2/session.pyx":489 * return PyListener(listener, self) * - * def forward_listen_ex(self, int queue_maxsize, host=None, int port=0): # <<<<<<<<<<<<<< + * def forward_listen_ex(self, int queue_maxsize, host: AnyStr | None=None, # <<<<<<<<<<<<<< + * int port=0) -> Tuple["Listener", int] | None: * """ - * Instruct the remote SSH server to begin listening for inbound */ /* function exit code */ @@ -11545,10 +11694,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_48forward_listen_ex(struct __p return __pyx_r; } -/* "ssh2/session.pyx":503 +/* "ssh2/session.pyx":526 * return (PyListener(listener, self), bound_port) * - * def sftp_init(self): # <<<<<<<<<<<<<< + * def sftp_init(self) -> "SFTP": # <<<<<<<<<<<<<< * """Initialise SFTP channel. * */ @@ -11561,7 +11710,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_50sftp_init, "Session.sftp_init(self)\nInitialise SFTP channel.\n\n :rtype: :py:class:`ssh2.sftp.SFTP`\n "); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_50sftp_init, "sftp_init(self) -> 'SFTP'\nInitialise SFTP channel.\n\n :rtype: :py:class:`ssh2.sftp.SFTP`\n "); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_51sftp_init = {"sftp_init", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_51sftp_init, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_50sftp_init}; static PyObject *__pyx_pw_4ssh2_7session_7Session_51sftp_init(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -11607,7 +11756,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("sftp_init", 1); - /* "ssh2/session.pyx":509 + /* "ssh2/session.pyx":532 * """ * cdef c_sftp.LIBSSH2_SFTP *_sftp * with nogil: # <<<<<<<<<<<<<< @@ -11623,7 +11772,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 #endif /*try:*/ { - /* "ssh2/session.pyx":510 + /* "ssh2/session.pyx":533 * cdef c_sftp.LIBSSH2_SFTP *_sftp * with nogil: * _sftp = c_sftp.libssh2_sftp_init(self._session) # <<<<<<<<<<<<<< @@ -11633,7 +11782,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":509 + /* "ssh2/session.pyx":532 * """ * cdef c_sftp.LIBSSH2_SFTP *_sftp * with nogil: # <<<<<<<<<<<<<< @@ -11652,7 +11801,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 } } - /* "ssh2/session.pyx":511 + /* "ssh2/session.pyx":534 * with nogil: * _sftp = c_sftp.libssh2_sftp_init(self._session) * if _sftp is NULL: # <<<<<<<<<<<<<< @@ -11662,7 +11811,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 __pyx_t_1 = (__pyx_v__sftp == NULL); if (__pyx_t_1) { - /* "ssh2/session.pyx":512 + /* "ssh2/session.pyx":535 * _sftp = c_sftp.libssh2_sftp_init(self._session) * if _sftp is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -11671,29 +11820,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":513 + /* "ssh2/session.pyx":536 * 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(1, 512, __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, 535, __pyx_L1_error) - /* "ssh2/session.pyx":512 + /* "ssh2/session.pyx":535 * _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(1, 512, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 535, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":511 + /* "ssh2/session.pyx":534 * with nogil: * _sftp = c_sftp.libssh2_sftp_init(self._session) * if _sftp is NULL: # <<<<<<<<<<<<<< @@ -11702,7 +11851,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 */ } - /* "ssh2/session.pyx":514 + /* "ssh2/session.pyx":537 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PySFTP(_sftp, self) # <<<<<<<<<<<<<< @@ -11710,16 +11859,16 @@ 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(1, 514, __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, 537, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":503 + /* "ssh2/session.pyx":526 * return (PyListener(listener, self), bound_port) * - * def sftp_init(self): # <<<<<<<<<<<<<< + * def sftp_init(self) -> "SFTP": # <<<<<<<<<<<<<< * """Initialise SFTP channel. * */ @@ -11735,7 +11884,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_50sftp_init(struct __pyx_obj_4 return __pyx_r; } -/* "ssh2/session.pyx":516 +/* "ssh2/session.pyx":539 * return PySFTP(_sftp, self) * * def last_error(self, size_t msg_size=1024): # <<<<<<<<<<<<<< @@ -11751,7 +11900,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_52last_error, "Session.last_error(self, size_t msg_size=1024)\nRetrieve last error message from libssh2, if any.\n Returns empty string on no error message.\n\n :rtype: str\n "); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_52last_error, "last_error(self, msg_size: int = 1024)\nRetrieve last error message from libssh2, if any.\n Returns empty string on no error message.\n\n :rtype: str\n "); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_53last_error = {"last_error", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_53last_error, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_52last_error}; static PyObject *__pyx_pw_4ssh2_7session_7Session_53last_error(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -11796,12 +11945,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_msg_size); if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 516, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 539, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "last_error") < 0)) __PYX_ERR(1, 516, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "last_error") < 0)) __PYX_ERR(1, 539, __pyx_L3_error) } } else { switch (__pyx_nargs) { @@ -11812,14 +11961,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } } 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(1, 516, __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, 539, __pyx_L3_error) } else { __pyx_v_msg_size = ((size_t)0x400); } } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("last_error", 0, 0, 1, __pyx_nargs); __PYX_ERR(1, 516, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("last_error", 0, 0, 1, __pyx_nargs); __PYX_ERR(1, 539, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -11869,7 +12018,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("last_error", 1); - /* "ssh2/session.pyx":523 + /* "ssh2/session.pyx":546 * """ * cdef char *_error_msg * cdef bytes msg = b'' # <<<<<<<<<<<<<< @@ -11879,7 +12028,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ __Pyx_INCREF(__pyx_kp_b__2); __pyx_v_msg = __pyx_kp_b__2; - /* "ssh2/session.pyx":524 + /* "ssh2/session.pyx":547 * cdef char *_error_msg * cdef bytes msg = b'' * cdef int errmsg_len = 0 # <<<<<<<<<<<<<< @@ -11888,7 +12037,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ */ __pyx_v_errmsg_len = 0; - /* "ssh2/session.pyx":525 + /* "ssh2/session.pyx":548 * cdef bytes msg = b'' * cdef int errmsg_len = 0 * with nogil: # <<<<<<<<<<<<<< @@ -11904,7 +12053,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ #endif /*try:*/ { - /* "ssh2/session.pyx":526 + /* "ssh2/session.pyx":549 * cdef int errmsg_len = 0 * with nogil: * _error_msg = malloc(sizeof(char) * msg_size) # <<<<<<<<<<<<<< @@ -11913,7 +12062,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":527 + /* "ssh2/session.pyx":550 * with nogil: * _error_msg = malloc(sizeof(char) * msg_size) * c_ssh2.libssh2_session_last_error( # <<<<<<<<<<<<<< @@ -11923,7 +12072,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":525 + /* "ssh2/session.pyx":548 * cdef bytes msg = b'' * cdef int errmsg_len = 0 * with nogil: # <<<<<<<<<<<<<< @@ -11942,7 +12091,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ } } - /* "ssh2/session.pyx":529 + /* "ssh2/session.pyx":552 * c_ssh2.libssh2_session_last_error( * self._session, &_error_msg, &errmsg_len, 1) * try: # <<<<<<<<<<<<<< @@ -11951,7 +12100,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ */ /*try:*/ { - /* "ssh2/session.pyx":530 + /* "ssh2/session.pyx":553 * self._session, &_error_msg, &errmsg_len, 1) * try: * if errmsg_len > 0: # <<<<<<<<<<<<<< @@ -11961,19 +12110,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ __pyx_t_1 = (__pyx_v_errmsg_len > 0); if (__pyx_t_1) { - /* "ssh2/session.pyx":531 + /* "ssh2/session.pyx":554 * try: * if errmsg_len > 0: * msg = _error_msg[:errmsg_len] # <<<<<<<<<<<<<< * return to_str(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(1, 531, __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, 554, __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":530 + /* "ssh2/session.pyx":553 * self._session, &_error_msg, &errmsg_len, 1) * try: * if errmsg_len > 0: # <<<<<<<<<<<<<< @@ -11982,7 +12131,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ */ } - /* "ssh2/session.pyx":532 + /* "ssh2/session.pyx":555 * if errmsg_len > 0: * msg = _error_msg[:errmsg_len] * return to_str(msg) # <<<<<<<<<<<<<< @@ -11990,20 +12139,20 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ * free(_error_msg) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyBytes_AsWritableString(__pyx_v_msg); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(1, 532, __pyx_L7_error) - __pyx_t_2 = __pyx_f_4ssh2_5utils_to_str(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 532, __pyx_L7_error) + __pyx_t_3 = __Pyx_PyBytes_AsWritableString(__pyx_v_msg); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(1, 555, __pyx_L7_error) + __pyx_t_2 = __pyx_f_4ssh2_5utils_to_str(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 555, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L6_return; } - /* "ssh2/session.pyx":534 + /* "ssh2/session.pyx":557 * return to_str(msg) * finally: * free(_error_msg) # <<<<<<<<<<<<<< * - * def last_errno(self): + * def last_errno(self) -> int: */ /*finally:*/ { __pyx_L7_error:; @@ -12048,7 +12197,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ } } - /* "ssh2/session.pyx":516 + /* "ssh2/session.pyx":539 * return PySFTP(_sftp, self) * * def last_error(self, size_t msg_size=1024): # <<<<<<<<<<<<<< @@ -12068,10 +12217,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_52last_error(struct __pyx_obj_ return __pyx_r; } -/* "ssh2/session.pyx":536 +/* "ssh2/session.pyx":559 * free(_error_msg) * - * def last_errno(self): # <<<<<<<<<<<<<< + * def last_errno(self) -> int: # <<<<<<<<<<<<<< * """Retrieve last error number from libssh2, if any. * Returns 0 on no last error. */ @@ -12084,7 +12233,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_54last_errno, "Session.last_errno(self)\nRetrieve last error number from libssh2, if any.\n Returns 0 on no last error.\n\n :rtype: int\n "); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_54last_errno, "last_errno(self) -> int\nRetrieve last error number from libssh2, if any.\n Returns 0 on no last error.\n\n :rtype: int\n "); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_55last_errno = {"last_errno", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_55last_errno, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_54last_errno}; static PyObject *__pyx_pw_4ssh2_7session_7Session_55last_errno(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -12128,7 +12277,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_54last_errno(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("last_errno", 1); - /* "ssh2/session.pyx":543 + /* "ssh2/session.pyx":566 * """ * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -12144,7 +12293,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_54last_errno(struct __pyx_obj_ #endif /*try:*/ { - /* "ssh2/session.pyx":544 + /* "ssh2/session.pyx":567 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -12154,7 +12303,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":543 + /* "ssh2/session.pyx":566 * """ * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -12173,24 +12322,25 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_54last_errno(struct __pyx_obj_ } } - /* "ssh2/session.pyx":546 + /* "ssh2/session.pyx":569 * rc = c_ssh2.libssh2_session_last_errno( * self._session) * return rc # <<<<<<<<<<<<<< * - * def set_last_error(self, int errcode, errmsg not None): + * def set_last_error(self, int errcode, errmsg not None: AnyStr) -> int: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 546, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 569, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_t_1)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_t_1))) __PYX_ERR(1, 569, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":536 + /* "ssh2/session.pyx":559 * free(_error_msg) * - * def last_errno(self): # <<<<<<<<<<<<<< + * def last_errno(self) -> int: # <<<<<<<<<<<<<< * """Retrieve last error number from libssh2, if any. * Returns 0 on no last error. */ @@ -12206,10 +12356,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_54last_errno(struct __pyx_obj_ return __pyx_r; } -/* "ssh2/session.pyx":548 +/* "ssh2/session.pyx":571 * return rc * - * def set_last_error(self, int errcode, errmsg not None): # <<<<<<<<<<<<<< + * def set_last_error(self, int errcode, errmsg not None: AnyStr) -> int: # <<<<<<<<<<<<<< * cdef bytes b_errmsg = to_bytes(errmsg) * cdef char *_errmsg = b_errmsg */ @@ -12222,7 +12372,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_56set_last_error, "Session.set_last_error(self, int errcode, errmsg)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_56set_last_error, "set_last_error(self, errcode: int, errmsg: AnyStr) -> int"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_57set_last_error = {"set_last_error", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_57set_last_error, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_56set_last_error}; static PyObject *__pyx_pw_4ssh2_7session_7Session_57set_last_error(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -12271,7 +12421,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 548, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 571, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: @@ -12279,14 +12429,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 548, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 571, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("set_last_error", 1, 2, 2, 1); __PYX_ERR(1, 548, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("set_last_error", 1, 2, 2, 1); __PYX_ERR(1, 571, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set_last_error") < 0)) __PYX_ERR(1, 548, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set_last_error") < 0)) __PYX_ERR(1, 571, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; @@ -12294,12 +12444,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); } - __pyx_v_errcode = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_errcode == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 548, __pyx_L3_error) + __pyx_v_errcode = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_errcode == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 571, __pyx_L3_error) __pyx_v_errmsg = values[1]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_last_error", 1, 2, 2, __pyx_nargs); __PYX_ERR(1, 548, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("set_last_error", 1, 2, 2, __pyx_nargs); __PYX_ERR(1, 571, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -12314,7 +12464,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds 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(1, 548, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "errmsg"); __PYX_ERR(1, 571, __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); @@ -12346,20 +12496,20 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_56set_last_error(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set_last_error", 1); - /* "ssh2/session.pyx":549 + /* "ssh2/session.pyx":572 * - * def set_last_error(self, int errcode, errmsg not None): + * def set_last_error(self, int errcode, errmsg not None: AnyStr) -> int: * 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(1, 549, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_errmsg); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 572, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_errmsg = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":550 - * def set_last_error(self, int errcode, errmsg not None): + /* "ssh2/session.pyx":573 + * def set_last_error(self, int errcode, errmsg not None: AnyStr) -> int: * cdef bytes b_errmsg = to_bytes(errmsg) * cdef char *_errmsg = b_errmsg # <<<<<<<<<<<<<< * cdef int rc @@ -12367,12 +12517,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(1, 550, __pyx_L1_error) + __PYX_ERR(1, 573, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_errmsg); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 550, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_errmsg); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 573, __pyx_L1_error) __pyx_v__errmsg = __pyx_t_2; - /* "ssh2/session.pyx":552 + /* "ssh2/session.pyx":575 * cdef char *_errmsg = b_errmsg * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -12388,7 +12538,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_56set_last_error(struct __pyx_ #endif /*try:*/ { - /* "ssh2/session.pyx":553 + /* "ssh2/session.pyx":576 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_session_set_last_error( # <<<<<<<<<<<<<< @@ -12398,7 +12548,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":552 + /* "ssh2/session.pyx":575 * cdef char *_errmsg = b_errmsg * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -12417,7 +12567,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_56set_last_error(struct __pyx_ } } - /* "ssh2/session.pyx":555 + /* "ssh2/session.pyx":578 * rc = c_ssh2.libssh2_session_set_last_error( * self._session, errcode, _errmsg) * return rc # <<<<<<<<<<<<<< @@ -12425,16 +12575,17 @@ 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(1, 555, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 578, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_t_1)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_t_1))) __PYX_ERR(1, 578, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":548 + /* "ssh2/session.pyx":571 * return rc * - * def set_last_error(self, int errcode, errmsg not None): # <<<<<<<<<<<<<< + * def set_last_error(self, int errcode, errmsg not None: AnyStr) -> int: # <<<<<<<<<<<<<< * cdef bytes b_errmsg = to_bytes(errmsg) * cdef char *_errmsg = b_errmsg */ @@ -12451,7 +12602,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_56set_last_error(struct __pyx_ return __pyx_r; } -/* "ssh2/session.pyx":557 +/* "ssh2/session.pyx":580 * return rc * * def scp_recv(self, path not None): # <<<<<<<<<<<<<< @@ -12467,7 +12618,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_58scp_recv, "Session.scp_recv(self, path)\nReceive file via SCP.\n\n Deprecated in favour or recv2 (requires libssh2 >= 1.7).\n\n :param path: File path to receive.\n :type path: str\n\n :rtype: tuple(:py:class:`ssh2.channel.Channel`,\n :py:class:`ssh2.statinfo.StatInfo`) or None"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_58scp_recv, "scp_recv(self, path)\nReceive file via SCP.\n\n Deprecated in favour or recv2 (requires libssh2 >= 1.7).\n\n :param path: File path to receive.\n :type path: str\n\n :rtype: tuple(:py:class:`ssh2.channel.Channel`,\n :py:class:`ssh2.statinfo.StatInfo`) or None"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_59scp_recv = {"scp_recv", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_59scp_recv, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_58scp_recv}; static PyObject *__pyx_pw_4ssh2_7session_7Session_59scp_recv(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -12513,12 +12664,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 557, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 580, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "scp_recv") < 0)) __PYX_ERR(1, 557, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "scp_recv") < 0)) __PYX_ERR(1, 580, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; @@ -12529,7 +12680,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("scp_recv", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 557, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_recv", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 580, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -12544,7 +12695,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds 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(1, 557, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "path"); __PYX_ERR(1, 580, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_58scp_recv(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_path); @@ -12580,19 +12731,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("scp_recv", 1); - /* "ssh2/session.pyx":567 + /* "ssh2/session.pyx":590 * :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(1, 567, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 590, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_path = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":568 + /* "ssh2/session.pyx":591 * :py:class:`ssh2.statinfo.StatInfo`) or None""" * cdef bytes b_path = to_bytes(path) * cdef char *_path = b_path # <<<<<<<<<<<<<< @@ -12601,24 +12752,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(1, 568, __pyx_L1_error) + __PYX_ERR(1, 591, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 568, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 591, __pyx_L1_error) __pyx_v__path = __pyx_t_2; - /* "ssh2/session.pyx":569 + /* "ssh2/session.pyx":592 * 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(1, 569, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4ssh2_8statinfo_StatInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 592, __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":571 + /* "ssh2/session.pyx":594 * cdef StatInfo statinfo = StatInfo() * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -12634,7 +12785,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s #endif /*try:*/ { - /* "ssh2/session.pyx":572 + /* "ssh2/session.pyx":595 * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: * channel = c_ssh2.libssh2_scp_recv( # <<<<<<<<<<<<<< @@ -12644,7 +12795,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":571 + /* "ssh2/session.pyx":594 * cdef StatInfo statinfo = StatInfo() * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -12663,7 +12814,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s } } - /* "ssh2/session.pyx":574 + /* "ssh2/session.pyx":597 * channel = c_ssh2.libssh2_scp_recv( * self._session, _path, statinfo._stat) * if channel is NULL: # <<<<<<<<<<<<<< @@ -12673,7 +12824,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s __pyx_t_3 = (__pyx_v_channel == NULL); if (__pyx_t_3) { - /* "ssh2/session.pyx":575 + /* "ssh2/session.pyx":598 * self._session, _path, statinfo._stat) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -12682,29 +12833,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":576 + /* "ssh2/session.pyx":599 * 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(1, 575, __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, 598, __pyx_L1_error) - /* "ssh2/session.pyx":575 + /* "ssh2/session.pyx":598 * 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(1, 575, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 598, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":574 + /* "ssh2/session.pyx":597 * channel = c_ssh2.libssh2_scp_recv( * self._session, _path, statinfo._stat) * if channel is NULL: # <<<<<<<<<<<<<< @@ -12713,29 +12864,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s */ } - /* "ssh2/session.pyx":577 + /* "ssh2/session.pyx":600 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self), statinfo # <<<<<<<<<<<<<< * - * def scp_recv2(self, path not None): + * def scp_recv2(self, path not None: AnyStr) -> Tuple["Channel", "FileInfo"] | None: */ __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(1, 577, __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, 600, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 577, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 600, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1)) __PYX_ERR(1, 577, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1)) __PYX_ERR(1, 600, __pyx_L1_error); __Pyx_INCREF((PyObject *)__pyx_v_statinfo); __Pyx_GIVEREF((PyObject *)__pyx_v_statinfo); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_statinfo))) __PYX_ERR(1, 577, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_statinfo))) __PYX_ERR(1, 600, __pyx_L1_error); __pyx_t_1 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":557 + /* "ssh2/session.pyx":580 * return rc * * def scp_recv(self, path not None): # <<<<<<<<<<<<<< @@ -12757,10 +12908,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_58scp_recv(struct __pyx_obj_4s return __pyx_r; } -/* "ssh2/session.pyx":579 +/* "ssh2/session.pyx":602 * return PyChannel(channel, self), statinfo * - * def scp_recv2(self, path not None): # <<<<<<<<<<<<<< + * def scp_recv2(self, path not None: AnyStr) -> Tuple["Channel", "FileInfo"] | None: # <<<<<<<<<<<<<< * """Receive file via SCP. * */ @@ -12773,7 +12924,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_60scp_recv2, "Session.scp_recv2(self, path)\nReceive file via SCP.\n\n :param path: File path to receive.\n :type path: str\n\n :rtype: tuple(:py:class:`ssh2.channel.Channel`,\n :py:class:`ssh2.fileinfo.FileInfo`) or ``None``"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_60scp_recv2, "scp_recv2(self, path: AnyStr) -> Tuple['Channel', 'FileInfo'] | None\nReceive file via SCP.\n\n :param path: File path to receive.\n :type path: str\n\n :rtype: tuple(:py:class:`ssh2.channel.Channel`,\n :py:class:`ssh2.fileinfo.FileInfo`) or ``None``"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_61scp_recv2 = {"scp_recv2", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_61scp_recv2, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_60scp_recv2}; static PyObject *__pyx_pw_4ssh2_7session_7Session_61scp_recv2(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -12819,12 +12970,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 579, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 602, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "scp_recv2") < 0)) __PYX_ERR(1, 579, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "scp_recv2") < 0)) __PYX_ERR(1, 602, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; @@ -12835,7 +12986,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("scp_recv2", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 579, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_recv2", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 602, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -12850,7 +13001,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds 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(1, 579, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "path"); __PYX_ERR(1, 602, __pyx_L1_error) } __pyx_r = __pyx_pf_4ssh2_7session_7Session_60scp_recv2(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_path); @@ -12886,31 +13037,31 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("scp_recv2", 1); - /* "ssh2/session.pyx":587 + /* "ssh2/session.pyx":610 * :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(1, 587, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4ssh2_8fileinfo_FileInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 610, __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":588 + /* "ssh2/session.pyx":611 * :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(1, 588, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 611, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_path = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":589 + /* "ssh2/session.pyx":612 * cdef FileInfo fileinfo = FileInfo() * cdef bytes b_path = to_bytes(path) * cdef char *_path = b_path # <<<<<<<<<<<<<< @@ -12919,12 +13070,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(1, 589, __pyx_L1_error) + __PYX_ERR(1, 612, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 589, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 612, __pyx_L1_error) __pyx_v__path = __pyx_t_2; - /* "ssh2/session.pyx":591 + /* "ssh2/session.pyx":614 * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -12940,7 +13091,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 #endif /*try:*/ { - /* "ssh2/session.pyx":592 + /* "ssh2/session.pyx":615 * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: * channel = c_ssh2.libssh2_scp_recv2( # <<<<<<<<<<<<<< @@ -12950,7 +13101,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":591 + /* "ssh2/session.pyx":614 * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -12969,7 +13120,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 } } - /* "ssh2/session.pyx":594 + /* "ssh2/session.pyx":617 * channel = c_ssh2.libssh2_scp_recv2( * self._session, _path, fileinfo._stat) * if channel is NULL: # <<<<<<<<<<<<<< @@ -12979,7 +13130,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 __pyx_t_3 = (__pyx_v_channel == NULL); if (__pyx_t_3) { - /* "ssh2/session.pyx":595 + /* "ssh2/session.pyx":618 * self._session, _path, fileinfo._stat) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -12988,29 +13139,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":596 + /* "ssh2/session.pyx":619 * 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(1, 595, __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, 618, __pyx_L1_error) - /* "ssh2/session.pyx":595 + /* "ssh2/session.pyx":618 * 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(1, 595, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":594 + /* "ssh2/session.pyx":617 * channel = c_ssh2.libssh2_scp_recv2( * self._session, _path, fileinfo._stat) * if channel is NULL: # <<<<<<<<<<<<<< @@ -13019,7 +13170,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 */ } - /* "ssh2/session.pyx":597 + /* "ssh2/session.pyx":620 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self), fileinfo # <<<<<<<<<<<<<< @@ -13027,24 +13178,24 @@ 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(1, 597, __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, 620, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 597, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 620, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1)) __PYX_ERR(1, 597, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1)) __PYX_ERR(1, 620, __pyx_L1_error); __Pyx_INCREF((PyObject *)__pyx_v_fileinfo); __Pyx_GIVEREF((PyObject *)__pyx_v_fileinfo); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_fileinfo))) __PYX_ERR(1, 597, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_fileinfo))) __PYX_ERR(1, 620, __pyx_L1_error); __pyx_t_1 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":579 + /* "ssh2/session.pyx":602 * return PyChannel(channel, self), statinfo * - * def scp_recv2(self, path not None): # <<<<<<<<<<<<<< + * def scp_recv2(self, path not None: AnyStr) -> Tuple["Channel", "FileInfo"] | None: # <<<<<<<<<<<<<< * """Receive file via SCP. * */ @@ -13063,7 +13214,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_60scp_recv2(struct __pyx_obj_4 return __pyx_r; } -/* "ssh2/session.pyx":599 +/* "ssh2/session.pyx":622 * return PyChannel(channel, self), fileinfo * * def scp_send(self, path not None, int mode, size_t size): # <<<<<<<<<<<<<< @@ -13079,7 +13230,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_62scp_send, "Session.scp_send(self, path, int mode, size_t size)\nDeprecated in favour of scp_send64. Send file via SCP.\n\n :param path: Local file path to send.\n :type path: str\n :param mode: File mode.\n :type mode: int\n :param size: size of file\n :type size: int\n\n :rtype: :py:class:`ssh2.channel.Channel`"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_62scp_send, "scp_send(self, path, mode: int, size: int)\nDeprecated in favour of scp_send64. Send file via SCP.\n\n :param path: Local file path to send.\n :type path: str\n :param mode: File mode.\n :type mode: int\n :param size: size of file\n :type size: int\n\n :rtype: :py:class:`ssh2.channel.Channel`"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_63scp_send = {"scp_send", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_63scp_send, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_62scp_send}; static PyObject *__pyx_pw_4ssh2_7session_7Session_63scp_send(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -13131,7 +13282,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 599, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 622, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: @@ -13139,9 +13290,9 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 599, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 622, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("scp_send", 1, 3, 3, 1); __PYX_ERR(1, 599, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send", 1, 3, 3, 1); __PYX_ERR(1, 622, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -13149,14 +13300,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 599, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 622, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("scp_send", 1, 3, 3, 2); __PYX_ERR(1, 599, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send", 1, 3, 3, 2); __PYX_ERR(1, 622, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "scp_send") < 0)) __PYX_ERR(1, 599, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "scp_send") < 0)) __PYX_ERR(1, 622, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 3)) { goto __pyx_L5_argtuple_error; @@ -13166,12 +13317,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds values[2] = __Pyx_Arg_FASTCALL(__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(1, 599, __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, 599, __pyx_L3_error) + __pyx_v_mode = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 622, __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, 622, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("scp_send", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 599, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 622, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -13186,7 +13337,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds 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(1, 599, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "path"); __PYX_ERR(1, 622, __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); @@ -13220,19 +13371,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("scp_send", 1); - /* "ssh2/session.pyx":610 + /* "ssh2/session.pyx":633 * * :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(1, 610, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 633, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_path = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":611 + /* "ssh2/session.pyx":634 * :rtype: :py:class:`ssh2.channel.Channel`""" * cdef bytes b_path = to_bytes(path) * cdef char *_path = b_path # <<<<<<<<<<<<<< @@ -13241,12 +13392,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(1, 611, __pyx_L1_error) + __PYX_ERR(1, 634, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 611, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 634, __pyx_L1_error) __pyx_v__path = __pyx_t_2; - /* "ssh2/session.pyx":613 + /* "ssh2/session.pyx":636 * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -13262,7 +13413,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s #endif /*try:*/ { - /* "ssh2/session.pyx":614 + /* "ssh2/session.pyx":637 * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: * channel = c_ssh2.libssh2_scp_send( # <<<<<<<<<<<<<< @@ -13272,7 +13423,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":613 + /* "ssh2/session.pyx":636 * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -13291,7 +13442,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s } } - /* "ssh2/session.pyx":616 + /* "ssh2/session.pyx":639 * channel = c_ssh2.libssh2_scp_send( * self._session, _path, mode, size) * if channel is NULL: # <<<<<<<<<<<<<< @@ -13301,7 +13452,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s __pyx_t_3 = (__pyx_v_channel == NULL); if (__pyx_t_3) { - /* "ssh2/session.pyx":617 + /* "ssh2/session.pyx":640 * self._session, _path, mode, size) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -13310,29 +13461,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":618 + /* "ssh2/session.pyx":641 * 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(1, 617, __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, 640, __pyx_L1_error) - /* "ssh2/session.pyx":617 + /* "ssh2/session.pyx":640 * 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(1, 617, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 640, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":616 + /* "ssh2/session.pyx":639 * channel = c_ssh2.libssh2_scp_send( * self._session, _path, mode, size) * if channel is NULL: # <<<<<<<<<<<<<< @@ -13341,21 +13492,21 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s */ } - /* "ssh2/session.pyx":619 + /* "ssh2/session.pyx":642 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self) # <<<<<<<<<<<<<< * - * def scp_send64(self, path not None, int mode, c_ssh2.libssh2_uint64_t size, + * def scp_send64(self, path not None: AnyStr, 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(1, 619, __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, 642, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":599 + /* "ssh2/session.pyx":622 * return PyChannel(channel, self), fileinfo * * def scp_send(self, path not None, int mode, size_t size): # <<<<<<<<<<<<<< @@ -13375,11 +13526,11 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_62scp_send(struct __pyx_obj_4s return __pyx_r; } -/* "ssh2/session.pyx":621 +/* "ssh2/session.pyx":644 * return PyChannel(channel, self) * - * def scp_send64(self, path not None, int mode, c_ssh2.libssh2_uint64_t size, # <<<<<<<<<<<<<< - * time_t mtime, time_t atime): + * def scp_send64(self, path not None: AnyStr, int mode, c_ssh2.libssh2_uint64_t size, # <<<<<<<<<<<<<< + * time_t mtime, time_t atime) -> "Channel": * """Send file via SCP. */ @@ -13391,7 +13542,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_64scp_send64, "Session.scp_send64(self, path, int mode, libssh2_uint64_t size, time_t mtime, time_t atime)\nSend file via SCP.\n\n :param path: Local file path to send.\n :type path: str\n :param mode: File mode.\n :type mode: int\n :param size: size of file\n :type size: int\n\n :rtype: :py:class:`ssh2.channel.Channel`"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_64scp_send64, "scp_send64(self, path: AnyStr, mode: int, size: int, mtime: int, atime: int) -> 'Channel'\nSend file via SCP.\n\n :param path: Local file path to send.\n :type path: str\n :param mode: File mode.\n :type mode: int\n :param size: size of file\n :type size: int\n\n :rtype: :py:class:`ssh2.channel.Channel`"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_65scp_send64 = {"scp_send64", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_65scp_send64, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_64scp_send64}; static PyObject *__pyx_pw_4ssh2_7session_7Session_65scp_send64(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -13449,7 +13600,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 621, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 644, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: @@ -13457,9 +13608,9 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 621, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 644, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 1); __PYX_ERR(1, 621, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 1); __PYX_ERR(1, 644, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -13467,9 +13618,9 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 621, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 644, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 2); __PYX_ERR(1, 621, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 2); __PYX_ERR(1, 644, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: @@ -13477,9 +13628,9 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 621, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 644, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 3); __PYX_ERR(1, 621, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 3); __PYX_ERR(1, 644, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: @@ -13487,14 +13638,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 621, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 644, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 4); __PYX_ERR(1, 621, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, 4); __PYX_ERR(1, 644, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "scp_send64") < 0)) __PYX_ERR(1, 621, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "scp_send64") < 0)) __PYX_ERR(1, 644, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 5)) { goto __pyx_L5_argtuple_error; @@ -13506,14 +13657,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds values[4] = __Pyx_Arg_FASTCALL(__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(1, 621, __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, 621, __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, 622, __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, 622, __pyx_L3_error) + __pyx_v_mode = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 644, __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, 644, __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, 645, __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, 645, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, __pyx_nargs); __PYX_ERR(1, 621, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scp_send64", 1, 5, 5, __pyx_nargs); __PYX_ERR(1, 644, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -13528,7 +13679,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds 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(1, 621, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "path"); __PYX_ERR(1, 644, __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); @@ -13562,19 +13713,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("scp_send64", 1); - /* "ssh2/session.pyx":633 + /* "ssh2/session.pyx":656 * * :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(1, 633, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 656, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_path = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":634 + /* "ssh2/session.pyx":657 * :rtype: :py:class:`ssh2.channel.Channel`""" * cdef bytes b_path = to_bytes(path) * cdef char *_path = b_path # <<<<<<<<<<<<<< @@ -13583,12 +13734,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(1, 634, __pyx_L1_error) + __PYX_ERR(1, 657, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 634, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 657, __pyx_L1_error) __pyx_v__path = __pyx_t_2; - /* "ssh2/session.pyx":636 + /* "ssh2/session.pyx":659 * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -13604,7 +13755,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ #endif /*try:*/ { - /* "ssh2/session.pyx":637 + /* "ssh2/session.pyx":660 * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: * channel = c_ssh2.libssh2_scp_send64( # <<<<<<<<<<<<<< @@ -13614,7 +13765,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":636 + /* "ssh2/session.pyx":659 * cdef char *_path = b_path * cdef c_ssh2.LIBSSH2_CHANNEL *channel * with nogil: # <<<<<<<<<<<<<< @@ -13633,7 +13784,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ } } - /* "ssh2/session.pyx":639 + /* "ssh2/session.pyx":662 * channel = c_ssh2.libssh2_scp_send64( * self._session, _path, mode, size, mtime, atime) * if channel is NULL: # <<<<<<<<<<<<<< @@ -13643,7 +13794,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ __pyx_t_3 = (__pyx_v_channel == NULL); if (__pyx_t_3) { - /* "ssh2/session.pyx":640 + /* "ssh2/session.pyx":663 * self._session, _path, mode, size, mtime, atime) * if channel is NULL: * return handle_error_codes(c_ssh2.libssh2_session_last_errno( # <<<<<<<<<<<<<< @@ -13652,29 +13803,29 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ */ __Pyx_XDECREF(__pyx_r); - /* "ssh2/session.pyx":641 + /* "ssh2/session.pyx":664 * 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(1, 640, __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, 663, __pyx_L1_error) - /* "ssh2/session.pyx":640 + /* "ssh2/session.pyx":663 * 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(1, 640, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 663, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":639 + /* "ssh2/session.pyx":662 * channel = c_ssh2.libssh2_scp_send64( * self._session, _path, mode, size, mtime, atime) * if channel is NULL: # <<<<<<<<<<<<<< @@ -13683,25 +13834,25 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ */ } - /* "ssh2/session.pyx":642 + /* "ssh2/session.pyx":665 * return handle_error_codes(c_ssh2.libssh2_session_last_errno( * self._session)) * return PyChannel(channel, self) # <<<<<<<<<<<<<< * - * def publickey_init(self): + * def publickey_init(self) -> "PublicKeySystem": */ __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(1, 642, __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, 665, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":621 + /* "ssh2/session.pyx":644 * return PyChannel(channel, self) * - * def scp_send64(self, path not None, int mode, c_ssh2.libssh2_uint64_t size, # <<<<<<<<<<<<<< - * time_t mtime, time_t atime): + * def scp_send64(self, path not None: AnyStr, int mode, c_ssh2.libssh2_uint64_t size, # <<<<<<<<<<<<<< + * time_t mtime, time_t atime) -> "Channel": * """Send file via SCP. */ @@ -13717,10 +13868,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_64scp_send64(struct __pyx_obj_ return __pyx_r; } -/* "ssh2/session.pyx":644 +/* "ssh2/session.pyx":667 * return PyChannel(channel, self) * - * def publickey_init(self): # <<<<<<<<<<<<<< + * def publickey_init(self) -> "PublicKeySystem": # <<<<<<<<<<<<<< * """Initialise public key subsystem for managing remote server * public keys""" */ @@ -13733,7 +13884,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_66publickey_init, "Session.publickey_init(self)\nInitialise public key subsystem for managing remote server\n public keys"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_66publickey_init, "publickey_init(self) -> 'PublicKeySystem'\nInitialise public key subsystem for managing remote server\n public keys"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_67publickey_init = {"publickey_init", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_67publickey_init, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_66publickey_init}; static PyObject *__pyx_pw_4ssh2_7session_7Session_67publickey_init(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -13778,7 +13929,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("publickey_init", 1); - /* "ssh2/session.pyx":648 + /* "ssh2/session.pyx":671 * public keys""" * cdef c_pkey.LIBSSH2_PUBLICKEY *_pkey * with nogil: # <<<<<<<<<<<<<< @@ -13794,7 +13945,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ #endif /*try:*/ { - /* "ssh2/session.pyx":649 + /* "ssh2/session.pyx":672 * cdef c_pkey.LIBSSH2_PUBLICKEY *_pkey * with nogil: * _pkey = c_pkey.libssh2_publickey_init(self._session) # <<<<<<<<<<<<<< @@ -13804,7 +13955,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":648 + /* "ssh2/session.pyx":671 * public keys""" * cdef c_pkey.LIBSSH2_PUBLICKEY *_pkey * with nogil: # <<<<<<<<<<<<<< @@ -13823,7 +13974,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ } } - /* "ssh2/session.pyx":650 + /* "ssh2/session.pyx":673 * with nogil: * _pkey = c_pkey.libssh2_publickey_init(self._session) * if _pkey is NULL: # <<<<<<<<<<<<<< @@ -13833,20 +13984,20 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ __pyx_t_1 = (__pyx_v__pkey == NULL); if (unlikely(__pyx_t_1)) { - /* "ssh2/session.pyx":651 + /* "ssh2/session.pyx":674 * _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(1, 651, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PublicKeyInitError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 674, __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(1, 651, __pyx_L1_error) + __PYX_ERR(1, 674, __pyx_L1_error) - /* "ssh2/session.pyx":650 + /* "ssh2/session.pyx":673 * with nogil: * _pkey = c_pkey.libssh2_publickey_init(self._session) * if _pkey is NULL: # <<<<<<<<<<<<<< @@ -13855,24 +14006,24 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ */ } - /* "ssh2/session.pyx":652 + /* "ssh2/session.pyx":675 * if _pkey is NULL: * raise PublicKeyInitError * return PyPublicKeySystem(_pkey, self) # <<<<<<<<<<<<<< * - * def hostkey_hash(self, int hash_type): + * def hostkey_hash(self, int hash_type) -> bytes: */ __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(1, 652, __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, 675, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":644 + /* "ssh2/session.pyx":667 * return PyChannel(channel, self) * - * def publickey_init(self): # <<<<<<<<<<<<<< + * def publickey_init(self) -> "PublicKeySystem": # <<<<<<<<<<<<<< * """Initialise public key subsystem for managing remote server * public keys""" */ @@ -13888,10 +14039,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_66publickey_init(struct __pyx_ return __pyx_r; } -/* "ssh2/session.pyx":654 +/* "ssh2/session.pyx":677 * return PyPublicKeySystem(_pkey, self) * - * def hostkey_hash(self, int hash_type): # <<<<<<<<<<<<<< + * def hostkey_hash(self, int hash_type) -> bytes: # <<<<<<<<<<<<<< * """Get computed digest of the remote system's host key. * */ @@ -13904,7 +14055,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_68hostkey_hash, "Session.hostkey_hash(self, int hash_type)\nGet computed digest of the remote system's host key.\n\n :param hash_type: One of ``ssh2.session.LIBSSH2_HOSTKEY_HASH_MD5`` or\n ``ssh2.session.LIBSSH2_HOSTKEY_HASH_SHA1``\n :type hash_type: int\n\n :rtype: bytes"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_68hostkey_hash, "hostkey_hash(self, hash_type: int) -> bytes\nGet computed digest of the remote system's host key.\n\n :param hash_type: One of ``ssh2.session.LIBSSH2_HOSTKEY_HASH_MD5`` or\n ``ssh2.session.LIBSSH2_HOSTKEY_HASH_SHA1``\n :type hash_type: int\n\n :rtype: bytes"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_69hostkey_hash = {"hostkey_hash", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_69hostkey_hash, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_68hostkey_hash}; static PyObject *__pyx_pw_4ssh2_7session_7Session_69hostkey_hash(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -13950,23 +14101,23 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 654, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 677, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "hostkey_hash") < 0)) __PYX_ERR(1, 654, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "hostkey_hash") < 0)) __PYX_ERR(1, 677, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - __pyx_v_hash_type = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_hash_type == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 654, __pyx_L3_error) + __pyx_v_hash_type = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_hash_type == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 677, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("hostkey_hash", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 654, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("hostkey_hash", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 677, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -14005,7 +14156,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob int __pyx_clineno = 0; __Pyx_RefNannySetupContext("hostkey_hash", 1); - /* "ssh2/session.pyx":664 + /* "ssh2/session.pyx":687 * cdef const char *_hash * cdef bytes b_hash * with nogil: # <<<<<<<<<<<<<< @@ -14021,7 +14172,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob #endif /*try:*/ { - /* "ssh2/session.pyx":665 + /* "ssh2/session.pyx":688 * cdef bytes b_hash * with nogil: * _hash = c_ssh2.libssh2_hostkey_hash(self._session, hash_type) # <<<<<<<<<<<<<< @@ -14031,7 +14182,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":664 + /* "ssh2/session.pyx":687 * cdef const char *_hash * cdef bytes b_hash * with nogil: # <<<<<<<<<<<<<< @@ -14050,7 +14201,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob } } - /* "ssh2/session.pyx":666 + /* "ssh2/session.pyx":689 * with nogil: * _hash = c_ssh2.libssh2_hostkey_hash(self._session, hash_type) * if _hash is NULL: # <<<<<<<<<<<<<< @@ -14060,7 +14211,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob __pyx_t_1 = (__pyx_v__hash == NULL); if (__pyx_t_1) { - /* "ssh2/session.pyx":667 + /* "ssh2/session.pyx":690 * _hash = c_ssh2.libssh2_hostkey_hash(self._session, hash_type) * if _hash is NULL: * return # <<<<<<<<<<<<<< @@ -14068,10 +14219,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob * return b_hash */ __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "ssh2/session.pyx":666 + /* "ssh2/session.pyx":689 * with nogil: * _hash = c_ssh2.libssh2_hostkey_hash(self._session, hash_type) * if _hash is NULL: # <<<<<<<<<<<<<< @@ -14080,34 +14231,34 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob */ } - /* "ssh2/session.pyx":668 + /* "ssh2/session.pyx":691 * 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(1, 668, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v__hash); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 691, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_b_hash = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "ssh2/session.pyx":669 + /* "ssh2/session.pyx":692 * return * b_hash = _hash * return b_hash # <<<<<<<<<<<<<< * - * def hostkey(self): + * def hostkey(self) -> Tuple[bytes, int]: */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_b_hash); __pyx_r = __pyx_v_b_hash; goto __pyx_L0; - /* "ssh2/session.pyx":654 + /* "ssh2/session.pyx":677 * return PyPublicKeySystem(_pkey, self) * - * def hostkey_hash(self, int hash_type): # <<<<<<<<<<<<<< + * def hostkey_hash(self, int hash_type) -> bytes: # <<<<<<<<<<<<<< * """Get computed digest of the remote system's host key. * */ @@ -14124,10 +14275,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_68hostkey_hash(struct __pyx_ob return __pyx_r; } -/* "ssh2/session.pyx":671 +/* "ssh2/session.pyx":694 * return b_hash * - * def hostkey(self): # <<<<<<<<<<<<<< + * def hostkey(self) -> Tuple[bytes, int]: # <<<<<<<<<<<<<< * """Get server host key for this session. * */ @@ -14140,7 +14291,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_70hostkey, "Session.hostkey(self)\nGet server host key for this session.\n\n Returns key, key_type tuple where key_type is one of\n :py:class:`ssh2.session.LIBSSH2_HOSTKEY_TYPE_RSA`,\n :py:class:`ssh2.session.LIBSSH2_HOSTKEY_TYPE_DSS`, or\n :py:class:`ssh2.session.LIBSSH2_HOSTKEY_TYPE_UNKNOWN`\n\n :rtype: tuple(bytes, int)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_70hostkey, "hostkey(self) -> Tuple[bytes, int]\nGet server host key for this session.\n\n Returns key, key_type tuple where key_type is one of\n :py:class:`ssh2.session.LIBSSH2_HOSTKEY_TYPE_RSA`,\n :py:class:`ssh2.session.LIBSSH2_HOSTKEY_TYPE_DSS`, or\n :py:class:`ssh2.session.LIBSSH2_HOSTKEY_TYPE_UNKNOWN`\n\n :rtype: tuple(bytes, int)"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_71hostkey = {"hostkey", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_71hostkey, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_70hostkey}; static PyObject *__pyx_pw_4ssh2_7session_7Session_71hostkey(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -14191,7 +14342,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss int __pyx_clineno = 0; __Pyx_RefNannySetupContext("hostkey", 1); - /* "ssh2/session.pyx":680 + /* "ssh2/session.pyx":703 * * :rtype: tuple(bytes, int)""" * cdef bytes key = b"" # <<<<<<<<<<<<<< @@ -14201,7 +14352,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss __Pyx_INCREF(__pyx_kp_b__2); __pyx_v_key = __pyx_kp_b__2; - /* "ssh2/session.pyx":682 + /* "ssh2/session.pyx":705 * cdef bytes key = b"" * cdef const char *_key * cdef size_t key_len = 0 # <<<<<<<<<<<<<< @@ -14210,7 +14361,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss */ __pyx_v_key_len = 0; - /* "ssh2/session.pyx":683 + /* "ssh2/session.pyx":706 * cdef const char *_key * cdef size_t key_len = 0 * cdef int key_type = 0 # <<<<<<<<<<<<<< @@ -14219,7 +14370,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss */ __pyx_v_key_type = 0; - /* "ssh2/session.pyx":684 + /* "ssh2/session.pyx":707 * cdef size_t key_len = 0 * cdef int key_type = 0 * with nogil: # <<<<<<<<<<<<<< @@ -14235,7 +14386,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss #endif /*try:*/ { - /* "ssh2/session.pyx":685 + /* "ssh2/session.pyx":708 * cdef int key_type = 0 * with nogil: * _key = c_ssh2.libssh2_session_hostkey( # <<<<<<<<<<<<<< @@ -14245,7 +14396,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":684 + /* "ssh2/session.pyx":707 * cdef size_t key_len = 0 * cdef int key_type = 0 * with nogil: # <<<<<<<<<<<<<< @@ -14264,7 +14415,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss } } - /* "ssh2/session.pyx":687 + /* "ssh2/session.pyx":710 * _key = c_ssh2.libssh2_session_hostkey( * self._session, &key_len, &key_type) * if _key is NULL: # <<<<<<<<<<<<<< @@ -14274,14 +14425,14 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss __pyx_t_1 = (__pyx_v__key == NULL); if (unlikely(__pyx_t_1)) { - /* "ssh2/session.pyx":688 + /* "ssh2/session.pyx":711 * 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(1, 688, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_SessionHostKeyError); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 711, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; __pyx_t_5 = 0; @@ -14301,15 +14452,15 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_kp_u_Error_retrieving_server_host_key}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 688, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 711, __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(1, 688, __pyx_L1_error) + __PYX_ERR(1, 711, __pyx_L1_error) - /* "ssh2/session.pyx":687 + /* "ssh2/session.pyx":710 * _key = c_ssh2.libssh2_session_hostkey( * self._session, &key_len, &key_type) * if _key is NULL: # <<<<<<<<<<<<<< @@ -14318,44 +14469,44 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss */ } - /* "ssh2/session.pyx":690 + /* "ssh2/session.pyx":713 * 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(1, 690, __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, 713, __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":691 + /* "ssh2/session.pyx":714 * "Error retrieving server host key for session") * key = _key[:key_len] * return key, key_type # <<<<<<<<<<<<<< * - * def knownhost_init(self): + * def knownhost_init(self) -> "KnownHost": */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_key_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 691, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_key_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 714, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 691, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 714, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_key); __Pyx_GIVEREF(__pyx_v_key); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_key)) __PYX_ERR(1, 691, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_key)) __PYX_ERR(1, 714, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_2); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2)) __PYX_ERR(1, 691, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2)) __PYX_ERR(1, 714, __pyx_L1_error); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; + __pyx_r = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":671 + /* "ssh2/session.pyx":694 * return b_hash * - * def hostkey(self): # <<<<<<<<<<<<<< + * def hostkey(self) -> Tuple[bytes, int]: # <<<<<<<<<<<<<< * """Get server host key for this session. * */ @@ -14374,10 +14525,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_70hostkey(struct __pyx_obj_4ss return __pyx_r; } -/* "ssh2/session.pyx":693 +/* "ssh2/session.pyx":716 * return key, key_type * - * def knownhost_init(self): # <<<<<<<<<<<<<< + * def knownhost_init(self) -> "KnownHost": # <<<<<<<<<<<<<< * """Initialise a collection of known hosts for this session. * */ @@ -14390,7 +14541,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_72knownhost_init, "Session.knownhost_init(self)\nInitialise a collection of known hosts for this session.\n\n :rtype: :py:class:`ssh2.knownhost.KnownHost`"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_72knownhost_init, "knownhost_init(self) -> 'KnownHost'\nInitialise a collection of known hosts for this session.\n\n :rtype: :py:class:`ssh2.knownhost.KnownHost`"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_73knownhost_init = {"knownhost_init", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_73knownhost_init, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_72knownhost_init}; static PyObject *__pyx_pw_4ssh2_7session_7Session_73knownhost_init(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -14435,7 +14586,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("knownhost_init", 1); - /* "ssh2/session.pyx":698 + /* "ssh2/session.pyx":721 * :rtype: :py:class:`ssh2.knownhost.KnownHost`""" * cdef c_ssh2.LIBSSH2_KNOWNHOSTS *known_hosts * with nogil: # <<<<<<<<<<<<<< @@ -14451,7 +14602,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ #endif /*try:*/ { - /* "ssh2/session.pyx":699 + /* "ssh2/session.pyx":722 * cdef c_ssh2.LIBSSH2_KNOWNHOSTS *known_hosts * with nogil: * known_hosts = c_ssh2.libssh2_knownhost_init( # <<<<<<<<<<<<<< @@ -14461,7 +14612,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":698 + /* "ssh2/session.pyx":721 * :rtype: :py:class:`ssh2.knownhost.KnownHost`""" * cdef c_ssh2.LIBSSH2_KNOWNHOSTS *known_hosts * with nogil: # <<<<<<<<<<<<<< @@ -14480,7 +14631,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ } } - /* "ssh2/session.pyx":701 + /* "ssh2/session.pyx":724 * known_hosts = c_ssh2.libssh2_knownhost_init( * self._session) * if known_hosts is NULL: # <<<<<<<<<<<<<< @@ -14490,20 +14641,20 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ __pyx_t_1 = (__pyx_v_known_hosts == NULL); if (unlikely(__pyx_t_1)) { - /* "ssh2/session.pyx":702 + /* "ssh2/session.pyx":725 * 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(1, 702, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_KnownHostError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 725, __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(1, 702, __pyx_L1_error) + __PYX_ERR(1, 725, __pyx_L1_error) - /* "ssh2/session.pyx":701 + /* "ssh2/session.pyx":724 * known_hosts = c_ssh2.libssh2_knownhost_init( * self._session) * if known_hosts is NULL: # <<<<<<<<<<<<<< @@ -14512,24 +14663,24 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ */ } - /* "ssh2/session.pyx":703 + /* "ssh2/session.pyx":726 * if known_hosts is NULL: * raise KnownHostError * return PyKnownHost(self, known_hosts) # <<<<<<<<<<<<<< * - * def keepalive_config(self, bint want_reply, unsigned interval): + * def keepalive_config(self, bint want_reply, unsigned interval) -> None: */ __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(1, 703, __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, 726, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":693 + /* "ssh2/session.pyx":716 * return key, key_type * - * def knownhost_init(self): # <<<<<<<<<<<<<< + * def knownhost_init(self) -> "KnownHost": # <<<<<<<<<<<<<< * """Initialise a collection of known hosts for this session. * */ @@ -14545,10 +14696,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_72knownhost_init(struct __pyx_ return __pyx_r; } -/* "ssh2/session.pyx":705 +/* "ssh2/session.pyx":728 * return PyKnownHost(self, known_hosts) * - * def keepalive_config(self, bint want_reply, unsigned interval): # <<<<<<<<<<<<<< + * def keepalive_config(self, bint want_reply, unsigned interval) -> None: # <<<<<<<<<<<<<< * """ * Configure keep alive settings. */ @@ -14561,7 +14712,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_74keepalive_config, "Session.keepalive_config(self, bool want_reply, unsigned int interval)\n\n Configure keep alive settings.\n\n :param want_reply: True/False for reply wanted from server on keep\n alive messages being sent or not.\n :type want_reply: bool\n :param interval: Required keep alive interval. Set to ``0`` to disable\n keepalives.\n :type interval: int"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_74keepalive_config, "keepalive_config(self, want_reply: bool, interval: int) -> None\n\n Configure keep alive settings.\n\n :param want_reply: True/False for reply wanted from server on keep\n alive messages being sent or not.\n :type want_reply: bool\n :param interval: Required keep alive interval. Set to ``0`` to disable\n keepalives.\n :type interval: int"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_75keepalive_config = {"keepalive_config", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_75keepalive_config, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_74keepalive_config}; static PyObject *__pyx_pw_4ssh2_7session_7Session_75keepalive_config(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -14610,7 +14761,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 705, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 728, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: @@ -14618,14 +14769,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 705, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 728, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("keepalive_config", 1, 2, 2, 1); __PYX_ERR(1, 705, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("keepalive_config", 1, 2, 2, 1); __PYX_ERR(1, 728, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "keepalive_config") < 0)) __PYX_ERR(1, 705, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "keepalive_config") < 0)) __PYX_ERR(1, 728, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; @@ -14633,12 +14784,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); } - __pyx_v_want_reply = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_want_reply == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 705, __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, 705, __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, 728, __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, 728, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("keepalive_config", 1, 2, 2, __pyx_nargs); __PYX_ERR(1, 705, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("keepalive_config", 1, 2, 2, __pyx_nargs); __PYX_ERR(1, 728, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -14670,7 +14821,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_74keepalive_config(struct __py __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("keepalive_config", 1); - /* "ssh2/session.pyx":715 + /* "ssh2/session.pyx":738 * keepalives. * :type interval: int""" * with nogil: # <<<<<<<<<<<<<< @@ -14686,17 +14837,17 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_74keepalive_config(struct __py #endif /*try:*/ { - /* "ssh2/session.pyx":716 + /* "ssh2/session.pyx":739 * :type interval: int""" * with nogil: * c_ssh2.libssh2_keepalive_config(self._session, want_reply, interval) # <<<<<<<<<<<<<< * - * def keepalive_send(self): + * def keepalive_send(self) -> int: */ libssh2_keepalive_config(__pyx_v_self->_session, __pyx_v_want_reply, __pyx_v_interval); } - /* "ssh2/session.pyx":715 + /* "ssh2/session.pyx":738 * keepalives. * :type interval: int""" * with nogil: # <<<<<<<<<<<<<< @@ -14715,10 +14866,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_74keepalive_config(struct __py } } - /* "ssh2/session.pyx":705 + /* "ssh2/session.pyx":728 * return PyKnownHost(self, known_hosts) * - * def keepalive_config(self, bint want_reply, unsigned interval): # <<<<<<<<<<<<<< + * def keepalive_config(self, bint want_reply, unsigned interval) -> None: # <<<<<<<<<<<<<< * """ * Configure keep alive settings. */ @@ -14730,10 +14881,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_74keepalive_config(struct __py return __pyx_r; } -/* "ssh2/session.pyx":718 +/* "ssh2/session.pyx":741 * c_ssh2.libssh2_keepalive_config(self._session, want_reply, interval) * - * def keepalive_send(self): # <<<<<<<<<<<<<< + * def keepalive_send(self) -> int: # <<<<<<<<<<<<<< * """Send keepalive. * */ @@ -14746,7 +14897,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_76keepalive_send, "Session.keepalive_send(self)\nSend keepalive.\n\n Returns seconds remaining before next keep alive should be sent.\n\n :rtype: int"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_76keepalive_send, "keepalive_send(self) -> int\nSend keepalive.\n\n Returns seconds remaining before next keep alive should be sent.\n\n :rtype: int"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_77keepalive_send = {"keepalive_send", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_77keepalive_send, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_76keepalive_send}; static PyObject *__pyx_pw_4ssh2_7session_7Session_77keepalive_send(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -14793,7 +14944,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("keepalive_send", 1); - /* "ssh2/session.pyx":724 + /* "ssh2/session.pyx":747 * * :rtype: int""" * cdef int seconds = 0 # <<<<<<<<<<<<<< @@ -14802,7 +14953,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ */ __pyx_v_seconds = 0; - /* "ssh2/session.pyx":725 + /* "ssh2/session.pyx":748 * :rtype: int""" * cdef int seconds = 0 * cdef int c_seconds = 0 # <<<<<<<<<<<<<< @@ -14811,7 +14962,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ */ __pyx_v_c_seconds = 0; - /* "ssh2/session.pyx":727 + /* "ssh2/session.pyx":750 * cdef int c_seconds = 0 * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -14827,7 +14978,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ #endif /*try:*/ { - /* "ssh2/session.pyx":728 + /* "ssh2/session.pyx":751 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_keepalive_send(self._session, &c_seconds) # <<<<<<<<<<<<<< @@ -14837,7 +14988,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":727 + /* "ssh2/session.pyx":750 * cdef int c_seconds = 0 * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -14856,33 +15007,34 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ } } - /* "ssh2/session.pyx":729 + /* "ssh2/session.pyx":752 * 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(1, 729, __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, 752, __pyx_L1_error) - /* "ssh2/session.pyx":730 + /* "ssh2/session.pyx":753 * rc = c_ssh2.libssh2_keepalive_send(self._session, &c_seconds) * handle_error_codes(rc) * return c_seconds # <<<<<<<<<<<<<< * - * def supported_algs(self, MethodType method_type): + * def supported_algs(self, MethodType method_type) -> List[str]: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_c_seconds); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 730, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_c_seconds); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 753, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; + if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_t_2)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_t_2))) __PYX_ERR(1, 753, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":718 + /* "ssh2/session.pyx":741 * c_ssh2.libssh2_keepalive_config(self._session, want_reply, interval) * - * def keepalive_send(self): # <<<<<<<<<<<<<< + * def keepalive_send(self) -> int: # <<<<<<<<<<<<<< * """Send keepalive. * */ @@ -14898,10 +15050,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_76keepalive_send(struct __pyx_ return __pyx_r; } -/* "ssh2/session.pyx":732 +/* "ssh2/session.pyx":755 * return c_seconds * - * def supported_algs(self, MethodType method_type): # <<<<<<<<<<<<<< + * def supported_algs(self, MethodType method_type) -> List[str]: # <<<<<<<<<<<<<< * """Get supportd algorithms for method type. * */ @@ -14914,7 +15066,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__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 "); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_78supported_algs, "supported_algs(self, method_type: MethodType) -> List[str]\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 PyMethodDef __pyx_mdef_4ssh2_7session_7Session_79supported_algs = {"supported_algs", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_79supported_algs, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_78supported_algs}; static PyObject *__pyx_pw_4ssh2_7session_7Session_79supported_algs(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -14960,12 +15112,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 732, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 755, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "supported_algs") < 0)) __PYX_ERR(1, 732, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "supported_algs") < 0)) __PYX_ERR(1, 755, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; @@ -14976,7 +15128,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("supported_algs", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 732, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("supported_algs", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 755, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -14990,7 +15142,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __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, 732, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_method_type), __pyx_ptype_4ssh2_7session_MethodType, 1, "method_type", 0))) __PYX_ERR(1, 755, __pyx_L1_error) __pyx_r = __pyx_pf_4ssh2_7session_7Session_78supported_algs(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_method_type); /* function exit code */ @@ -15033,7 +15185,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_78supported_algs(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("supported_algs", 1); - /* "ssh2/session.pyx":743 + /* "ssh2/session.pyx":766 * cdef const char **c_algs * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -15049,7 +15201,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_78supported_algs(struct __pyx_ #endif /*try:*/ { - /* "ssh2/session.pyx":744 + /* "ssh2/session.pyx":767 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_session_supported_algs( # <<<<<<<<<<<<<< @@ -15059,7 +15211,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_78supported_algs(struct __pyx_ __pyx_v_rc = libssh2_session_supported_algs(__pyx_v_self->_session, __pyx_v_method_type->value, (&__pyx_v_c_algs)); } - /* "ssh2/session.pyx":743 + /* "ssh2/session.pyx":766 * cdef const char **c_algs * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -15078,7 +15230,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_78supported_algs(struct __pyx_ } } - /* "ssh2/session.pyx":746 + /* "ssh2/session.pyx":769 * rc = c_ssh2.libssh2_session_supported_algs( * self._session, method_type.value, &c_algs) * if rc < 0: # <<<<<<<<<<<<<< @@ -15088,7 +15240,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_78supported_algs(struct __pyx_ __pyx_t_1 = (__pyx_v_rc < 0); if (__pyx_t_1) { - /* "ssh2/session.pyx":747 + /* "ssh2/session.pyx":770 * self._session, method_type.value, &c_algs) * if rc < 0: * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -15096,14 +15248,15 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_78supported_algs(struct __pyx_ * 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, 747, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 747, __pyx_L1_error) + __pyx_t_2 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 770, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 770, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; + if (!(likely(PyList_CheckExact(__pyx_t_3)) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_3))) __PYX_ERR(1, 770, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":746 + /* "ssh2/session.pyx":769 * rc = c_ssh2.libssh2_session_supported_algs( * self._session, method_type.value, &c_algs) * if rc < 0: # <<<<<<<<<<<<<< @@ -15112,7 +15265,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_78supported_algs(struct __pyx_ */ } - /* "ssh2/session.pyx":748 + /* "ssh2/session.pyx":771 * if rc < 0: * return handle_error_codes(rc) * elif rc == 0: # <<<<<<<<<<<<<< @@ -15122,7 +15275,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_78supported_algs(struct __pyx_ __pyx_t_1 = (__pyx_v_rc == 0); if (__pyx_t_1) { - /* "ssh2/session.pyx":749 + /* "ssh2/session.pyx":772 * return handle_error_codes(rc) * elif rc == 0: * return [] # <<<<<<<<<<<<<< @@ -15130,13 +15283,13 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_78supported_algs(struct __pyx_ * 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, 749, __pyx_L1_error) + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 772, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; + __pyx_r = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":748 + /* "ssh2/session.pyx":771 * if rc < 0: * return handle_error_codes(rc) * elif rc == 0: # <<<<<<<<<<<<<< @@ -15145,7 +15298,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_78supported_algs(struct __pyx_ */ } - /* "ssh2/session.pyx":750 + /* "ssh2/session.pyx":773 * elif rc == 0: * return [] * try: # <<<<<<<<<<<<<< @@ -15154,7 +15307,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_78supported_algs(struct __pyx_ */ /*try:*/ { - /* "ssh2/session.pyx":751 + /* "ssh2/session.pyx":774 * return [] * try: * algs = [to_str(c_algs[i]) for i in range(rc)] # <<<<<<<<<<<<<< @@ -15162,15 +15315,15 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_78supported_algs(struct __pyx_ * with nogil: */ { /* enter inner scope */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 751, __pyx_L8_error) + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 774, __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_7genexpr__pyx_v_i = __pyx_t_5; - __pyx_t_6 = __pyx_f_4ssh2_5utils_to_str((__pyx_v_c_algs[__pyx_7genexpr__pyx_v_i])); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 751, __pyx_L8_error) + __pyx_t_6 = __pyx_f_4ssh2_5utils_to_str((__pyx_v_c_algs[__pyx_7genexpr__pyx_v_i])); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 774, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_6); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 751, __pyx_L8_error) + if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 774, __pyx_L8_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } } /* exit inner scope */ @@ -15178,7 +15331,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_78supported_algs(struct __pyx_ __pyx_t_3 = 0; } - /* "ssh2/session.pyx":753 + /* "ssh2/session.pyx":776 * algs = [to_str(c_algs[i]) for i in range(rc)] * finally: * with nogil: # <<<<<<<<<<<<<< @@ -15196,7 +15349,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_78supported_algs(struct __pyx_ #endif /*try:*/ { - /* "ssh2/session.pyx":754 + /* "ssh2/session.pyx":777 * finally: * with nogil: * c_ssh2.libssh2_free(self._session, c_algs) # <<<<<<<<<<<<<< @@ -15206,7 +15359,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_78supported_algs(struct __pyx_ libssh2_free(__pyx_v_self->_session, __pyx_v_c_algs); } - /* "ssh2/session.pyx":753 + /* "ssh2/session.pyx":776 * algs = [to_str(c_algs[i]) for i in range(rc)] * finally: * with nogil: # <<<<<<<<<<<<<< @@ -15252,7 +15405,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_78supported_algs(struct __pyx_ #endif /*try:*/ { - /* "ssh2/session.pyx":754 + /* "ssh2/session.pyx":777 * finally: * with nogil: * c_ssh2.libssh2_free(self._session, c_algs) # <<<<<<<<<<<<<< @@ -15262,7 +15415,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_78supported_algs(struct __pyx_ libssh2_free(__pyx_v_self->_session, __pyx_v_c_algs); } - /* "ssh2/session.pyx":753 + /* "ssh2/session.pyx":776 * algs = [to_str(c_algs[i]) for i in range(rc)] * finally: * with nogil: # <<<<<<<<<<<<<< @@ -15298,22 +15451,22 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_78supported_algs(struct __pyx_ __pyx_L9:; } - /* "ssh2/session.pyx":755 + /* "ssh2/session.pyx":778 * with nogil: * c_ssh2.libssh2_free(self._session, c_algs) * return algs # <<<<<<<<<<<<<< * - * def methods(self, MethodType method_type): + * def methods(self, MethodType method_type) -> str: */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_algs); __pyx_r = __pyx_v_algs; goto __pyx_L0; - /* "ssh2/session.pyx":732 + /* "ssh2/session.pyx":755 * return c_seconds * - * def supported_algs(self, MethodType method_type): # <<<<<<<<<<<<<< + * def supported_algs(self, MethodType method_type) -> List[str]: # <<<<<<<<<<<<<< * """Get supportd algorithms for method type. * */ @@ -15331,10 +15484,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_78supported_algs(struct __pyx_ return __pyx_r; } -/* "ssh2/session.pyx":757 +/* "ssh2/session.pyx":780 * return algs * - * def methods(self, MethodType method_type): # <<<<<<<<<<<<<< + * def methods(self, MethodType method_type) -> str: # <<<<<<<<<<<<<< * """Get currently active algorithms for method type. * */ @@ -15347,7 +15500,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__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 "); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_80methods, "methods(self, method_type: MethodType) -> str\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 PyMethodDef __pyx_mdef_4ssh2_7session_7Session_81methods = {"methods", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_81methods, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_80methods}; static PyObject *__pyx_pw_4ssh2_7session_7Session_81methods(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -15393,12 +15546,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 757, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 780, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "methods") < 0)) __PYX_ERR(1, 757, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "methods") < 0)) __PYX_ERR(1, 780, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; @@ -15409,7 +15562,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("methods", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 757, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("methods", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 780, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -15423,7 +15576,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __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, 757, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_method_type), __pyx_ptype_4ssh2_7session_MethodType, 1, "method_type", 0))) __PYX_ERR(1, 780, __pyx_L1_error) __pyx_r = __pyx_pf_4ssh2_7session_7Session_80methods(((struct __pyx_obj_4ssh2_7session_Session *)__pyx_v_self), __pyx_v_method_type); /* function exit code */ @@ -15453,18 +15606,18 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_80methods(struct __pyx_obj_4ss int __pyx_clineno = 0; __Pyx_RefNannySetupContext("methods", 1); - /* "ssh2/session.pyx":765 + /* "ssh2/session.pyx":788 * :rtype: str * """ * if not self.sock: # <<<<<<<<<<<<<< * return * with nogil: */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->sock); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 765, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->sock); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 788, __pyx_L1_error) __pyx_t_2 = (!__pyx_t_1); if (__pyx_t_2) { - /* "ssh2/session.pyx":766 + /* "ssh2/session.pyx":789 * """ * if not self.sock: * return # <<<<<<<<<<<<<< @@ -15472,10 +15625,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_80methods(struct __pyx_obj_4ss * methods = c_ssh2.libssh2_session_methods( */ __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "ssh2/session.pyx":765 + /* "ssh2/session.pyx":788 * :rtype: str * """ * if not self.sock: # <<<<<<<<<<<<<< @@ -15484,7 +15637,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_80methods(struct __pyx_obj_4ss */ } - /* "ssh2/session.pyx":767 + /* "ssh2/session.pyx":790 * if not self.sock: * return * with nogil: # <<<<<<<<<<<<<< @@ -15500,7 +15653,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_80methods(struct __pyx_obj_4ss #endif /*try:*/ { - /* "ssh2/session.pyx":768 + /* "ssh2/session.pyx":791 * return * with nogil: * methods = c_ssh2.libssh2_session_methods( # <<<<<<<<<<<<<< @@ -15510,7 +15663,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_80methods(struct __pyx_obj_4ss __pyx_v_methods = libssh2_session_methods(__pyx_v_self->_session, __pyx_v_method_type->value); } - /* "ssh2/session.pyx":767 + /* "ssh2/session.pyx":790 * if not self.sock: * return * with nogil: # <<<<<<<<<<<<<< @@ -15529,24 +15682,25 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_80methods(struct __pyx_obj_4ss } } - /* "ssh2/session.pyx":770 + /* "ssh2/session.pyx":793 * 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): + * def method_pref(self, MethodType method_type, prefs not None) -> int: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_f_4ssh2_5utils_to_str(__pyx_v_methods); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 770, __pyx_L1_error) + __pyx_t_3 = __pyx_f_4ssh2_5utils_to_str(__pyx_v_methods); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 793, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; + if (!(likely(PyUnicode_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_3))) __PYX_ERR(1, 793, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":757 + /* "ssh2/session.pyx":780 * return algs * - * def methods(self, MethodType method_type): # <<<<<<<<<<<<<< + * def methods(self, MethodType method_type) -> str: # <<<<<<<<<<<<<< * """Get currently active algorithms for method type. * */ @@ -15562,10 +15716,10 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_80methods(struct __pyx_obj_4ss return __pyx_r; } -/* "ssh2/session.pyx":772 +/* "ssh2/session.pyx":795 * return to_str(methods) * - * def method_pref(self, MethodType method_type, prefs not None): # <<<<<<<<<<<<<< + * def method_pref(self, MethodType method_type, prefs not None) -> int: # <<<<<<<<<<<<<< * """Set preference for session method. * */ @@ -15578,7 +15732,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__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 "); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_82method_pref, "method_pref(self, method_type: MethodType, prefs) -> int\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 PyMethodDef __pyx_mdef_4ssh2_7session_7Session_83method_pref = {"method_pref", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_83method_pref, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_82method_pref}; static PyObject *__pyx_pw_4ssh2_7session_7Session_83method_pref(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -15627,7 +15781,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 772, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 795, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: @@ -15635,14 +15789,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 772, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 795, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("method_pref", 1, 2, 2, 1); __PYX_ERR(1, 772, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("method_pref", 1, 2, 2, 1); __PYX_ERR(1, 795, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "method_pref") < 0)) __PYX_ERR(1, 772, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "method_pref") < 0)) __PYX_ERR(1, 795, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; @@ -15655,7 +15809,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("method_pref", 1, 2, 2, __pyx_nargs); __PYX_ERR(1, 772, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("method_pref", 1, 2, 2, __pyx_nargs); __PYX_ERR(1, 795, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -15669,9 +15823,9 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __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, 772, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_method_type), __pyx_ptype_4ssh2_7session_MethodType, 1, "method_type", 0))) __PYX_ERR(1, 795, __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, 772, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "prefs"); __PYX_ERR(1, 795, __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); @@ -15704,19 +15858,19 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_82method_pref(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("method_pref", 1); - /* "ssh2/session.pyx":787 + /* "ssh2/session.pyx":810 * 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, 787, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_to_bytes(__pyx_v_prefs); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 810, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_prefs = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/session.pyx":788 + /* "ssh2/session.pyx":811 * """ * cdef bytes b_prefs = to_bytes(prefs) * cdef const char *c_prefs = b_prefs # <<<<<<<<<<<<<< @@ -15725,12 +15879,12 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_82method_pref(struct __pyx_obj */ if (unlikely(__pyx_v_b_prefs == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(1, 788, __pyx_L1_error) + __PYX_ERR(1, 811, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_b_prefs); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 788, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_b_prefs); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(1, 811, __pyx_L1_error) __pyx_v_c_prefs = __pyx_t_2; - /* "ssh2/session.pyx":790 + /* "ssh2/session.pyx":813 * cdef const char *c_prefs = b_prefs * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -15746,7 +15900,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_82method_pref(struct __pyx_obj #endif /*try:*/ { - /* "ssh2/session.pyx":791 + /* "ssh2/session.pyx":814 * cdef int rc * with nogil: * rc = c_ssh2.libssh2_session_method_pref( # <<<<<<<<<<<<<< @@ -15756,7 +15910,7 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_82method_pref(struct __pyx_obj __pyx_v_rc = libssh2_session_method_pref(__pyx_v_self->_session, __pyx_v_method_type->value, __pyx_v_c_prefs); } - /* "ssh2/session.pyx":790 + /* "ssh2/session.pyx":813 * cdef const char *c_prefs = b_prefs * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -15775,30 +15929,31 @@ static PyObject *__pyx_pf_4ssh2_7session_7Session_82method_pref(struct __pyx_obj } } - /* "ssh2/session.pyx":793 + /* "ssh2/session.pyx":816 * 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, 793, __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, 816, __pyx_L1_error) - /* "ssh2/session.pyx":794 + /* "ssh2/session.pyx":817 * 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, 794, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_t_1)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_t_1))) __PYX_ERR(1, 817, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/session.pyx":772 + /* "ssh2/session.pyx":795 * return to_str(methods) * - * def method_pref(self, MethodType method_type, prefs not None): # <<<<<<<<<<<<<< + * def method_pref(self, MethodType method_type, prefs not None) -> int: # <<<<<<<<<<<<<< * """Set preference for session method. * */ @@ -15907,7 +16062,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_84__reduce_cython__, "Session.__reduce_cython__(self)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_84__reduce_cython__, "__reduce_cython__(self)"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_85__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_85__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_84__reduce_cython__}; static PyObject *__pyx_pw_4ssh2_7session_7Session_85__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -15988,7 +16143,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_86__setstate_cython__, "Session.__setstate_cython__(self, __pyx_state)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_7session_7Session_86__setstate_cython__, "__setstate_cython__(self, __pyx_state)"); static PyMethodDef __pyx_mdef_4ssh2_7session_7Session_87__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_7session_7Session_87__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_7session_7Session_86__setstate_cython__}; static PyObject *__pyx_pw_4ssh2_7session_7Session_87__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -16686,8 +16841,16 @@ static PyMethodDef __pyx_methods[] = { static int __Pyx_CreateStringTabAndInitStrings(void) { __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0}, + {&__pyx_kp_s_Agent, __pyx_k_Agent, sizeof(__pyx_k_Agent), 0, 0, 1, 0}, + {&__pyx_n_s_Any, __pyx_k_Any, sizeof(__pyx_k_Any), 0, 0, 1, 1}, + {&__pyx_n_s_AnyStr, __pyx_k_AnyStr, sizeof(__pyx_k_AnyStr), 0, 0, 1, 1}, + {&__pyx_kp_s_AnyStr_None, __pyx_k_AnyStr_None, sizeof(__pyx_k_AnyStr_None), 0, 0, 1, 0}, + {&__pyx_n_s_BinaryIO, __pyx_k_BinaryIO, sizeof(__pyx_k_BinaryIO), 0, 0, 1, 1}, + {&__pyx_kp_s_Channel, __pyx_k_Channel, sizeof(__pyx_k_Channel), 0, 0, 1, 0}, {&__pyx_n_s_ChannelError, __pyx_k_ChannelError, sizeof(__pyx_k_ChannelError), 0, 0, 1, 1}, + {&__pyx_kp_s_Channel_None, __pyx_k_Channel_None, sizeof(__pyx_k_Channel_None), 0, 0, 1, 0}, {&__pyx_kp_u_Error_retrieving_server_host_key, __pyx_k_Error_retrieving_server_host_key, sizeof(__pyx_k_Error_retrieving_server_host_key), 0, 1, 0, 0}, + {&__pyx_kp_s_KnownHost, __pyx_k_KnownHost, sizeof(__pyx_k_KnownHost), 0, 0, 1, 0}, {&__pyx_n_s_KnownHostError, __pyx_k_KnownHostError, sizeof(__pyx_k_KnownHostError), 0, 0, 1, 1}, {&__pyx_n_s_LIBSSH2_HOSTKEY_HASH_MD5, __pyx_k_LIBSSH2_HOSTKEY_HASH_MD5, sizeof(__pyx_k_LIBSSH2_HOSTKEY_HASH_MD5), 0, 0, 1, 1}, {&__pyx_n_s_LIBSSH2_HOSTKEY_HASH_SHA1, __pyx_k_LIBSSH2_HOSTKEY_HASH_SHA1, sizeof(__pyx_k_LIBSSH2_HOSTKEY_HASH_SHA1), 0, 0, 1, 1}, @@ -16711,11 +16874,17 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__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_List, __pyx_k_List, sizeof(__pyx_k_List), 0, 0, 1, 1}, + {&__pyx_kp_s_List_str, __pyx_k_List_str, sizeof(__pyx_k_List_str), 0, 0, 1, 0}, + {&__pyx_kp_s_Listener_None, __pyx_k_Listener_None, sizeof(__pyx_k_Listener_None), 0, 0, 1, 0}, {&__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_MethodType___reduce_cython, __pyx_k_MethodType___reduce_cython, sizeof(__pyx_k_MethodType___reduce_cython), 0, 0, 1, 1}, {&__pyx_n_s_MethodType___setstate_cython, __pyx_k_MethodType___setstate_cython, sizeof(__pyx_k_MethodType___setstate_cython), 0, 0, 1, 1}, + {&__pyx_n_s_None, __pyx_k_None, sizeof(__pyx_k_None), 0, 0, 1, 1}, {&__pyx_n_s_PublicKeyInitError, __pyx_k_PublicKeyInitError, sizeof(__pyx_k_PublicKeyInitError), 0, 0, 1, 1}, + {&__pyx_kp_s_PublicKeySystem, __pyx_k_PublicKeySystem, sizeof(__pyx_k_PublicKeySystem), 0, 0, 1, 0}, + {&__pyx_kp_s_SFTP, __pyx_k_SFTP, sizeof(__pyx_k_SFTP), 0, 0, 1, 0}, {&__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_Session___reduce_cython, __pyx_k_Session___reduce_cython, sizeof(__pyx_k_Session___reduce_cython), 0, 0, 1, 1}, @@ -16760,6 +16929,10 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_Session_userauth_publickey, __pyx_k_Session_userauth_publickey, sizeof(__pyx_k_Session_userauth_publickey), 0, 0, 1, 1}, {&__pyx_n_s_Session_userauth_publickey_fromf, __pyx_k_Session_userauth_publickey_fromf, sizeof(__pyx_k_Session_userauth_publickey_fromf), 0, 0, 1, 1}, {&__pyx_n_s_Session_userauth_publickey_fromm, __pyx_k_Session_userauth_publickey_fromm, sizeof(__pyx_k_Session_userauth_publickey_fromm), 0, 0, 1, 1}, + {&__pyx_n_s_Tuple, __pyx_k_Tuple, sizeof(__pyx_k_Tuple), 0, 0, 1, 1}, + {&__pyx_kp_s_Tuple_Channel_FileInfo_None, __pyx_k_Tuple_Channel_FileInfo_None, sizeof(__pyx_k_Tuple_Channel_FileInfo_None), 0, 0, 1, 0}, + {&__pyx_kp_s_Tuple_Listener_int_None, __pyx_k_Tuple_Listener_int_None, sizeof(__pyx_k_Tuple_Listener_int_None), 0, 0, 1, 0}, + {&__pyx_kp_s_Tuple_bytes_int, __pyx_k_Tuple_bytes_int, sizeof(__pyx_k_Tuple_bytes_int), 0, 0, 1, 0}, {&__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_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0}, @@ -16787,7 +16960,10 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_b_username, __pyx_k_b_username, sizeof(__pyx_k_b_username), 0, 0, 1, 1}, {&__pyx_n_s_block_directions, __pyx_k_block_directions, sizeof(__pyx_k_block_directions), 0, 0, 1, 1}, {&__pyx_n_s_blocking, __pyx_k_blocking, sizeof(__pyx_k_blocking), 0, 0, 1, 1}, + {&__pyx_n_s_bool, __pyx_k_bool, sizeof(__pyx_k_bool), 0, 0, 1, 1}, {&__pyx_n_s_bound_port, __pyx_k_bound_port, sizeof(__pyx_k_bound_port), 0, 0, 1, 1}, + {&__pyx_n_s_bytes, __pyx_k_bytes, sizeof(__pyx_k_bytes), 0, 0, 1, 1}, + {&__pyx_kp_s_bytes_None, __pyx_k_bytes_None, sizeof(__pyx_k_bytes_None), 0, 0, 1, 0}, {&__pyx_n_s_c_algs, __pyx_k_c_algs, sizeof(__pyx_k_c_algs), 0, 0, 1, 1}, {&__pyx_n_s_c_prefs, __pyx_k_c_prefs, sizeof(__pyx_k_c_prefs), 0, 0, 1, 1}, {&__pyx_n_s_c_seconds, __pyx_k_c_seconds, sizeof(__pyx_k_c_seconds), 0, 0, 1, 1}, @@ -16823,6 +16999,7 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, {&__pyx_n_s_identity, __pyx_k_identity, sizeof(__pyx_k_identity), 0, 0, 1, 1}, {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_int, __pyx_k_int, sizeof(__pyx_k_int), 0, 0, 1, 1}, {&__pyx_n_s_interval, __pyx_k_interval, sizeof(__pyx_k_interval), 0, 0, 1, 1}, {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0}, @@ -16879,6 +17056,7 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, + {&__pyx_n_s_return, __pyx_k_return, sizeof(__pyx_k_return), 0, 0, 1, 1}, {&__pyx_n_s_scp_recv, __pyx_k_scp_recv, sizeof(__pyx_k_scp_recv), 0, 0, 1, 1}, {&__pyx_n_s_scp_recv2, __pyx_k_scp_recv2, sizeof(__pyx_k_scp_recv2), 0, 0, 1, 1}, {&__pyx_n_s_scp_send, __pyx_k_scp_send, sizeof(__pyx_k_scp_send), 0, 0, 1, 1}, @@ -16902,10 +17080,12 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_kp_s_ssh2_session_pyx, __pyx_k_ssh2_session_pyx, sizeof(__pyx_k_ssh2_session_pyx), 0, 0, 1, 0}, {&__pyx_n_s_startup, __pyx_k_startup, sizeof(__pyx_k_startup), 0, 0, 1, 1}, {&__pyx_n_s_statinfo, __pyx_k_statinfo, sizeof(__pyx_k_statinfo), 0, 0, 1, 1}, + {&__pyx_n_s_str, __pyx_k_str, sizeof(__pyx_k_str), 0, 0, 1, 1}, {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, {&__pyx_n_s_supported_algs, __pyx_k_supported_algs, sizeof(__pyx_k_supported_algs), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, {&__pyx_n_s_timeout, __pyx_k_timeout, sizeof(__pyx_k_timeout), 0, 0, 1, 1}, + {&__pyx_n_s_typing, __pyx_k_typing, sizeof(__pyx_k_typing), 0, 0, 1, 1}, {&__pyx_n_s_userauth_authenticated, __pyx_k_userauth_authenticated, sizeof(__pyx_k_userauth_authenticated), 0, 0, 1, 1}, {&__pyx_n_s_userauth_hostbased_fromfile, __pyx_k_userauth_hostbased_fromfile, sizeof(__pyx_k_userauth_hostbased_fromfile), 0, 0, 1, 1}, {&__pyx_n_s_userauth_keyboardinteractive, __pyx_k_userauth_keyboardinteractive, sizeof(__pyx_k_userauth_keyboardinteractive), 0, 0, 1, 1}, @@ -16927,8 +17107,8 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { /* #### Code section: cached_builtins ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { __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, 88, __pyx_L1_error) - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 102, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(1, 90, __pyx_L1_error) + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 104, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -16939,14 +17119,14 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "ssh2/session.pyx":324 + /* "ssh2/session.pyx":334 * cdef const char *_username = b_username * * def passwd(): # <<<<<<<<<<<<<< * return password * */ - __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(0, 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, 324, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(1, 324, __pyx_L1_error) + __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(0, 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, 334, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(1, 334, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< @@ -16969,479 +17149,479 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(__pyx_tuple__7); __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 3, __pyx_L1_error) - /* "ssh2/session.pyx":112 + /* "ssh2/session.pyx":114 * self._session = NULL * - * def disconnect(self): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: + * def disconnect(self) -> int: # <<<<<<<<<<<<<< + * """Disconnect session. + * */ - __pyx_tuple__9 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 112, __pyx_L1_error) + __pyx_tuple__9 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); - __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_disconnect, 112, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(1, 112, __pyx_L1_error) + __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_disconnect, 114, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(1, 114, __pyx_L1_error) - /* "ssh2/session.pyx":118 + /* "ssh2/session.pyx":124 * return handle_error_codes(rc) * - * def handshake(self, sock not None): # <<<<<<<<<<<<<< + * def handshake(self, sock not None: BinaryIO) -> int: # <<<<<<<<<<<<<< * """Perform SSH handshake. * */ - __pyx_tuple__11 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_sock, __pyx_n_s_sock_2, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 118, __pyx_L1_error) + __pyx_tuple__11 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_sock, __pyx_n_s_sock_2, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 124, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); - __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_handshake, 118, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(1, 118, __pyx_L1_error) + __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_handshake, 124, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(1, 124, __pyx_L1_error) - /* "ssh2/session.pyx":130 + /* "ssh2/session.pyx":138 * return handle_error_codes(rc) * * def startup(self, sock): # <<<<<<<<<<<<<< * """Deprecated - use self.handshake""" * cdef int _sock = PyObject_AsFileDescriptor(sock) */ - __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_startup, 130, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(1, 130, __pyx_L1_error) + __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_startup, 138, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(1, 138, __pyx_L1_error) - /* "ssh2/session.pyx":136 + /* "ssh2/session.pyx":144 * return handle_error_codes(rc) * - * def set_blocking(self, bint blocking): # <<<<<<<<<<<<<< + * def set_blocking(self, bint blocking: bool) -> None: # <<<<<<<<<<<<<< * """Set session blocking mode on/off. * */ - __pyx_tuple__14 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_blocking); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 136, __pyx_L1_error) + __pyx_tuple__14 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_blocking); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 144, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__14); __Pyx_GIVEREF(__pyx_tuple__14); - __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_set_blocking, 136, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(1, 136, __pyx_L1_error) + __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_set_blocking, 144, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(1, 144, __pyx_L1_error) - /* "ssh2/session.pyx":146 + /* "ssh2/session.pyx":154 * self._session, blocking) * - * def get_blocking(self): # <<<<<<<<<<<<<< + * def get_blocking(self) -> bool: # <<<<<<<<<<<<<< * """Get session blocking mode enabled True/False. * */ - __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_get_blocking, 146, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(1, 146, __pyx_L1_error) + __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_get_blocking, 154, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(1, 154, __pyx_L1_error) - /* "ssh2/session.pyx":155 + /* "ssh2/session.pyx":163 * return bool(rc) * - * def set_timeout(self, long timeout): # <<<<<<<<<<<<<< + * def set_timeout(self, long timeout) -> None: # <<<<<<<<<<<<<< * """Set the timeout in milliseconds for how long a blocking * call may wait until the situation is considered an error and */ - __pyx_tuple__17 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_timeout); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 155, __pyx_L1_error) + __pyx_tuple__17 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_timeout); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 163, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__17); __Pyx_GIVEREF(__pyx_tuple__17); - __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_set_timeout, 155, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(1, 155, __pyx_L1_error) + __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_set_timeout, 163, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(1, 163, __pyx_L1_error) - /* "ssh2/session.pyx":166 + /* "ssh2/session.pyx":174 * c_ssh2.libssh2_session_set_timeout(self._session, timeout) * - * def get_timeout(self): # <<<<<<<<<<<<<< - * """Get current session timeout setting""" - * cdef long timeout + * def get_timeout(self) -> int: # <<<<<<<<<<<<<< + * """Get current session timeout setting in milliseconds. + * */ - __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_get_timeout, 166, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(1, 166, __pyx_L1_error) + __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_get_timeout, 174, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(1, 174, __pyx_L1_error) - /* "ssh2/session.pyx":173 + /* "ssh2/session.pyx":183 * return timeout * - * def userauth_authenticated(self): # <<<<<<<<<<<<<< + * def userauth_authenticated(self) -> bool: # <<<<<<<<<<<<<< * """True/False for is user authenticated or not. * */ - __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_userauth_authenticated, 173, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(1, 173, __pyx_L1_error) + __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_userauth_authenticated, 183, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(1, 183, __pyx_L1_error) - /* "ssh2/session.pyx":182 + /* "ssh2/session.pyx":192 * return bool(rc) * - * def userauth_list(self, username not None): # <<<<<<<<<<<<<< + * def userauth_list(self, username not None: AnyStr) -> List[str]: # <<<<<<<<<<<<<< * """Retrieve available authentication methodslist. * */ - __pyx_tuple__21 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_username, __pyx_n_s_b_username, __pyx_n_s_username_2, __pyx_n_s_username_len, __pyx_n_s_auth, __pyx_n_s_auth_2); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 182, __pyx_L1_error) + __pyx_tuple__21 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_username, __pyx_n_s_b_username, __pyx_n_s_username_2, __pyx_n_s_username_len, __pyx_n_s_auth, __pyx_n_s_auth_2); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__21); __Pyx_GIVEREF(__pyx_tuple__21); - __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_userauth_list, 182, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(1, 182, __pyx_L1_error) + __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_userauth_list, 192, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(1, 192, __pyx_L1_error) - /* "ssh2/session.pyx":199 + /* "ssh2/session.pyx":209 * return auth.split(',') * - * def userauth_publickey_fromfile(self, username not None, # <<<<<<<<<<<<<< - * privatekey not None, - * passphrase='', + * def userauth_publickey_fromfile(self, username not None: AnyStr, # <<<<<<<<<<<<<< + * privatekey not None: AnyStr, + * passphrase: AnyStr='', */ - __pyx_tuple__23 = PyTuple_Pack(14, __pyx_n_s_self, __pyx_n_s_username, __pyx_n_s_privatekey, __pyx_n_s_passphrase, __pyx_n_s_publickey, __pyx_n_s_rc, __pyx_n_s_b_username, __pyx_n_s_b_publickey, __pyx_n_s_b_privatekey, __pyx_n_s_b_passphrase, __pyx_n_s_username_2, __pyx_n_s_publickey_2, __pyx_n_s_privatekey_2, __pyx_n_s_passphrase_2); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 199, __pyx_L1_error) + __pyx_tuple__23 = PyTuple_Pack(14, __pyx_n_s_self, __pyx_n_s_username, __pyx_n_s_privatekey, __pyx_n_s_passphrase, __pyx_n_s_publickey, __pyx_n_s_rc, __pyx_n_s_b_username, __pyx_n_s_b_publickey, __pyx_n_s_b_privatekey, __pyx_n_s_b_passphrase, __pyx_n_s_username_2, __pyx_n_s_publickey_2, __pyx_n_s_privatekey_2, __pyx_n_s_passphrase_2); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__23); __Pyx_GIVEREF(__pyx_tuple__23); - __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_userauth_publickey_fromfile, 199, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(1, 199, __pyx_L1_error) - __pyx_tuple__25 = PyTuple_Pack(2, __pyx_kp_u__2, Py_None); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 199, __pyx_L1_error) + __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_userauth_publickey_fromfile, 209, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(1, 209, __pyx_L1_error) + __pyx_tuple__25 = PyTuple_Pack(2, __pyx_kp_u__2, Py_None); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__25); __Pyx_GIVEREF(__pyx_tuple__25); - /* "ssh2/session.pyx":223 + /* "ssh2/session.pyx":233 * return handle_error_codes(rc) * - * def userauth_publickey(self, username not None, # <<<<<<<<<<<<<< - * bytes pubkeydata not None): + * def userauth_publickey(self, username not None: AnyStr, # <<<<<<<<<<<<<< + * bytes pubkeydata not None) -> int: * """Perform public key authentication with provided public key data */ - __pyx_tuple__26 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_username, __pyx_n_s_pubkeydata, __pyx_n_s_rc, __pyx_n_s_b_username, __pyx_n_s_username_2, __pyx_n_s_pubkeydata_2, __pyx_n_s_pubkeydata_len); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 223, __pyx_L1_error) + __pyx_tuple__26 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_username, __pyx_n_s_pubkeydata, __pyx_n_s_rc, __pyx_n_s_b_username, __pyx_n_s_username_2, __pyx_n_s_pubkeydata_2, __pyx_n_s_pubkeydata_len); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 233, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__26); __Pyx_GIVEREF(__pyx_tuple__26); - __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_userauth_publickey, 223, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(1, 223, __pyx_L1_error) + __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_userauth_publickey, 233, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(1, 233, __pyx_L1_error) - /* "ssh2/session.pyx":244 + /* "ssh2/session.pyx":254 * return handle_error_codes(rc) * * def userauth_hostbased_fromfile(self, # <<<<<<<<<<<<<< - * username not None, - * privatekey not None, + * username not None: AnyStr, + * privatekey not None: AnyStr, */ - __pyx_tuple__28 = PyTuple_Pack(17, __pyx_n_s_self, __pyx_n_s_username, __pyx_n_s_privatekey, __pyx_n_s_hostname, __pyx_n_s_publickey, __pyx_n_s_passphrase, __pyx_n_s_rc, __pyx_n_s_b_username, __pyx_n_s_b_publickey, __pyx_n_s_b_privatekey, __pyx_n_s_b_passphrase, __pyx_n_s_b_hostname, __pyx_n_s_username_2, __pyx_n_s_publickey_2, __pyx_n_s_privatekey_2, __pyx_n_s_passphrase_2, __pyx_n_s_hostname_2); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(1, 244, __pyx_L1_error) + __pyx_tuple__28 = PyTuple_Pack(17, __pyx_n_s_self, __pyx_n_s_username, __pyx_n_s_privatekey, __pyx_n_s_hostname, __pyx_n_s_publickey, __pyx_n_s_passphrase, __pyx_n_s_rc, __pyx_n_s_b_username, __pyx_n_s_b_publickey, __pyx_n_s_b_privatekey, __pyx_n_s_b_passphrase, __pyx_n_s_b_hostname, __pyx_n_s_username_2, __pyx_n_s_publickey_2, __pyx_n_s_privatekey_2, __pyx_n_s_passphrase_2, __pyx_n_s_hostname_2); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(1, 254, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__28); __Pyx_GIVEREF(__pyx_tuple__28); - __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_userauth_hostbased_fromfile, 244, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(1, 244, __pyx_L1_error) - __pyx_tuple__30 = PyTuple_Pack(2, Py_None, __pyx_kp_u__2); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(1, 244, __pyx_L1_error) + __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_userauth_hostbased_fromfile, 254, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(1, 254, __pyx_L1_error) + __pyx_tuple__30 = PyTuple_Pack(2, Py_None, __pyx_kp_u__2); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(1, 254, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__30); __Pyx_GIVEREF(__pyx_tuple__30); - /* "ssh2/session.pyx":270 + /* "ssh2/session.pyx":280 * return handle_error_codes(rc) * * def userauth_publickey_frommemory( # <<<<<<<<<<<<<< - * self, username, bytes privatekeyfiledata, - * passphrase='', bytes publickeyfiledata=None): + * self, username: AnyStr, bytes privatekeyfiledata, + * passphrase: str='', bytes publickeyfiledata: bytes | None=None) -> int: */ - __pyx_tuple__31 = PyTuple_Pack(15, __pyx_n_s_self, __pyx_n_s_username, __pyx_n_s_privatekeyfiledata, __pyx_n_s_passphrase, __pyx_n_s_publickeyfiledata, __pyx_n_s_rc, __pyx_n_s_b_username, __pyx_n_s_b_passphrase, __pyx_n_s_username_2, __pyx_n_s_passphrase_2, __pyx_n_s_publickeyfiledata_2, __pyx_n_s_privatekeyfiledata_2, __pyx_n_s_username_len, __pyx_n_s_privatekeydata_len, __pyx_n_s_pubkeydata_len); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(1, 270, __pyx_L1_error) + __pyx_tuple__31 = PyTuple_Pack(15, __pyx_n_s_self, __pyx_n_s_username, __pyx_n_s_privatekeyfiledata, __pyx_n_s_passphrase, __pyx_n_s_publickeyfiledata, __pyx_n_s_rc, __pyx_n_s_b_username, __pyx_n_s_b_passphrase, __pyx_n_s_username_2, __pyx_n_s_passphrase_2, __pyx_n_s_publickeyfiledata_2, __pyx_n_s_privatekeyfiledata_2, __pyx_n_s_username_len, __pyx_n_s_privatekeydata_len, __pyx_n_s_pubkeydata_len); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(1, 280, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__31); __Pyx_GIVEREF(__pyx_tuple__31); - __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_userauth_publickey_frommemory, 270, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(1, 270, __pyx_L1_error) + __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_userauth_publickey_frommemory, 280, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(1, 280, __pyx_L1_error) - /* "ssh2/session.pyx":294 + /* "ssh2/session.pyx":304 * return handle_error_codes(rc) * - * def userauth_password(self, username not None, password not None): # <<<<<<<<<<<<<< + * def userauth_password(self, username not None: AnyStr, password not None: AnyStr) -> int: # <<<<<<<<<<<<<< * """Perform password authentication * */ - __pyx_tuple__33 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_username, __pyx_n_s_password, __pyx_n_s_rc, __pyx_n_s_b_username, __pyx_n_s_b_password, __pyx_n_s_username_2, __pyx_n_s_password_2); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(1, 294, __pyx_L1_error) + __pyx_tuple__33 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_username, __pyx_n_s_password, __pyx_n_s_rc, __pyx_n_s_b_username, __pyx_n_s_b_password, __pyx_n_s_username_2, __pyx_n_s_password_2); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(1, 304, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__33); __Pyx_GIVEREF(__pyx_tuple__33); - __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_userauth_password, 294, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(1, 294, __pyx_L1_error) + __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_userauth_password, 304, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(1, 304, __pyx_L1_error) - /* "ssh2/session.pyx":311 + /* "ssh2/session.pyx":321 * return handle_error_codes(rc) * - * def userauth_keyboardinteractive(self, username not None, # <<<<<<<<<<<<<< - * password not None): + * def userauth_keyboardinteractive(self, username not None: AnyStr, # <<<<<<<<<<<<<< + * password not None: AnyStr) -> int: * """Perform keyboard-interactive authentication */ - __pyx_tuple__35 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_username, __pyx_n_s_password, __pyx_n_s_rc, __pyx_n_s_b_username, __pyx_n_s_username_2, __pyx_n_s_passwd, __pyx_n_s_passwd); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(1, 311, __pyx_L1_error) + __pyx_tuple__35 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_username, __pyx_n_s_password, __pyx_n_s_rc, __pyx_n_s_b_username, __pyx_n_s_username_2, __pyx_n_s_passwd, __pyx_n_s_passwd); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(1, 321, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__35); __Pyx_GIVEREF(__pyx_tuple__35); - __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_userauth_keyboardinteractive, 311, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(1, 311, __pyx_L1_error) + __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_userauth_keyboardinteractive, 321, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(1, 321, __pyx_L1_error) - /* "ssh2/session.pyx":333 + /* "ssh2/session.pyx":343 * return handle_error_codes(rc) * - * def agent_init(self): # <<<<<<<<<<<<<< + * def agent_init(self) -> "Agent": # <<<<<<<<<<<<<< * """Initialise SSH agent. * */ - __pyx_tuple__37 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_agent); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(1, 333, __pyx_L1_error) + __pyx_tuple__37 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_agent); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(1, 343, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__37); __Pyx_GIVEREF(__pyx_tuple__37); - __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_agent_init, 333, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(1, 333, __pyx_L1_error) + __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_agent_init, 343, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(1, 343, __pyx_L1_error) - /* "ssh2/session.pyx":343 + /* "ssh2/session.pyx":353 * return PyAgent(agent, self) * - * def agent_auth(self, username not None): # <<<<<<<<<<<<<< + * def agent_auth(self, username not None: AnyStr) -> None: # <<<<<<<<<<<<<< * """Convenience function for performing user authentication via SSH Agent. * */ - __pyx_tuple__39 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_username, __pyx_n_s_b_username, __pyx_n_s_username_2, __pyx_n_s_agent, __pyx_n_s_identity, __pyx_n_s_prev); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(1, 343, __pyx_L1_error) + __pyx_tuple__39 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_username, __pyx_n_s_b_username, __pyx_n_s_username_2, __pyx_n_s_agent, __pyx_n_s_identity, __pyx_n_s_prev); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(1, 353, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__39); __Pyx_GIVEREF(__pyx_tuple__39); - __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_agent_auth, 343, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(1, 343, __pyx_L1_error) + __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_agent_auth, 353, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(1, 353, __pyx_L1_error) - /* "ssh2/session.pyx":378 + /* "ssh2/session.pyx":390 * agent_auth(_username, agent) * - * def open_session(self): # <<<<<<<<<<<<<< + * def open_session(self) -> "Channel" | None: # <<<<<<<<<<<<<< * """Open new channel session. * */ - __pyx_tuple__41 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_channel); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(1, 378, __pyx_L1_error) + __pyx_tuple__41 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_channel); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(1, 390, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__41); __Pyx_GIVEREF(__pyx_tuple__41); - __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_open_session, 378, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(1, 378, __pyx_L1_error) + __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_open_session, 390, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(1, 390, __pyx_L1_error) - /* "ssh2/session.pyx":392 + /* "ssh2/session.pyx":404 * return PyChannel(channel, self) * - * def direct_tcpip_ex(self, host not None, int port, # <<<<<<<<<<<<<< - * shost not None, int sport): - * cdef c_ssh2.LIBSSH2_CHANNEL *channel + * def direct_tcpip_ex(self, host not None: AnyStr, int port, # <<<<<<<<<<<<<< + * shost not None: AnyStr, int sport) -> "Channel" | None: + * """Open direct TCP/IP channel to host:port and open listening connection */ - __pyx_tuple__43 = PyTuple_Pack(10, __pyx_n_s_self, __pyx_n_s_host, __pyx_n_s_port, __pyx_n_s_shost, __pyx_n_s_sport, __pyx_n_s_channel, __pyx_n_s_b_host, __pyx_n_s_b_shost, __pyx_n_s_host_2, __pyx_n_s_shost_2); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(1, 392, __pyx_L1_error) + __pyx_tuple__43 = PyTuple_Pack(10, __pyx_n_s_self, __pyx_n_s_host, __pyx_n_s_port, __pyx_n_s_shost, __pyx_n_s_sport, __pyx_n_s_channel, __pyx_n_s_b_host, __pyx_n_s_b_shost, __pyx_n_s_host_2, __pyx_n_s_shost_2); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(1, 404, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__43); __Pyx_GIVEREF(__pyx_tuple__43); - __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_direct_tcpip_ex, 392, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(1, 392, __pyx_L1_error) + __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_direct_tcpip_ex, 404, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(1, 404, __pyx_L1_error) - /* "ssh2/session.pyx":407 + /* "ssh2/session.pyx":427 * return PyChannel(channel, self) * - * def direct_tcpip(self, host not None, int port): # <<<<<<<<<<<<<< + * def direct_tcpip(self, host not None: AnyStr, int port) -> "Channel" | None: # <<<<<<<<<<<<<< * """Open direct TCP/IP channel to host:port * */ - __pyx_tuple__45 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_host, __pyx_n_s_port, __pyx_n_s_channel, __pyx_n_s_b_host, __pyx_n_s_host_2); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(1, 407, __pyx_L1_error) + __pyx_tuple__45 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_host, __pyx_n_s_port, __pyx_n_s_channel, __pyx_n_s_b_host, __pyx_n_s_host_2); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(1, 427, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__45); __Pyx_GIVEREF(__pyx_tuple__45); - __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_direct_tcpip, 407, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(1, 407, __pyx_L1_error) + __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_direct_tcpip, 427, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(1, 427, __pyx_L1_error) - /* "ssh2/session.pyx":424 + /* "ssh2/session.pyx":446 * return PyChannel(channel, self) * - * def block_directions(self): # <<<<<<<<<<<<<< + * def block_directions(self) -> int: # <<<<<<<<<<<<<< * """Get blocked directions for the current session. * */ - __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_block_directions, 424, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(1, 424, __pyx_L1_error) + __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_block_directions, 446, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(1, 446, __pyx_L1_error) - /* "ssh2/session.pyx":451 + /* "ssh2/session.pyx":473 * return rc * - * def forward_listen(self, int port): # <<<<<<<<<<<<<< + * def forward_listen(self, int port) -> "Listener" | None: # <<<<<<<<<<<<<< * """Create forward listener on port. * */ - __pyx_tuple__48 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_port, __pyx_n_s_listener); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(1, 451, __pyx_L1_error) + __pyx_tuple__48 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_port, __pyx_n_s_listener); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(1, 473, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__48); __Pyx_GIVEREF(__pyx_tuple__48); - __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_forward_listen, 451, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(1, 451, __pyx_L1_error) + __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_forward_listen, 473, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(1, 473, __pyx_L1_error) - /* "ssh2/session.pyx":467 + /* "ssh2/session.pyx":489 * return PyListener(listener, self) * - * def forward_listen_ex(self, int queue_maxsize, host=None, int port=0): # <<<<<<<<<<<<<< + * def forward_listen_ex(self, int queue_maxsize, host: AnyStr | None=None, # <<<<<<<<<<<<<< + * int port=0) -> Tuple["Listener", int] | None: * """ - * Instruct the remote SSH server to begin listening for inbound */ - __pyx_tuple__50 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_queue_maxsize, __pyx_n_s_host, __pyx_n_s_port, __pyx_n_s_listener, __pyx_n_s_b_host, __pyx_n_s_host_2, __pyx_n_s_bound_port); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(1, 467, __pyx_L1_error) + __pyx_tuple__50 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_queue_maxsize, __pyx_n_s_host, __pyx_n_s_port, __pyx_n_s_listener, __pyx_n_s_b_host, __pyx_n_s_host_2, __pyx_n_s_bound_port); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(1, 489, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__50); __Pyx_GIVEREF(__pyx_tuple__50); - __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_forward_listen_ex, 467, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(1, 467, __pyx_L1_error) - __pyx_tuple__52 = PyTuple_Pack(2, Py_None, __pyx_int_0); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(1, 467, __pyx_L1_error) + __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_forward_listen_ex, 489, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(1, 489, __pyx_L1_error) + __pyx_tuple__52 = PyTuple_Pack(2, Py_None, __pyx_int_0); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(1, 489, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__52); __Pyx_GIVEREF(__pyx_tuple__52); - /* "ssh2/session.pyx":503 + /* "ssh2/session.pyx":526 * return (PyListener(listener, self), bound_port) * - * def sftp_init(self): # <<<<<<<<<<<<<< + * def sftp_init(self) -> "SFTP": # <<<<<<<<<<<<<< * """Initialise SFTP channel. * */ - __pyx_tuple__53 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_sftp); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(1, 503, __pyx_L1_error) + __pyx_tuple__53 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_sftp); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(1, 526, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__53); __Pyx_GIVEREF(__pyx_tuple__53); - __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_sftp_init, 503, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(1, 503, __pyx_L1_error) + __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_sftp_init, 526, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(1, 526, __pyx_L1_error) - /* "ssh2/session.pyx":516 + /* "ssh2/session.pyx":539 * return PySFTP(_sftp, self) * * def last_error(self, size_t msg_size=1024): # <<<<<<<<<<<<<< * """Retrieve last error message from libssh2, if any. * Returns empty string on no error message. */ - __pyx_tuple__55 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_msg_size, __pyx_n_s_error_msg, __pyx_n_s_msg, __pyx_n_s_errmsg_len); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(1, 516, __pyx_L1_error) + __pyx_tuple__55 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_msg_size, __pyx_n_s_error_msg, __pyx_n_s_msg, __pyx_n_s_errmsg_len); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(1, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__55); __Pyx_GIVEREF(__pyx_tuple__55); - __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_last_error, 516, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(1, 516, __pyx_L1_error) - __pyx_tuple__57 = PyTuple_Pack(1, __pyx_int_1024); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(1, 516, __pyx_L1_error) + __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_last_error, 539, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(1, 539, __pyx_L1_error) + __pyx_tuple__57 = PyTuple_Pack(1, __pyx_int_1024); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(1, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__57); __Pyx_GIVEREF(__pyx_tuple__57); - /* "ssh2/session.pyx":536 + /* "ssh2/session.pyx":559 * free(_error_msg) * - * def last_errno(self): # <<<<<<<<<<<<<< + * def last_errno(self) -> int: # <<<<<<<<<<<<<< * """Retrieve last error number from libssh2, if any. * Returns 0 on no last error. */ - __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_last_errno, 536, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(1, 536, __pyx_L1_error) + __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_last_errno, 559, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(1, 559, __pyx_L1_error) - /* "ssh2/session.pyx":548 + /* "ssh2/session.pyx":571 * return rc * - * def set_last_error(self, int errcode, errmsg not None): # <<<<<<<<<<<<<< + * def set_last_error(self, int errcode, errmsg not None: AnyStr) -> int: # <<<<<<<<<<<<<< * cdef bytes b_errmsg = to_bytes(errmsg) * cdef char *_errmsg = b_errmsg */ - __pyx_tuple__59 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_errcode, __pyx_n_s_errmsg, __pyx_n_s_b_errmsg, __pyx_n_s_errmsg_2, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(1, 548, __pyx_L1_error) + __pyx_tuple__59 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_errcode, __pyx_n_s_errmsg, __pyx_n_s_b_errmsg, __pyx_n_s_errmsg_2, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(1, 571, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__59); __Pyx_GIVEREF(__pyx_tuple__59); - __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_set_last_error, 548, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __PYX_ERR(1, 548, __pyx_L1_error) + __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_set_last_error, 571, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __PYX_ERR(1, 571, __pyx_L1_error) - /* "ssh2/session.pyx":557 + /* "ssh2/session.pyx":580 * return rc * * def scp_recv(self, path not None): # <<<<<<<<<<<<<< * """Receive file via SCP. * */ - __pyx_tuple__61 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_path, __pyx_n_s_b_path, __pyx_n_s_path_2, __pyx_n_s_statinfo, __pyx_n_s_channel); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(1, 557, __pyx_L1_error) + __pyx_tuple__61 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_path, __pyx_n_s_b_path, __pyx_n_s_path_2, __pyx_n_s_statinfo, __pyx_n_s_channel); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(1, 580, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__61); __Pyx_GIVEREF(__pyx_tuple__61); - __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_scp_recv, 557, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(1, 557, __pyx_L1_error) + __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_scp_recv, 580, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(1, 580, __pyx_L1_error) - /* "ssh2/session.pyx":579 + /* "ssh2/session.pyx":602 * return PyChannel(channel, self), statinfo * - * def scp_recv2(self, path not None): # <<<<<<<<<<<<<< + * def scp_recv2(self, path not None: AnyStr) -> Tuple["Channel", "FileInfo"] | None: # <<<<<<<<<<<<<< * """Receive file via SCP. * */ - __pyx_tuple__63 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_path, __pyx_n_s_fileinfo, __pyx_n_s_b_path, __pyx_n_s_path_2, __pyx_n_s_channel); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(1, 579, __pyx_L1_error) + __pyx_tuple__63 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_path, __pyx_n_s_fileinfo, __pyx_n_s_b_path, __pyx_n_s_path_2, __pyx_n_s_channel); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(1, 602, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__63); __Pyx_GIVEREF(__pyx_tuple__63); - __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_scp_recv2, 579, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(1, 579, __pyx_L1_error) + __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_scp_recv2, 602, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(1, 602, __pyx_L1_error) - /* "ssh2/session.pyx":599 + /* "ssh2/session.pyx":622 * return PyChannel(channel, self), fileinfo * * def scp_send(self, path not None, int mode, size_t size): # <<<<<<<<<<<<<< * """Deprecated in favour of scp_send64. Send file via SCP. * */ - __pyx_tuple__65 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_path, __pyx_n_s_mode, __pyx_n_s_size, __pyx_n_s_b_path, __pyx_n_s_path_2, __pyx_n_s_channel); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(1, 599, __pyx_L1_error) + __pyx_tuple__65 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_path, __pyx_n_s_mode, __pyx_n_s_size, __pyx_n_s_b_path, __pyx_n_s_path_2, __pyx_n_s_channel); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(1, 622, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__65); __Pyx_GIVEREF(__pyx_tuple__65); - __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_scp_send, 599, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) __PYX_ERR(1, 599, __pyx_L1_error) + __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_scp_send, 622, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) __PYX_ERR(1, 622, __pyx_L1_error) - /* "ssh2/session.pyx":621 + /* "ssh2/session.pyx":644 * return PyChannel(channel, self) * - * def scp_send64(self, path not None, int mode, c_ssh2.libssh2_uint64_t size, # <<<<<<<<<<<<<< - * time_t mtime, time_t atime): + * def scp_send64(self, path not None: AnyStr, int mode, c_ssh2.libssh2_uint64_t size, # <<<<<<<<<<<<<< + * time_t mtime, time_t atime) -> "Channel": * """Send file via SCP. */ - __pyx_tuple__67 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_path, __pyx_n_s_mode, __pyx_n_s_size, __pyx_n_s_mtime, __pyx_n_s_atime, __pyx_n_s_b_path, __pyx_n_s_path_2, __pyx_n_s_channel); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(1, 621, __pyx_L1_error) + __pyx_tuple__67 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_path, __pyx_n_s_mode, __pyx_n_s_size, __pyx_n_s_mtime, __pyx_n_s_atime, __pyx_n_s_b_path, __pyx_n_s_path_2, __pyx_n_s_channel); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(1, 644, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__67); __Pyx_GIVEREF(__pyx_tuple__67); - __pyx_codeobj__68 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_scp_send64, 621, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__68)) __PYX_ERR(1, 621, __pyx_L1_error) + __pyx_codeobj__68 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_scp_send64, 644, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__68)) __PYX_ERR(1, 644, __pyx_L1_error) - /* "ssh2/session.pyx":644 + /* "ssh2/session.pyx":667 * return PyChannel(channel, self) * - * def publickey_init(self): # <<<<<<<<<<<<<< + * def publickey_init(self) -> "PublicKeySystem": # <<<<<<<<<<<<<< * """Initialise public key subsystem for managing remote server * public keys""" */ - __pyx_tuple__69 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pkey); if (unlikely(!__pyx_tuple__69)) __PYX_ERR(1, 644, __pyx_L1_error) + __pyx_tuple__69 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pkey); if (unlikely(!__pyx_tuple__69)) __PYX_ERR(1, 667, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__69); __Pyx_GIVEREF(__pyx_tuple__69); - __pyx_codeobj__70 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__69, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_publickey_init, 644, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__70)) __PYX_ERR(1, 644, __pyx_L1_error) + __pyx_codeobj__70 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__69, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_publickey_init, 667, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__70)) __PYX_ERR(1, 667, __pyx_L1_error) - /* "ssh2/session.pyx":654 + /* "ssh2/session.pyx":677 * return PyPublicKeySystem(_pkey, self) * - * def hostkey_hash(self, int hash_type): # <<<<<<<<<<<<<< + * def hostkey_hash(self, int hash_type) -> bytes: # <<<<<<<<<<<<<< * """Get computed digest of the remote system's host key. * */ - __pyx_tuple__71 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_hash_type, __pyx_n_s_hash, __pyx_n_s_b_hash); if (unlikely(!__pyx_tuple__71)) __PYX_ERR(1, 654, __pyx_L1_error) + __pyx_tuple__71 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_hash_type, __pyx_n_s_hash, __pyx_n_s_b_hash); if (unlikely(!__pyx_tuple__71)) __PYX_ERR(1, 677, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__71); __Pyx_GIVEREF(__pyx_tuple__71); - __pyx_codeobj__72 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_hostkey_hash, 654, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__72)) __PYX_ERR(1, 654, __pyx_L1_error) + __pyx_codeobj__72 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_hostkey_hash, 677, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__72)) __PYX_ERR(1, 677, __pyx_L1_error) - /* "ssh2/session.pyx":671 + /* "ssh2/session.pyx":694 * return b_hash * - * def hostkey(self): # <<<<<<<<<<<<<< + * def hostkey(self) -> Tuple[bytes, int]: # <<<<<<<<<<<<<< * """Get server host key for this session. * */ - __pyx_tuple__73 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_key, __pyx_n_s_key_2, __pyx_n_s_key_len, __pyx_n_s_key_type); if (unlikely(!__pyx_tuple__73)) __PYX_ERR(1, 671, __pyx_L1_error) + __pyx_tuple__73 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_key, __pyx_n_s_key_2, __pyx_n_s_key_len, __pyx_n_s_key_type); if (unlikely(!__pyx_tuple__73)) __PYX_ERR(1, 694, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__73); __Pyx_GIVEREF(__pyx_tuple__73); - __pyx_codeobj__74 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__73, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_hostkey, 671, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__74)) __PYX_ERR(1, 671, __pyx_L1_error) + __pyx_codeobj__74 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__73, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_hostkey, 694, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__74)) __PYX_ERR(1, 694, __pyx_L1_error) - /* "ssh2/session.pyx":693 + /* "ssh2/session.pyx":716 * return key, key_type * - * def knownhost_init(self): # <<<<<<<<<<<<<< + * def knownhost_init(self) -> "KnownHost": # <<<<<<<<<<<<<< * """Initialise a collection of known hosts for this session. * */ - __pyx_tuple__75 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_known_hosts); if (unlikely(!__pyx_tuple__75)) __PYX_ERR(1, 693, __pyx_L1_error) + __pyx_tuple__75 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_known_hosts); if (unlikely(!__pyx_tuple__75)) __PYX_ERR(1, 716, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__75); __Pyx_GIVEREF(__pyx_tuple__75); - __pyx_codeobj__76 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__75, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_knownhost_init, 693, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__76)) __PYX_ERR(1, 693, __pyx_L1_error) + __pyx_codeobj__76 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__75, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_knownhost_init, 716, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__76)) __PYX_ERR(1, 716, __pyx_L1_error) - /* "ssh2/session.pyx":705 + /* "ssh2/session.pyx":728 * return PyKnownHost(self, known_hosts) * - * def keepalive_config(self, bint want_reply, unsigned interval): # <<<<<<<<<<<<<< + * def keepalive_config(self, bint want_reply, unsigned interval) -> None: # <<<<<<<<<<<<<< * """ * Configure keep alive settings. */ - __pyx_tuple__77 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_want_reply, __pyx_n_s_interval); if (unlikely(!__pyx_tuple__77)) __PYX_ERR(1, 705, __pyx_L1_error) + __pyx_tuple__77 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_want_reply, __pyx_n_s_interval); if (unlikely(!__pyx_tuple__77)) __PYX_ERR(1, 728, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__77); __Pyx_GIVEREF(__pyx_tuple__77); - __pyx_codeobj__78 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__77, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_keepalive_config, 705, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__78)) __PYX_ERR(1, 705, __pyx_L1_error) + __pyx_codeobj__78 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__77, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_keepalive_config, 728, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__78)) __PYX_ERR(1, 728, __pyx_L1_error) - /* "ssh2/session.pyx":718 + /* "ssh2/session.pyx":741 * c_ssh2.libssh2_keepalive_config(self._session, want_reply, interval) * - * def keepalive_send(self): # <<<<<<<<<<<<<< + * def keepalive_send(self) -> int: # <<<<<<<<<<<<<< * """Send keepalive. * */ - __pyx_tuple__79 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_seconds, __pyx_n_s_c_seconds, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__79)) __PYX_ERR(1, 718, __pyx_L1_error) + __pyx_tuple__79 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_seconds, __pyx_n_s_c_seconds, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__79)) __PYX_ERR(1, 741, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__79); __Pyx_GIVEREF(__pyx_tuple__79); - __pyx_codeobj__80 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__79, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_keepalive_send, 718, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__80)) __PYX_ERR(1, 718, __pyx_L1_error) + __pyx_codeobj__80 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__79, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_keepalive_send, 741, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__80)) __PYX_ERR(1, 741, __pyx_L1_error) - /* "ssh2/session.pyx":732 + /* "ssh2/session.pyx":755 * return c_seconds * - * def supported_algs(self, MethodType method_type): # <<<<<<<<<<<<<< + * def supported_algs(self, MethodType method_type) -> List[str]: # <<<<<<<<<<<<<< * """Get supportd algorithms for method type. * */ - __pyx_tuple__81 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_method_type, __pyx_n_s_c_algs, __pyx_n_s_rc, __pyx_n_s_algs, __pyx_n_s_i); if (unlikely(!__pyx_tuple__81)) __PYX_ERR(1, 732, __pyx_L1_error) + __pyx_tuple__81 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_method_type, __pyx_n_s_c_algs, __pyx_n_s_rc, __pyx_n_s_algs, __pyx_n_s_i); if (unlikely(!__pyx_tuple__81)) __PYX_ERR(1, 755, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__81); __Pyx_GIVEREF(__pyx_tuple__81); - __pyx_codeobj__82 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__81, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_supported_algs, 732, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__82)) __PYX_ERR(1, 732, __pyx_L1_error) + __pyx_codeobj__82 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__81, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_supported_algs, 755, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__82)) __PYX_ERR(1, 755, __pyx_L1_error) - /* "ssh2/session.pyx":757 + /* "ssh2/session.pyx":780 * return algs * - * def methods(self, MethodType method_type): # <<<<<<<<<<<<<< + * def methods(self, MethodType method_type) -> str: # <<<<<<<<<<<<<< * """Get currently active algorithms for method type. * */ - __pyx_tuple__83 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_method_type, __pyx_n_s_methods); if (unlikely(!__pyx_tuple__83)) __PYX_ERR(1, 757, __pyx_L1_error) + __pyx_tuple__83 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_method_type, __pyx_n_s_methods); if (unlikely(!__pyx_tuple__83)) __PYX_ERR(1, 780, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__83); __Pyx_GIVEREF(__pyx_tuple__83); - __pyx_codeobj__84 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__83, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_methods, 757, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__84)) __PYX_ERR(1, 757, __pyx_L1_error) + __pyx_codeobj__84 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__83, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_methods, 780, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__84)) __PYX_ERR(1, 780, __pyx_L1_error) - /* "ssh2/session.pyx":772 + /* "ssh2/session.pyx":795 * return to_str(methods) * - * def method_pref(self, MethodType method_type, prefs not None): # <<<<<<<<<<<<<< + * def method_pref(self, MethodType method_type, prefs not None) -> int: # <<<<<<<<<<<<<< * """Set preference for session method. * */ - __pyx_tuple__85 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_method_type, __pyx_n_s_prefs, __pyx_n_s_b_prefs, __pyx_n_s_c_prefs, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__85)) __PYX_ERR(1, 772, __pyx_L1_error) + __pyx_tuple__85 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_method_type, __pyx_n_s_prefs, __pyx_n_s_b_prefs, __pyx_n_s_c_prefs, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__85)) __PYX_ERR(1, 795, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__85); __Pyx_GIVEREF(__pyx_tuple__85); - __pyx_codeobj__86 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__85, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_method_pref, 772, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__86)) __PYX_ERR(1, 772, __pyx_L1_error) + __pyx_codeobj__86 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__85, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_session_pyx, __pyx_n_s_method_pref, 795, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__86)) __PYX_ERR(1, 795, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< @@ -17520,15 +17700,15 @@ static int __Pyx_modinit_type_init_code(void) { __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); /*--- Type init code ---*/ #if CYTHON_USE_TYPE_SPECS - __pyx_ptype_4ssh2_7session_Session = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4ssh2_7session_Session_spec, NULL); if (unlikely(!__pyx_ptype_4ssh2_7session_Session)) __PYX_ERR(1, 94, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4ssh2_7session_Session_spec, __pyx_ptype_4ssh2_7session_Session) < 0) __PYX_ERR(1, 94, __pyx_L1_error) + __pyx_ptype_4ssh2_7session_Session = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4ssh2_7session_Session_spec, NULL); if (unlikely(!__pyx_ptype_4ssh2_7session_Session)) __PYX_ERR(1, 96, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4ssh2_7session_Session_spec, __pyx_ptype_4ssh2_7session_Session) < 0) __PYX_ERR(1, 96, __pyx_L1_error) #else __pyx_ptype_4ssh2_7session_Session = &__pyx_type_4ssh2_7session_Session; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_ptype_4ssh2_7session_Session) < 0) __PYX_ERR(1, 94, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_ptype_4ssh2_7session_Session) < 0) __PYX_ERR(1, 96, __pyx_L1_error) #endif #if PY_MAJOR_VERSION < 3 __pyx_ptype_4ssh2_7session_Session->tp_print = 0; @@ -17538,20 +17718,20 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_ptype_4ssh2_7session_Session->tp_getattro = __Pyx_PyObject_GenericGetAttr; } #endif - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Session, (PyObject *) __pyx_ptype_4ssh2_7session_Session) < 0) __PYX_ERR(1, 94, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Session, (PyObject *) __pyx_ptype_4ssh2_7session_Session) < 0) __PYX_ERR(1, 96, __pyx_L1_error) #if !CYTHON_COMPILING_IN_LIMITED_API - if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_4ssh2_7session_Session) < 0) __PYX_ERR(1, 94, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_4ssh2_7session_Session) < 0) __PYX_ERR(1, 96, __pyx_L1_error) #endif #if CYTHON_USE_TYPE_SPECS - __pyx_ptype_4ssh2_7session_MethodType = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4ssh2_7session_MethodType_spec, NULL); if (unlikely(!__pyx_ptype_4ssh2_7session_MethodType)) __PYX_ERR(1, 56, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4ssh2_7session_MethodType_spec, __pyx_ptype_4ssh2_7session_MethodType) < 0) __PYX_ERR(1, 56, __pyx_L1_error) + __pyx_ptype_4ssh2_7session_MethodType = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4ssh2_7session_MethodType_spec, NULL); if (unlikely(!__pyx_ptype_4ssh2_7session_MethodType)) __PYX_ERR(1, 58, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4ssh2_7session_MethodType_spec, __pyx_ptype_4ssh2_7session_MethodType) < 0) __PYX_ERR(1, 58, __pyx_L1_error) #else __pyx_ptype_4ssh2_7session_MethodType = &__pyx_type_4ssh2_7session_MethodType; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_ptype_4ssh2_7session_MethodType) < 0) __PYX_ERR(1, 56, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_ptype_4ssh2_7session_MethodType) < 0) __PYX_ERR(1, 58, __pyx_L1_error) #endif #if PY_MAJOR_VERSION < 3 __pyx_ptype_4ssh2_7session_MethodType->tp_print = 0; @@ -17561,20 +17741,20 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_ptype_4ssh2_7session_MethodType->tp_getattro = __Pyx_PyObject_GenericGetAttr; } #endif - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MethodType, (PyObject *) __pyx_ptype_4ssh2_7session_MethodType) < 0) __PYX_ERR(1, 56, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MethodType, (PyObject *) __pyx_ptype_4ssh2_7session_MethodType) < 0) __PYX_ERR(1, 58, __pyx_L1_error) #if !CYTHON_COMPILING_IN_LIMITED_API - if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_4ssh2_7session_MethodType) < 0) __PYX_ERR(1, 56, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_4ssh2_7session_MethodType) < 0) __PYX_ERR(1, 58, __pyx_L1_error) #endif #if CYTHON_USE_TYPE_SPECS - __pyx_ptype_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive_spec, NULL); if (unlikely(!__pyx_ptype_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive)) __PYX_ERR(1, 311, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive_spec, __pyx_ptype_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive) < 0) __PYX_ERR(1, 311, __pyx_L1_error) + __pyx_ptype_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive_spec, NULL); if (unlikely(!__pyx_ptype_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive)) __PYX_ERR(1, 321, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive_spec, __pyx_ptype_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive) < 0) __PYX_ERR(1, 321, __pyx_L1_error) #else __pyx_ptype_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive = &__pyx_type_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_ptype_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive) < 0) __PYX_ERR(1, 311, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_ptype_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive) < 0) __PYX_ERR(1, 321, __pyx_L1_error) #endif #if PY_MAJOR_VERSION < 3 __pyx_ptype_4ssh2_7session___pyx_scope_struct__userauth_keyboardinteractive->tp_print = 0; @@ -17601,52 +17781,52 @@ static int __Pyx_modinit_type_import_code(void) { /*--- Type import code ---*/ __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_0_11(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_0_12(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 - sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyTypeObject), + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(PyTypeObject), #elif CYTHON_COMPILING_IN_LIMITED_API - sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyTypeObject), + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(PyTypeObject), #else - sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyHeapTypeObject), + sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(PyHeapTypeObject), #endif - __Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error) + __Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType_3_0_11(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyBoolObject),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(4, 8, __pyx_L1_error) + __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType_3_0_12(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(PyBoolObject),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(4, 8, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType_3_0_11(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyComplexObject),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(5, 15, __pyx_L1_error) + __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType_3_0_12(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(PyComplexObject),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(5, 15, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyImport_ImportModule("ssh2.agent"); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_4ssh2_5agent_Agent = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.agent", "Agent", sizeof(struct __pyx_obj_4ssh2_5agent_Agent), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_5agent_Agent),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_5agent_Agent) __PYX_ERR(6, 24, __pyx_L1_error) + __pyx_ptype_4ssh2_5agent_Agent = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.agent", "Agent", sizeof(struct __pyx_obj_4ssh2_5agent_Agent), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_5agent_Agent),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_5agent_Agent) __PYX_ERR(6, 24, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyImport_ImportModule("ssh2.channel"); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_4ssh2_7channel_Channel = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.channel", "Channel", sizeof(struct __pyx_obj_4ssh2_7channel_Channel), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_7channel_Channel),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_7channel_Channel) __PYX_ERR(7, 24, __pyx_L1_error) + __pyx_ptype_4ssh2_7channel_Channel = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.channel", "Channel", sizeof(struct __pyx_obj_4ssh2_7channel_Channel), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_7channel_Channel),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_7channel_Channel) __PYX_ERR(7, 24, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyImport_ImportModule("ssh2.listener"); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_4ssh2_8listener_Listener = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.listener", "Listener", sizeof(struct __pyx_obj_4ssh2_8listener_Listener), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_8listener_Listener),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_8listener_Listener) __PYX_ERR(8, 24, __pyx_L1_error) + __pyx_ptype_4ssh2_8listener_Listener = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.listener", "Listener", sizeof(struct __pyx_obj_4ssh2_8listener_Listener), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_8listener_Listener),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_8listener_Listener) __PYX_ERR(8, 24, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyImport_ImportModule("ssh2.sftp"); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_4ssh2_4sftp_SFTP = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.sftp", "SFTP", sizeof(struct __pyx_obj_4ssh2_4sftp_SFTP), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_4sftp_SFTP),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_4sftp_SFTP) __PYX_ERR(9, 26, __pyx_L1_error) + __pyx_ptype_4ssh2_4sftp_SFTP = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.sftp", "SFTP", sizeof(struct __pyx_obj_4ssh2_4sftp_SFTP), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_4sftp_SFTP),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_4sftp_SFTP) __PYX_ERR(9, 26, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyImport_ImportModule("ssh2.statinfo"); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_4ssh2_8statinfo_StatInfo = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.statinfo", "StatInfo", sizeof(struct __pyx_obj_4ssh2_8statinfo_StatInfo), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_8statinfo_StatInfo),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_8statinfo_StatInfo) __PYX_ERR(10, 20, __pyx_L1_error) + __pyx_ptype_4ssh2_8statinfo_StatInfo = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.statinfo", "StatInfo", sizeof(struct __pyx_obj_4ssh2_8statinfo_StatInfo), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_8statinfo_StatInfo),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_8statinfo_StatInfo) __PYX_ERR(10, 20, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyImport_ImportModule("ssh2.knownhost"); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_4ssh2_9knownhost_KnownHostEntry = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.knownhost", "KnownHostEntry", sizeof(struct __pyx_obj_4ssh2_9knownhost_KnownHostEntry), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_9knownhost_KnownHostEntry),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_9knownhost_KnownHostEntry) __PYX_ERR(11, 24, __pyx_L1_error) - __pyx_ptype_4ssh2_9knownhost_KnownHost = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.knownhost", "KnownHost", sizeof(struct __pyx_obj_4ssh2_9knownhost_KnownHost), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_9knownhost_KnownHost),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_9knownhost_KnownHost) __PYX_ERR(11, 28, __pyx_L1_error) + __pyx_ptype_4ssh2_9knownhost_KnownHostEntry = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.knownhost", "KnownHostEntry", sizeof(struct __pyx_obj_4ssh2_9knownhost_KnownHostEntry), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_9knownhost_KnownHostEntry),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_9knownhost_KnownHostEntry) __PYX_ERR(11, 24, __pyx_L1_error) + __pyx_ptype_4ssh2_9knownhost_KnownHost = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.knownhost", "KnownHost", sizeof(struct __pyx_obj_4ssh2_9knownhost_KnownHost), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_9knownhost_KnownHost),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_9knownhost_KnownHost) __PYX_ERR(11, 28, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyImport_ImportModule("ssh2.fileinfo"); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_4ssh2_8fileinfo_FileInfo = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.fileinfo", "FileInfo", sizeof(struct __pyx_obj_4ssh2_8fileinfo_FileInfo), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_8fileinfo_FileInfo),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_8fileinfo_FileInfo) __PYX_ERR(12, 19, __pyx_L1_error) + __pyx_ptype_4ssh2_8fileinfo_FileInfo = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.fileinfo", "FileInfo", sizeof(struct __pyx_obj_4ssh2_8fileinfo_FileInfo), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_8fileinfo_FileInfo),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_8fileinfo_FileInfo) __PYX_ERR(12, 19, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -17674,36 +17854,36 @@ static int __Pyx_modinit_function_import_code(void) { /*--- Function import code ---*/ __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_3_0_11(__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_3_0_11(__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_3_0_11(__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_3_0_11(__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) + if (__Pyx_ImportFunction_3_0_12(__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_3_0_12(__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_3_0_12(__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_3_0_12(__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(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction_3_0_11(__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) + if (__Pyx_ImportFunction_3_0_12(__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(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction_3_0_11(__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) + if (__Pyx_ImportFunction_3_0_12(__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(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction_3_0_11(__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) + if (__Pyx_ImportFunction_3_0_12(__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(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction_3_0_11(__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) + if (__Pyx_ImportFunction_3_0_12(__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(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction_3_0_11(__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_3_0_11(__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_3_0_11(__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) + if (__Pyx_ImportFunction_3_0_12(__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_3_0_12(__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_3_0_12(__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(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction_3_0_11(__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) + if (__Pyx_ImportFunction_3_0_12(__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; @@ -17992,201 +18172,250 @@ if (!__Pyx_RefNanny) { if (__Pyx_patch_abc() < 0) __PYX_ERR(1, 1, __pyx_L1_error) #endif - /* "ssh2/session.pyx":24 + /* "ssh2/session.pyx":17 + * # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * from typing import Any, AnyStr, List, Tuple, BinaryIO # <<<<<<<<<<<<<< + * + * from cpython cimport PyObject_AsFileDescriptor + */ + __pyx_t_2 = PyList_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_n_s_Any); + __Pyx_GIVEREF(__pyx_n_s_Any); + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Any)) __PYX_ERR(1, 17, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_AnyStr); + __Pyx_GIVEREF(__pyx_n_s_AnyStr); + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_AnyStr)) __PYX_ERR(1, 17, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_List); + __Pyx_GIVEREF(__pyx_n_s_List); + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_List)) __PYX_ERR(1, 17, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_Tuple); + __Pyx_GIVEREF(__pyx_n_s_Tuple); + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_Tuple)) __PYX_ERR(1, 17, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_BinaryIO); + __Pyx_GIVEREF(__pyx_n_s_BinaryIO); + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_s_BinaryIO)) __PYX_ERR(1, 17, __pyx_L1_error); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_typing, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Any); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Any, __pyx_t_2) < 0) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_AnyStr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_AnyStr, __pyx_t_2) < 0) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_List); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_List, __pyx_t_2) < 0) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Tuple); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Tuple, __pyx_t_2) < 0) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_BinaryIO); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_BinaryIO, __pyx_t_2) < 0) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "ssh2/session.pyx":26 * from .agent cimport PyAgent, agent_auth, agent_init, init_connect_agent * from .channel cimport PyChannel * from .exceptions import SessionHostKeyError, KnownHostError, \ # <<<<<<<<<<<<<< * PublicKeyInitError, ChannelError * from .listener cimport PyListener */ - __pyx_t_2 = PyList_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyList_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_n_s_SessionHostKeyError); __Pyx_GIVEREF(__pyx_n_s_SessionHostKeyError); - if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_SessionHostKeyError)) __PYX_ERR(1, 24, __pyx_L1_error); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_SessionHostKeyError)) __PYX_ERR(1, 26, __pyx_L1_error); __Pyx_INCREF(__pyx_n_s_KnownHostError); __Pyx_GIVEREF(__pyx_n_s_KnownHostError); - if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_KnownHostError)) __PYX_ERR(1, 24, __pyx_L1_error); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_KnownHostError)) __PYX_ERR(1, 26, __pyx_L1_error); __Pyx_INCREF(__pyx_n_s_PublicKeyInitError); __Pyx_GIVEREF(__pyx_n_s_PublicKeyInitError); - if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_PublicKeyInitError)) __PYX_ERR(1, 24, __pyx_L1_error); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 2, __pyx_n_s_PublicKeyInitError)) __PYX_ERR(1, 26, __pyx_L1_error); __Pyx_INCREF(__pyx_n_s_ChannelError); __Pyx_GIVEREF(__pyx_n_s_ChannelError); - if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_ChannelError)) __PYX_ERR(1, 24, __pyx_L1_error); - __pyx_t_3 = __Pyx_Import(__pyx_n_s_exceptions, __pyx_t_2, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_SessionHostKeyError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 24, __pyx_L1_error) + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 3, __pyx_n_s_ChannelError)) __PYX_ERR(1, 26, __pyx_L1_error); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_exceptions, __pyx_t_3, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_SessionHostKeyError, __pyx_t_2) < 0) __PYX_ERR(1, 24, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_KnownHostError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_KnownHostError, __pyx_t_2) < 0) __PYX_ERR(1, 24, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PublicKeyInitError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_PublicKeyInitError, __pyx_t_2) < 0) __PYX_ERR(1, 25, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_ChannelError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_ChannelError, __pyx_t_2) < 0) __PYX_ERR(1, 25, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_SessionHostKeyError); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_SessionHostKeyError, __pyx_t_3) < 0) __PYX_ERR(1, 26, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_KnownHostError); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_KnownHostError, __pyx_t_3) < 0) __PYX_ERR(1, 26, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_PublicKeyInitError); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_PublicKeyInitError, __pyx_t_3) < 0) __PYX_ERR(1, 27, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ChannelError); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ChannelError, __pyx_t_3) < 0) __PYX_ERR(1, 27, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ssh2/session.pyx":40 + /* "ssh2/session.pyx":42 * * * LIBSSH2_SESSION_BLOCK_INBOUND = c_ssh2.LIBSSH2_SESSION_BLOCK_INBOUND # <<<<<<<<<<<<<< * LIBSSH2_SESSION_BLOCK_OUTBOUND = c_ssh2.LIBSSH2_SESSION_BLOCK_OUTBOUND * */ - __pyx_t_3 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_SESSION_BLOCK_INBOUND); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_SESSION_BLOCK_INBOUND, __pyx_t_3) < 0) __PYX_ERR(1, 40, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_SESSION_BLOCK_INBOUND); 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_INBOUND, __pyx_t_2) < 0) __PYX_ERR(1, 42, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ssh2/session.pyx":41 + /* "ssh2/session.pyx":43 * * LIBSSH2_SESSION_BLOCK_INBOUND = c_ssh2.LIBSSH2_SESSION_BLOCK_INBOUND * LIBSSH2_SESSION_BLOCK_OUTBOUND = c_ssh2.LIBSSH2_SESSION_BLOCK_OUTBOUND # <<<<<<<<<<<<<< * * LIBSSH2_HOSTKEY_HASH_MD5 = c_ssh2.LIBSSH2_HOSTKEY_HASH_MD5 */ - __pyx_t_3 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_SESSION_BLOCK_OUTBOUND); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_SESSION_BLOCK_OUTBOUND, __pyx_t_3) < 0) __PYX_ERR(1, 41, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_SESSION_BLOCK_OUTBOUND); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 43, __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(1, 43, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ssh2/session.pyx":43 + /* "ssh2/session.pyx":45 * LIBSSH2_SESSION_BLOCK_OUTBOUND = c_ssh2.LIBSSH2_SESSION_BLOCK_OUTBOUND * * LIBSSH2_HOSTKEY_HASH_MD5 = c_ssh2.LIBSSH2_HOSTKEY_HASH_MD5 # <<<<<<<<<<<<<< * LIBSSH2_HOSTKEY_HASH_SHA1 = c_ssh2.LIBSSH2_HOSTKEY_HASH_SHA1 * LIBSSH2_HOSTKEY_HASH_SHA256 = c_ssh2.LIBSSH2_HOSTKEY_HASH_SHA256 */ - __pyx_t_3 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_HOSTKEY_HASH_MD5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_HASH_MD5, __pyx_t_3) < 0) __PYX_ERR(1, 43, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_HOSTKEY_HASH_MD5); 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_MD5, __pyx_t_2) < 0) __PYX_ERR(1, 45, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ssh2/session.pyx":44 + /* "ssh2/session.pyx":46 * * LIBSSH2_HOSTKEY_HASH_MD5 = c_ssh2.LIBSSH2_HOSTKEY_HASH_MD5 * LIBSSH2_HOSTKEY_HASH_SHA1 = c_ssh2.LIBSSH2_HOSTKEY_HASH_SHA1 # <<<<<<<<<<<<<< * LIBSSH2_HOSTKEY_HASH_SHA256 = c_ssh2.LIBSSH2_HOSTKEY_HASH_SHA256 * LIBSSH2_HOSTKEY_TYPE_ECDSA_256 = c_ssh2.LIBSSH2_HOSTKEY_TYPE_ECDSA_256 */ - __pyx_t_3 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_HOSTKEY_HASH_SHA1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_HASH_SHA1, __pyx_t_3) < 0) __PYX_ERR(1, 44, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_HOSTKEY_HASH_SHA1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 46, __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(1, 46, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ssh2/session.pyx":45 + /* "ssh2/session.pyx":47 * LIBSSH2_HOSTKEY_HASH_MD5 = c_ssh2.LIBSSH2_HOSTKEY_HASH_MD5 * LIBSSH2_HOSTKEY_HASH_SHA1 = c_ssh2.LIBSSH2_HOSTKEY_HASH_SHA1 * LIBSSH2_HOSTKEY_HASH_SHA256 = c_ssh2.LIBSSH2_HOSTKEY_HASH_SHA256 # <<<<<<<<<<<<<< * 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_3 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_HOSTKEY_HASH_SHA256); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_HASH_SHA256, __pyx_t_3) < 0) __PYX_ERR(1, 45, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyInt_From___pyx_anon_enum(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(1, 47, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ssh2/session.pyx":46 + /* "ssh2/session.pyx":48 * LIBSSH2_HOSTKEY_HASH_SHA1 = c_ssh2.LIBSSH2_HOSTKEY_HASH_SHA1 * LIBSSH2_HOSTKEY_HASH_SHA256 = c_ssh2.LIBSSH2_HOSTKEY_HASH_SHA256 * LIBSSH2_HOSTKEY_TYPE_ECDSA_256 = c_ssh2.LIBSSH2_HOSTKEY_TYPE_ECDSA_256 # <<<<<<<<<<<<<< * 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_3 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_HOSTKEY_TYPE_ECDSA_256); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_TYPE_ECDSA_256, __pyx_t_3) < 0) __PYX_ERR(1, 46, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyInt_From___pyx_anon_enum(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(1, 48, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ssh2/session.pyx":47 + /* "ssh2/session.pyx":49 * LIBSSH2_HOSTKEY_HASH_SHA256 = c_ssh2.LIBSSH2_HOSTKEY_HASH_SHA256 * LIBSSH2_HOSTKEY_TYPE_ECDSA_256 = c_ssh2.LIBSSH2_HOSTKEY_TYPE_ECDSA_256 * LIBSSH2_HOSTKEY_TYPE_ECDSA_384 = c_ssh2.LIBSSH2_HOSTKEY_TYPE_ECDSA_384 # <<<<<<<<<<<<<< * LIBSSH2_HOSTKEY_TYPE_ECDSA_521 = c_ssh2.LIBSSH2_HOSTKEY_TYPE_ECDSA_521 * LIBSSH2_HOSTKEY_TYPE_ED25519 = c_ssh2.LIBSSH2_HOSTKEY_TYPE_ED25519 */ - __pyx_t_3 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_HOSTKEY_TYPE_ECDSA_384); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_TYPE_ECDSA_384, __pyx_t_3) < 0) __PYX_ERR(1, 47, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyInt_From___pyx_anon_enum(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(1, 49, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ssh2/session.pyx":48 + /* "ssh2/session.pyx":50 * LIBSSH2_HOSTKEY_TYPE_ECDSA_256 = c_ssh2.LIBSSH2_HOSTKEY_TYPE_ECDSA_256 * LIBSSH2_HOSTKEY_TYPE_ECDSA_384 = c_ssh2.LIBSSH2_HOSTKEY_TYPE_ECDSA_384 * LIBSSH2_HOSTKEY_TYPE_ECDSA_521 = c_ssh2.LIBSSH2_HOSTKEY_TYPE_ECDSA_521 # <<<<<<<<<<<<<< * LIBSSH2_HOSTKEY_TYPE_ED25519 = c_ssh2.LIBSSH2_HOSTKEY_TYPE_ED25519 * */ - __pyx_t_3 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_HOSTKEY_TYPE_ECDSA_521); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_TYPE_ECDSA_521, __pyx_t_3) < 0) __PYX_ERR(1, 48, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyInt_From___pyx_anon_enum(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(1, 50, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ssh2/session.pyx":49 + /* "ssh2/session.pyx":51 * LIBSSH2_HOSTKEY_TYPE_ECDSA_384 = c_ssh2.LIBSSH2_HOSTKEY_TYPE_ECDSA_384 * LIBSSH2_HOSTKEY_TYPE_ECDSA_521 = c_ssh2.LIBSSH2_HOSTKEY_TYPE_ECDSA_521 * LIBSSH2_HOSTKEY_TYPE_ED25519 = c_ssh2.LIBSSH2_HOSTKEY_TYPE_ED25519 # <<<<<<<<<<<<<< * * LIBSSH2_HOSTKEY_TYPE_UNKNOWN = c_ssh2.LIBSSH2_HOSTKEY_TYPE_UNKNOWN */ - __pyx_t_3 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_HOSTKEY_TYPE_ED25519); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_TYPE_ED25519, __pyx_t_3) < 0) __PYX_ERR(1, 49, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyInt_From___pyx_anon_enum(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(1, 51, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ssh2/session.pyx":51 + /* "ssh2/session.pyx":53 * LIBSSH2_HOSTKEY_TYPE_ED25519 = c_ssh2.LIBSSH2_HOSTKEY_TYPE_ED25519 * * LIBSSH2_HOSTKEY_TYPE_UNKNOWN = c_ssh2.LIBSSH2_HOSTKEY_TYPE_UNKNOWN # <<<<<<<<<<<<<< * LIBSSH2_HOSTKEY_TYPE_RSA = c_ssh2.LIBSSH2_HOSTKEY_TYPE_RSA * LIBSSH2_HOSTKEY_TYPE_DSS = c_ssh2.LIBSSH2_HOSTKEY_TYPE_DSS */ - __pyx_t_3 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_HOSTKEY_TYPE_UNKNOWN); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 51, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_TYPE_UNKNOWN, __pyx_t_3) < 0) __PYX_ERR(1, 51, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_HOSTKEY_TYPE_UNKNOWN); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 53, __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(1, 53, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ssh2/session.pyx":52 + /* "ssh2/session.pyx":54 * * LIBSSH2_HOSTKEY_TYPE_UNKNOWN = c_ssh2.LIBSSH2_HOSTKEY_TYPE_UNKNOWN * LIBSSH2_HOSTKEY_TYPE_RSA = c_ssh2.LIBSSH2_HOSTKEY_TYPE_RSA # <<<<<<<<<<<<<< * LIBSSH2_HOSTKEY_TYPE_DSS = c_ssh2.LIBSSH2_HOSTKEY_TYPE_DSS * */ - __pyx_t_3 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_HOSTKEY_TYPE_RSA); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 52, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_TYPE_RSA, __pyx_t_3) < 0) __PYX_ERR(1, 52, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_HOSTKEY_TYPE_RSA); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 54, __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(1, 54, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ssh2/session.pyx":53 + /* "ssh2/session.pyx":55 * LIBSSH2_HOSTKEY_TYPE_UNKNOWN = c_ssh2.LIBSSH2_HOSTKEY_TYPE_UNKNOWN * LIBSSH2_HOSTKEY_TYPE_RSA = c_ssh2.LIBSSH2_HOSTKEY_TYPE_RSA * LIBSSH2_HOSTKEY_TYPE_DSS = c_ssh2.LIBSSH2_HOSTKEY_TYPE_DSS # <<<<<<<<<<<<<< * * */ - __pyx_t_3 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_HOSTKEY_TYPE_DSS); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_HOSTKEY_TYPE_DSS, __pyx_t_3) < 0) __PYX_ERR(1, 53, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_HOSTKEY_TYPE_DSS); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 55, __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, 55, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_10MethodType_3__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_MethodType___reduce_cython, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__6)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_10MethodType_3__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_MethodType___reduce_cython, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__6)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "(tree fragment)":3 * def __reduce_cython__(self): @@ -18194,684 +18423,892 @@ if (!__Pyx_RefNanny) { * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_10MethodType_5__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_MethodType___setstate_cython, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__8)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_3) < 0) __PYX_ERR(0, 3, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_10MethodType_5__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_MethodType___setstate_cython, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__8)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ssh2/session.pyx":61 + /* "ssh2/session.pyx":63 * * * 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_3 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_METHOD_KEX); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 61, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_METHOD_KEX); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_KEX, __pyx_t_2) < 0) __PYX_ERR(1, 61, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 63, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_KEX, __pyx_t_3) < 0) __PYX_ERR(1, 63, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ssh2/session.pyx":62 + /* "ssh2/session.pyx":64 * * 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_2 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_METHOD_HOSTKEY); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 62, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_METHOD_HOSTKEY); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_HOSTKEY, __pyx_t_3) < 0) __PYX_ERR(1, 62, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_HOSTKEY, __pyx_t_2) < 0) __PYX_ERR(1, 64, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ssh2/session.pyx":63 + /* "ssh2/session.pyx":65 * 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_3 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_METHOD_CRYPT_CS); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 63, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 63, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_METHOD_CRYPT_CS); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_CRYPT_CS, __pyx_t_2) < 0) __PYX_ERR(1, 63, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_CRYPT_CS, __pyx_t_3) < 0) __PYX_ERR(1, 65, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ssh2/session.pyx":64 + /* "ssh2/session.pyx":66 * 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_2 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_METHOD_CRYPT_SC); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 64, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_METHOD_CRYPT_SC); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_CRYPT_SC, __pyx_t_3) < 0) __PYX_ERR(1, 64, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_CRYPT_SC, __pyx_t_2) < 0) __PYX_ERR(1, 66, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ssh2/session.pyx":65 + /* "ssh2/session.pyx":67 * 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_3 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_METHOD_MAC_CS); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 65, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_METHOD_MAC_CS); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_MAC_CS, __pyx_t_2) < 0) __PYX_ERR(1, 65, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_MAC_CS, __pyx_t_3) < 0) __PYX_ERR(1, 67, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ssh2/session.pyx":66 + /* "ssh2/session.pyx":68 * 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_2 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_METHOD_MAC_SC); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 66, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 66, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_METHOD_MAC_SC); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_MAC_SC, __pyx_t_3) < 0) __PYX_ERR(1, 66, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_MAC_SC, __pyx_t_2) < 0) __PYX_ERR(1, 68, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ssh2/session.pyx":67 + /* "ssh2/session.pyx":69 * 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_3 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_METHOD_COMP_CS); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 67, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_METHOD_COMP_CS); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_COMP_CS, __pyx_t_2) < 0) __PYX_ERR(1, 67, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 69, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_COMP_CS, __pyx_t_3) < 0) __PYX_ERR(1, 69, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ssh2/session.pyx":68 + /* "ssh2/session.pyx":70 * 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_2 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_METHOD_COMP_SC); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 68, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_METHOD_COMP_SC); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_COMP_SC, __pyx_t_3) < 0) __PYX_ERR(1, 68, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_COMP_SC, __pyx_t_2) < 0) __PYX_ERR(1, 70, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ssh2/session.pyx":69 + /* "ssh2/session.pyx":71 * 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_3 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_METHOD_LANG_CS); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 69, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_METHOD_LANG_CS); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_LANG_CS, __pyx_t_2) < 0) __PYX_ERR(1, 69, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 71, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_LANG_CS, __pyx_t_3) < 0) __PYX_ERR(1, 71, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ssh2/session.pyx":70 + /* "ssh2/session.pyx":72 * 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___pyx_anon_enum(LIBSSH2_METHOD_LANG_SC); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 70, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_METHOD_LANG_SC); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_LANG_SC, __pyx_t_3) < 0) __PYX_ERR(1, 70, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_7session_MethodType), __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBSSH2_METHOD_LANG_SC, __pyx_t_2) < 0) __PYX_ERR(1, 72, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ssh2/session.pyx":112 + /* "ssh2/session.pyx":114 * self._session = NULL * - * def disconnect(self): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: + * def disconnect(self) -> int: # <<<<<<<<<<<<<< + * """Disconnect session. + * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_5disconnect, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_disconnect, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__10)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 112, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 114, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_s_int) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_5disconnect, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_disconnect, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__10)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_disconnect, __pyx_t_3) < 0) __PYX_ERR(1, 112, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_disconnect, __pyx_t_3) < 0) __PYX_ERR(1, 114, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":118 + /* "ssh2/session.pyx":124 * return handle_error_codes(rc) * - * def handshake(self, sock not None): # <<<<<<<<<<<<<< + * def handshake(self, sock not None: BinaryIO) -> int: # <<<<<<<<<<<<<< * """Perform SSH handshake. * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_7handshake, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_handshake, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 118, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 124, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_handshake, __pyx_t_3) < 0) __PYX_ERR(1, 118, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_sock, __pyx_n_s_BinaryIO) < 0) __PYX_ERR(1, 124, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_s_int) < 0) __PYX_ERR(1, 124, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_7handshake, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_handshake, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 124, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_handshake, __pyx_t_2) < 0) __PYX_ERR(1, 124, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":130 + /* "ssh2/session.pyx":138 * return handle_error_codes(rc) * * def startup(self, sock): # <<<<<<<<<<<<<< * """Deprecated - use self.handshake""" * cdef int _sock = PyObject_AsFileDescriptor(sock) */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_9startup, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_startup, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_startup, __pyx_t_3) < 0) __PYX_ERR(1, 130, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_9startup, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_startup, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_startup, __pyx_t_2) < 0) __PYX_ERR(1, 138, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":136 + /* "ssh2/session.pyx":144 * return handle_error_codes(rc) * - * def set_blocking(self, bint blocking): # <<<<<<<<<<<<<< + * def set_blocking(self, bint blocking: bool) -> None: # <<<<<<<<<<<<<< * """Set session blocking mode on/off. * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_11set_blocking, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_set_blocking, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__15)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 136, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_blocking, __pyx_n_s_bool) < 0) __PYX_ERR(1, 144, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_s_None) < 0) __PYX_ERR(1, 144, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_11set_blocking, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_set_blocking, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__15)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 144, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_set_blocking, __pyx_t_3) < 0) __PYX_ERR(1, 136, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_set_blocking, __pyx_t_3) < 0) __PYX_ERR(1, 144, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":146 + /* "ssh2/session.pyx":154 * self._session, blocking) * - * def get_blocking(self): # <<<<<<<<<<<<<< + * def get_blocking(self) -> bool: # <<<<<<<<<<<<<< * """Get session blocking mode enabled True/False. * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_13get_blocking, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_get_blocking, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 146, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_get_blocking, __pyx_t_3) < 0) __PYX_ERR(1, 146, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_s_bool) < 0) __PYX_ERR(1, 154, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_13get_blocking, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_get_blocking, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_get_blocking, __pyx_t_2) < 0) __PYX_ERR(1, 154, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":155 + /* "ssh2/session.pyx":163 * return bool(rc) * - * def set_timeout(self, long timeout): # <<<<<<<<<<<<<< + * def set_timeout(self, long timeout) -> None: # <<<<<<<<<<<<<< * """Set the timeout in milliseconds for how long a blocking * call may wait until the situation is considered an error and */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_15set_timeout, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_set_timeout, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__18)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 155, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 163, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_s_None) < 0) __PYX_ERR(1, 163, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_15set_timeout, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_set_timeout, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__18)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 163, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_set_timeout, __pyx_t_3) < 0) __PYX_ERR(1, 155, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_set_timeout, __pyx_t_3) < 0) __PYX_ERR(1, 163, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":166 + /* "ssh2/session.pyx":174 * c_ssh2.libssh2_session_set_timeout(self._session, timeout) * - * def get_timeout(self): # <<<<<<<<<<<<<< - * """Get current session timeout setting""" - * cdef long timeout + * def get_timeout(self) -> int: # <<<<<<<<<<<<<< + * """Get current session timeout setting in milliseconds. + * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_17get_timeout, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_get_timeout, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 166, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_get_timeout, __pyx_t_3) < 0) __PYX_ERR(1, 166, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_s_int) < 0) __PYX_ERR(1, 174, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_17get_timeout, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_get_timeout, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 174, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_get_timeout, __pyx_t_2) < 0) __PYX_ERR(1, 174, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":173 + /* "ssh2/session.pyx":183 * return timeout * - * def userauth_authenticated(self): # <<<<<<<<<<<<<< + * def userauth_authenticated(self) -> bool: # <<<<<<<<<<<<<< * """True/False for is user authenticated or not. * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_19userauth_authenticated, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_userauth_authenticated, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 173, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_s_bool) < 0) __PYX_ERR(1, 183, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_19userauth_authenticated, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_userauth_authenticated, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_userauth_authenticated, __pyx_t_3) < 0) __PYX_ERR(1, 173, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_userauth_authenticated, __pyx_t_3) < 0) __PYX_ERR(1, 183, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":182 + /* "ssh2/session.pyx":192 * return bool(rc) * - * def userauth_list(self, username not None): # <<<<<<<<<<<<<< + * def userauth_list(self, username not None: AnyStr) -> List[str]: # <<<<<<<<<<<<<< * """Retrieve available authentication methodslist. * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_21userauth_list, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_userauth_list, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__22)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 182, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_userauth_list, __pyx_t_3) < 0) __PYX_ERR(1, 182, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_username, __pyx_n_s_AnyStr) < 0) __PYX_ERR(1, 192, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_kp_s_List_str) < 0) __PYX_ERR(1, 192, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_21userauth_list, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_userauth_list, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__22)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 192, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_userauth_list, __pyx_t_2) < 0) __PYX_ERR(1, 192, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":199 + /* "ssh2/session.pyx":209 * return auth.split(',') * - * def userauth_publickey_fromfile(self, username not None, # <<<<<<<<<<<<<< - * privatekey not None, - * passphrase='', + * def userauth_publickey_fromfile(self, username not None: AnyStr, # <<<<<<<<<<<<<< + * privatekey not None: AnyStr, + * passphrase: AnyStr='', */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_23userauth_publickey_fromfile, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_userauth_publickey_fromf, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 199, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 209, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_username, __pyx_n_s_AnyStr) < 0) __PYX_ERR(1, 209, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_privatekey, __pyx_n_s_AnyStr) < 0) __PYX_ERR(1, 209, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_passphrase, __pyx_n_s_AnyStr) < 0) __PYX_ERR(1, 209, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_publickey, __pyx_kp_s_AnyStr_None) < 0) __PYX_ERR(1, 209, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_s_int) < 0) __PYX_ERR(1, 209, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_23userauth_publickey_fromfile, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_userauth_publickey_fromf, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__25); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_userauth_publickey_fromfile, __pyx_t_3) < 0) __PYX_ERR(1, 199, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_userauth_publickey_fromfile, __pyx_t_3) < 0) __PYX_ERR(1, 209, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":223 + /* "ssh2/session.pyx":233 * return handle_error_codes(rc) * - * def userauth_publickey(self, username not None, # <<<<<<<<<<<<<< - * bytes pubkeydata not None): + * def userauth_publickey(self, username not None: AnyStr, # <<<<<<<<<<<<<< + * bytes pubkeydata not None) -> int: * """Perform public key authentication with provided public key data */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_25userauth_publickey, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_userauth_publickey, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 223, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 233, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_userauth_publickey, __pyx_t_3) < 0) __PYX_ERR(1, 223, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_username, __pyx_n_s_AnyStr) < 0) __PYX_ERR(1, 233, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_s_int) < 0) __PYX_ERR(1, 233, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_25userauth_publickey, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_userauth_publickey, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_userauth_publickey, __pyx_t_2) < 0) __PYX_ERR(1, 233, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":244 + /* "ssh2/session.pyx":254 * return handle_error_codes(rc) * * def userauth_hostbased_fromfile(self, # <<<<<<<<<<<<<< - * username not None, - * privatekey not None, + * username not None: AnyStr, + * privatekey not None: AnyStr, */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_27userauth_hostbased_fromfile, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_userauth_hostbased_fromf, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 244, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_username, __pyx_n_s_AnyStr) < 0) __PYX_ERR(1, 254, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_privatekey, __pyx_n_s_AnyStr) < 0) __PYX_ERR(1, 254, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_hostname, __pyx_n_s_AnyStr) < 0) __PYX_ERR(1, 254, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_publickey, __pyx_kp_s_AnyStr_None) < 0) __PYX_ERR(1, 254, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_passphrase, __pyx_n_s_str) < 0) __PYX_ERR(1, 254, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_s_int) < 0) __PYX_ERR(1, 254, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_27userauth_hostbased_fromfile, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_userauth_hostbased_fromf, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__30); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_userauth_hostbased_fromfile, __pyx_t_3) < 0) __PYX_ERR(1, 244, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_userauth_hostbased_fromfile, __pyx_t_3) < 0) __PYX_ERR(1, 254, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":270 + /* "ssh2/session.pyx":280 * return handle_error_codes(rc) * * def userauth_publickey_frommemory( # <<<<<<<<<<<<<< - * self, username, bytes privatekeyfiledata, - * passphrase='', bytes publickeyfiledata=None): + * self, username: AnyStr, bytes privatekeyfiledata, + * passphrase: str='', bytes publickeyfiledata: bytes | None=None) -> int: */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_29userauth_publickey_frommemory, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_userauth_publickey_fromm, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 270, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 280, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__25); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_userauth_publickey_frommemory, __pyx_t_3) < 0) __PYX_ERR(1, 270, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_username, __pyx_n_s_AnyStr) < 0) __PYX_ERR(1, 280, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_passphrase, __pyx_n_s_str) < 0) __PYX_ERR(1, 280, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_publickeyfiledata, __pyx_kp_s_bytes_None) < 0) __PYX_ERR(1, 280, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_s_int) < 0) __PYX_ERR(1, 280, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_29userauth_publickey_frommemory, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_userauth_publickey_fromm, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 280, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__25); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_userauth_publickey_frommemory, __pyx_t_2) < 0) __PYX_ERR(1, 280, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":294 + /* "ssh2/session.pyx":304 * return handle_error_codes(rc) * - * def userauth_password(self, username not None, password not None): # <<<<<<<<<<<<<< + * def userauth_password(self, username not None: AnyStr, password not None: AnyStr) -> int: # <<<<<<<<<<<<<< * """Perform password authentication * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_31userauth_password, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_userauth_password, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 294, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 304, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_username, __pyx_n_s_AnyStr) < 0) __PYX_ERR(1, 304, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_password, __pyx_n_s_AnyStr) < 0) __PYX_ERR(1, 304, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_s_int) < 0) __PYX_ERR(1, 304, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_31userauth_password, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_userauth_password, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 304, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_userauth_password, __pyx_t_3) < 0) __PYX_ERR(1, 294, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_userauth_password, __pyx_t_3) < 0) __PYX_ERR(1, 304, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":311 + /* "ssh2/session.pyx":321 * return handle_error_codes(rc) * - * def userauth_keyboardinteractive(self, username not None, # <<<<<<<<<<<<<< - * password not None): + * def userauth_keyboardinteractive(self, username not None: AnyStr, # <<<<<<<<<<<<<< + * password not None: AnyStr) -> int: * """Perform keyboard-interactive authentication */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_33userauth_keyboardinteractive, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_userauth_keyboardinterac, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 311, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 321, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_userauth_keyboardinteractive, __pyx_t_3) < 0) __PYX_ERR(1, 311, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_username, __pyx_n_s_AnyStr) < 0) __PYX_ERR(1, 321, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_password, __pyx_n_s_AnyStr) < 0) __PYX_ERR(1, 321, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_s_int) < 0) __PYX_ERR(1, 321, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_33userauth_keyboardinteractive, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_userauth_keyboardinterac, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_userauth_keyboardinteractive, __pyx_t_2) < 0) __PYX_ERR(1, 321, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":333 + /* "ssh2/session.pyx":343 * return handle_error_codes(rc) * - * def agent_init(self): # <<<<<<<<<<<<<< + * def agent_init(self) -> "Agent": # <<<<<<<<<<<<<< * """Initialise SSH agent. * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_35agent_init, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_agent_init, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 333, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 343, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_kp_s_Agent) < 0) __PYX_ERR(1, 343, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_35agent_init, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_agent_init, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 343, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_agent_init, __pyx_t_3) < 0) __PYX_ERR(1, 333, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_agent_init, __pyx_t_3) < 0) __PYX_ERR(1, 343, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":343 + /* "ssh2/session.pyx":353 * return PyAgent(agent, self) * - * def agent_auth(self, username not None): # <<<<<<<<<<<<<< + * def agent_auth(self, username not None: AnyStr) -> None: # <<<<<<<<<<<<<< * """Convenience function for performing user authentication via SSH Agent. * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_37agent_auth, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_agent_auth, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__40)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 343, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 353, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_agent_auth, __pyx_t_3) < 0) __PYX_ERR(1, 343, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_username, __pyx_n_s_AnyStr) < 0) __PYX_ERR(1, 353, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_s_None) < 0) __PYX_ERR(1, 353, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_37agent_auth, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_agent_auth, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__40)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_agent_auth, __pyx_t_2) < 0) __PYX_ERR(1, 353, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":378 + /* "ssh2/session.pyx":390 * agent_auth(_username, agent) * - * def open_session(self): # <<<<<<<<<<<<<< + * def open_session(self) -> "Channel" | None: # <<<<<<<<<<<<<< * """Open new channel session. * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_39open_session, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_open_session, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__42)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 378, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 390, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_kp_s_Channel_None) < 0) __PYX_ERR(1, 390, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_39open_session, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_open_session, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__42)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 390, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_open_session, __pyx_t_3) < 0) __PYX_ERR(1, 378, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_open_session, __pyx_t_3) < 0) __PYX_ERR(1, 390, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":392 + /* "ssh2/session.pyx":404 * return PyChannel(channel, self) * - * def direct_tcpip_ex(self, host not None, int port, # <<<<<<<<<<<<<< - * shost not None, int sport): - * cdef c_ssh2.LIBSSH2_CHANNEL *channel + * def direct_tcpip_ex(self, host not None: AnyStr, int port, # <<<<<<<<<<<<<< + * shost not None: AnyStr, int sport) -> "Channel" | None: + * """Open direct TCP/IP channel to host:port and open listening connection */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_41direct_tcpip_ex, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_direct_tcpip_ex, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__44)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 392, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 404, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_direct_tcpip_ex, __pyx_t_3) < 0) __PYX_ERR(1, 392, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_host, __pyx_n_s_AnyStr) < 0) __PYX_ERR(1, 404, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_shost, __pyx_n_s_AnyStr) < 0) __PYX_ERR(1, 404, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_kp_s_Channel_None) < 0) __PYX_ERR(1, 404, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_41direct_tcpip_ex, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_direct_tcpip_ex, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__44)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 404, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_direct_tcpip_ex, __pyx_t_2) < 0) __PYX_ERR(1, 404, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":407 + /* "ssh2/session.pyx":427 * return PyChannel(channel, self) * - * def direct_tcpip(self, host not None, int port): # <<<<<<<<<<<<<< + * def direct_tcpip(self, host not None: AnyStr, int port) -> "Channel" | None: # <<<<<<<<<<<<<< * """Open direct TCP/IP channel to host:port * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_43direct_tcpip, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_direct_tcpip, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__46)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 407, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 427, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_host, __pyx_n_s_AnyStr) < 0) __PYX_ERR(1, 427, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_kp_s_Channel_None) < 0) __PYX_ERR(1, 427, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_43direct_tcpip, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_direct_tcpip, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__46)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 427, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_direct_tcpip, __pyx_t_3) < 0) __PYX_ERR(1, 407, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_direct_tcpip, __pyx_t_3) < 0) __PYX_ERR(1, 427, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":424 + /* "ssh2/session.pyx":446 * return PyChannel(channel, self) * - * def block_directions(self): # <<<<<<<<<<<<<< + * def block_directions(self) -> int: # <<<<<<<<<<<<<< * """Get blocked directions for the current session. * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_45block_directions, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_block_directions, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__47)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 424, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_block_directions, __pyx_t_3) < 0) __PYX_ERR(1, 424, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_s_int) < 0) __PYX_ERR(1, 446, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_45block_directions, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_block_directions, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__47)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 446, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_block_directions, __pyx_t_2) < 0) __PYX_ERR(1, 446, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":451 + /* "ssh2/session.pyx":473 * return rc * - * def forward_listen(self, int port): # <<<<<<<<<<<<<< + * def forward_listen(self, int port) -> "Listener" | None: # <<<<<<<<<<<<<< * """Create forward listener on port. * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_47forward_listen, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_forward_listen, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__49)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 451, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 473, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_kp_s_Listener_None) < 0) __PYX_ERR(1, 473, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_47forward_listen, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_forward_listen, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__49)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 473, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_forward_listen, __pyx_t_3) < 0) __PYX_ERR(1, 451, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_forward_listen, __pyx_t_3) < 0) __PYX_ERR(1, 473, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":467 + /* "ssh2/session.pyx":489 * return PyListener(listener, self) * - * def forward_listen_ex(self, int queue_maxsize, host=None, int port=0): # <<<<<<<<<<<<<< + * def forward_listen_ex(self, int queue_maxsize, host: AnyStr | None=None, # <<<<<<<<<<<<<< + * int port=0) -> Tuple["Listener", int] | None: * """ - * Instruct the remote SSH server to begin listening for inbound */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_49forward_listen_ex, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_forward_listen_ex, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__51)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 467, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 489, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__52); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_forward_listen_ex, __pyx_t_3) < 0) __PYX_ERR(1, 467, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_host, __pyx_kp_s_AnyStr_None) < 0) __PYX_ERR(1, 489, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_kp_s_Tuple_Listener_int_None) < 0) __PYX_ERR(1, 489, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_49forward_listen_ex, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_forward_listen_ex, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__51)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 489, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__52); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_forward_listen_ex, __pyx_t_2) < 0) __PYX_ERR(1, 489, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":503 + /* "ssh2/session.pyx":526 * return (PyListener(listener, self), bound_port) * - * def sftp_init(self): # <<<<<<<<<<<<<< + * def sftp_init(self) -> "SFTP": # <<<<<<<<<<<<<< * """Initialise SFTP channel. * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_51sftp_init, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_sftp_init, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__54)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 503, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 526, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_kp_s_SFTP) < 0) __PYX_ERR(1, 526, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_51sftp_init, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_sftp_init, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__54)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 526, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_sftp_init, __pyx_t_3) < 0) __PYX_ERR(1, 503, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_sftp_init, __pyx_t_3) < 0) __PYX_ERR(1, 526, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":516 + /* "ssh2/session.pyx":539 * return PySFTP(_sftp, self) * * def last_error(self, size_t msg_size=1024): # <<<<<<<<<<<<<< * """Retrieve last error message from libssh2, if any. * Returns empty string on no error message. */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_53last_error, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_last_error, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__56)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 516, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_53last_error, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_last_error, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__56)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__57); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_last_error, __pyx_t_3) < 0) __PYX_ERR(1, 516, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_last_error, __pyx_t_3) < 0) __PYX_ERR(1, 539, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":536 + /* "ssh2/session.pyx":559 * free(_error_msg) * - * def last_errno(self): # <<<<<<<<<<<<<< + * def last_errno(self) -> int: # <<<<<<<<<<<<<< * """Retrieve last error number from libssh2, if any. * Returns 0 on no last error. */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_55last_errno, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_last_errno, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__58)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 536, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 559, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_last_errno, __pyx_t_3) < 0) __PYX_ERR(1, 536, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_s_int) < 0) __PYX_ERR(1, 559, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_55last_errno, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_last_errno, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__58)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 559, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_last_errno, __pyx_t_2) < 0) __PYX_ERR(1, 559, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":548 + /* "ssh2/session.pyx":571 * return rc * - * def set_last_error(self, int errcode, errmsg not None): # <<<<<<<<<<<<<< + * def set_last_error(self, int errcode, errmsg not None: AnyStr) -> int: # <<<<<<<<<<<<<< * cdef bytes b_errmsg = to_bytes(errmsg) * cdef char *_errmsg = b_errmsg */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_57set_last_error, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_set_last_error, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__60)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 548, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 571, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_errmsg, __pyx_n_s_AnyStr) < 0) __PYX_ERR(1, 571, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_s_int) < 0) __PYX_ERR(1, 571, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_57set_last_error, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_set_last_error, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__60)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 571, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_set_last_error, __pyx_t_3) < 0) __PYX_ERR(1, 548, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_set_last_error, __pyx_t_3) < 0) __PYX_ERR(1, 571, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":557 + /* "ssh2/session.pyx":580 * return rc * * def scp_recv(self, path not None): # <<<<<<<<<<<<<< * """Receive file via SCP. * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_59scp_recv, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_scp_recv, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__62)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 557, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_59scp_recv, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_scp_recv, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__62)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 580, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_scp_recv, __pyx_t_3) < 0) __PYX_ERR(1, 557, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_scp_recv, __pyx_t_3) < 0) __PYX_ERR(1, 580, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":579 + /* "ssh2/session.pyx":602 * return PyChannel(channel, self), statinfo * - * def scp_recv2(self, path not None): # <<<<<<<<<<<<<< + * def scp_recv2(self, path not None: AnyStr) -> Tuple["Channel", "FileInfo"] | None: # <<<<<<<<<<<<<< * """Receive file via SCP. * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_61scp_recv2, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_scp_recv2, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__64)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 579, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 602, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_scp_recv2, __pyx_t_3) < 0) __PYX_ERR(1, 579, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_path, __pyx_n_s_AnyStr) < 0) __PYX_ERR(1, 602, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_kp_s_Tuple_Channel_FileInfo_None) < 0) __PYX_ERR(1, 602, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_61scp_recv2, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_scp_recv2, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__64)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 602, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_scp_recv2, __pyx_t_2) < 0) __PYX_ERR(1, 602, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":599 + /* "ssh2/session.pyx":622 * return PyChannel(channel, self), fileinfo * * def scp_send(self, path not None, int mode, size_t size): # <<<<<<<<<<<<<< * """Deprecated in favour of scp_send64. Send file via SCP. * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_63scp_send, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_scp_send, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__66)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 599, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_scp_send, __pyx_t_3) < 0) __PYX_ERR(1, 599, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_63scp_send, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_scp_send, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__66)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_scp_send, __pyx_t_2) < 0) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":621 + /* "ssh2/session.pyx":644 * return PyChannel(channel, self) * - * def scp_send64(self, path not None, int mode, c_ssh2.libssh2_uint64_t size, # <<<<<<<<<<<<<< - * time_t mtime, time_t atime): + * def scp_send64(self, path not None: AnyStr, int mode, c_ssh2.libssh2_uint64_t size, # <<<<<<<<<<<<<< + * time_t mtime, time_t atime) -> "Channel": * """Send file via SCP. */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_65scp_send64, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_scp_send64, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__68)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 621, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 644, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_path, __pyx_n_s_AnyStr) < 0) __PYX_ERR(1, 644, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_kp_s_Channel) < 0) __PYX_ERR(1, 644, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_65scp_send64, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_scp_send64, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__68)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 644, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_scp_send64, __pyx_t_3) < 0) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_scp_send64, __pyx_t_3) < 0) __PYX_ERR(1, 644, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":644 + /* "ssh2/session.pyx":667 * return PyChannel(channel, self) * - * def publickey_init(self): # <<<<<<<<<<<<<< + * def publickey_init(self) -> "PublicKeySystem": # <<<<<<<<<<<<<< * """Initialise public key subsystem for managing remote server * public keys""" */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_67publickey_init, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_publickey_init, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__70)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 644, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 667, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_publickey_init, __pyx_t_3) < 0) __PYX_ERR(1, 644, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_kp_s_PublicKeySystem) < 0) __PYX_ERR(1, 667, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_67publickey_init, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_publickey_init, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__70)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_publickey_init, __pyx_t_2) < 0) __PYX_ERR(1, 667, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":654 + /* "ssh2/session.pyx":677 * return PyPublicKeySystem(_pkey, self) * - * def hostkey_hash(self, int hash_type): # <<<<<<<<<<<<<< + * def hostkey_hash(self, int hash_type) -> bytes: # <<<<<<<<<<<<<< * """Get computed digest of the remote system's host key. * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_69hostkey_hash, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_hostkey_hash, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__72)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 654, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_s_bytes) < 0) __PYX_ERR(1, 677, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_69hostkey_hash, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_hostkey_hash, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__72)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 677, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_hostkey_hash, __pyx_t_3) < 0) __PYX_ERR(1, 654, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_hostkey_hash, __pyx_t_3) < 0) __PYX_ERR(1, 677, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":671 + /* "ssh2/session.pyx":694 * return b_hash * - * def hostkey(self): # <<<<<<<<<<<<<< + * def hostkey(self) -> Tuple[bytes, int]: # <<<<<<<<<<<<<< * """Get server host key for this session. * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_71hostkey, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_hostkey, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__74)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 671, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 694, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_hostkey, __pyx_t_3) < 0) __PYX_ERR(1, 671, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_kp_s_Tuple_bytes_int) < 0) __PYX_ERR(1, 694, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_71hostkey, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_hostkey, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__74)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 694, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_hostkey, __pyx_t_2) < 0) __PYX_ERR(1, 694, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":693 + /* "ssh2/session.pyx":716 * return key, key_type * - * def knownhost_init(self): # <<<<<<<<<<<<<< + * def knownhost_init(self) -> "KnownHost": # <<<<<<<<<<<<<< * """Initialise a collection of known hosts for this session. * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_73knownhost_init, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_knownhost_init, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__76)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 693, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 716, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_kp_s_KnownHost) < 0) __PYX_ERR(1, 716, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_73knownhost_init, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_knownhost_init, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__76)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 716, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_knownhost_init, __pyx_t_3) < 0) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_knownhost_init, __pyx_t_3) < 0) __PYX_ERR(1, 716, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":705 + /* "ssh2/session.pyx":728 * return PyKnownHost(self, known_hosts) * - * def keepalive_config(self, bint want_reply, unsigned interval): # <<<<<<<<<<<<<< + * def keepalive_config(self, bint want_reply, unsigned interval) -> None: # <<<<<<<<<<<<<< * """ * Configure keep alive settings. */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_75keepalive_config, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_keepalive_config, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__78)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 705, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 728, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_keepalive_config, __pyx_t_3) < 0) __PYX_ERR(1, 705, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_s_None) < 0) __PYX_ERR(1, 728, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_75keepalive_config, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_keepalive_config, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__78)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 728, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_keepalive_config, __pyx_t_2) < 0) __PYX_ERR(1, 728, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":718 + /* "ssh2/session.pyx":741 * c_ssh2.libssh2_keepalive_config(self._session, want_reply, interval) * - * def keepalive_send(self): # <<<<<<<<<<<<<< + * def keepalive_send(self) -> int: # <<<<<<<<<<<<<< * """Send keepalive. * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_77keepalive_send, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_keepalive_send, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__80)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 718, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 741, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_s_int) < 0) __PYX_ERR(1, 741, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_77keepalive_send, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_keepalive_send, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__80)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 741, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_keepalive_send, __pyx_t_3) < 0) __PYX_ERR(1, 718, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_keepalive_send, __pyx_t_3) < 0) __PYX_ERR(1, 741, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":732 + /* "ssh2/session.pyx":755 * return c_seconds * - * def supported_algs(self, MethodType method_type): # <<<<<<<<<<<<<< + * def supported_algs(self, MethodType method_type) -> List[str]: # <<<<<<<<<<<<<< * """Get supportd algorithms for method type. * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_79supported_algs, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_supported_algs, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__82)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 732, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 755, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_supported_algs, __pyx_t_3) < 0) __PYX_ERR(1, 732, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_kp_s_List_str) < 0) __PYX_ERR(1, 755, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_79supported_algs, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_supported_algs, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__82)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 755, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_supported_algs, __pyx_t_2) < 0) __PYX_ERR(1, 755, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":757 + /* "ssh2/session.pyx":780 * return algs * - * def methods(self, MethodType method_type): # <<<<<<<<<<<<<< + * def methods(self, MethodType method_type) -> str: # <<<<<<<<<<<<<< * """Get currently active algorithms for method type. * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_81methods, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_methods, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__84)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 757, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_s_str) < 0) __PYX_ERR(1, 780, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_81methods, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_methods, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__84)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 780, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_methods, __pyx_t_3) < 0) __PYX_ERR(1, 757, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_methods, __pyx_t_3) < 0) __PYX_ERR(1, 780, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); - /* "ssh2/session.pyx":772 + /* "ssh2/session.pyx":795 * return to_str(methods) * - * def method_pref(self, MethodType method_type, prefs not None): # <<<<<<<<<<<<<< + * def method_pref(self, MethodType method_type, prefs not None) -> int: # <<<<<<<<<<<<<< * """Set preference for session method. * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_83method_pref, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_method_pref, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__86)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 772, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 795, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_method_pref, __pyx_t_3) < 0) __PYX_ERR(1, 772, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_s_int) < 0) __PYX_ERR(1, 795, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_83method_pref, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session_method_pref, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__86)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 795, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_7session_Session, __pyx_n_s_method_pref, __pyx_t_2) < 0) __PYX_ERR(1, 795, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_7session_Session); /* "(tree fragment)":1 @@ -18879,10 +19316,10 @@ if (!__Pyx_RefNanny) { * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_85__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session___reduce_cython, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__87)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_85__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session___reduce_cython, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__87)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "(tree fragment)":3 * def __reduce_cython__(self): @@ -18890,20 +19327,20 @@ if (!__Pyx_RefNanny) { * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_87__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session___setstate_cython, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__88)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_3) < 0) __PYX_ERR(0, 3, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_7session_7Session_87__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Session___setstate_cython, NULL, __pyx_n_s_ssh2_session, __pyx_d, ((PyObject *)__pyx_codeobj__88)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "ssh2/session.pyx":1 * # This file is part of ssh2-python. # <<<<<<<<<<<<<< * # Copyright (C) 2017-2020 Panos Kittenis * # */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __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(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /*--- Wrapped vars code ---*/ @@ -22096,10 +22533,10 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { #endif /* TypeImport */ -#ifndef __PYX_HAVE_RT_ImportType_3_0_11 -#define __PYX_HAVE_RT_ImportType_3_0_11 -static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *module_name, const char *class_name, - size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size) +#ifndef __PYX_HAVE_RT_ImportType_3_0_12 +#define __PYX_HAVE_RT_ImportType_3_0_12 +static PyTypeObject *__Pyx_ImportType_3_0_12(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_12 check_size) { PyObject *result = 0; char warning[200]; @@ -22153,7 +22590,7 @@ static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *modul module_name, class_name, size, basicsize+itemsize); goto bad; } - if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_11 && + if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_12 && ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " @@ -22161,7 +22598,7 @@ static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *modul module_name, class_name, size, basicsize, basicsize+itemsize); goto bad; } - else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_11 && (size_t)basicsize > size) { + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_12 && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", @@ -22405,7 +22842,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { #include "compile.h" #include "frameobject.h" #include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif @@ -24610,9 +25047,9 @@ static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt } /* FunctionImport */ -#ifndef __PYX_HAVE_RT_ImportFunction_3_0_11 -#define __PYX_HAVE_RT_ImportFunction_3_0_11 -static int __Pyx_ImportFunction_3_0_11(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { +#ifndef __PYX_HAVE_RT_ImportFunction_3_0_12 +#define __PYX_HAVE_RT_ImportFunction_3_0_12 +static int __Pyx_ImportFunction_3_0_12(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { PyObject *d = 0; PyObject *cobj = 0; union { diff --git a/ssh2/session.pyi b/ssh2/session.pyi new file mode 100644 index 00000000..93a5a504 --- /dev/null +++ b/ssh2/session.pyi @@ -0,0 +1,106 @@ +# This file is part of ssh2-python. +# Copyright (C) 2017-2025 Panos Kittenis +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation, version 2.1. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +from typing import AnyStr, BinaryIO, Final, List, Tuple + +from .agent import Agent +from .channel import Channel +from .fileinfo import FileInfo +from .sftp import SFTP +from .knownhost import KnownHost +from .publickey import PublicKeySystem +from .listener import Listener + + +LIBSSH2_SESSION_BLOCK_INBOUND: int +LIBSSH2_SESSION_BLOCK_OUTBOUND: int + +LIBSSH2_HOSTKEY_HASH_MD5: int +LIBSSH2_HOSTKEY_HASH_SHA1: int +LIBSSH2_HOSTKEY_HASH_SHA256: int +LIBSSH2_HOSTKEY_TYPE_ECDSA_256: int +LIBSSH2_HOSTKEY_TYPE_ECDSA_384: int +LIBSSH2_HOSTKEY_TYPE_ECDSA_521: int +LIBSSH2_HOSTKEY_TYPE_ED25519: int + +LIBSSH2_HOSTKEY_TYPE_UNKNOWN: int +LIBSSH2_HOSTKEY_TYPE_RSA: int +LIBSSH2_HOSTKEY_TYPE_DSS: int + + +class MethodType: + value: int + + +LIBSSH2_METHOD_KEX: MethodType +LIBSSH2_METHOD_HOSTKEY: MethodType +LIBSSH2_METHOD_CRYPT_CS: MethodType +LIBSSH2_METHOD_CRYPT_SC: MethodType +LIBSSH2_METHOD_MAC_CS: MethodType +LIBSSH2_METHOD_MAC_SC: MethodType +LIBSSH2_METHOD_COMP_CS: MethodType +LIBSSH2_METHOD_COMP_SC: MethodType +LIBSSH2_METHOD_LANG_CS: MethodType +LIBSSH2_METHOD_LANG_SC: MethodType + + +class Session: + def disconnect(self) -> int: ... + def handshake(self, sock: BinaryIO) -> int: ... + def startup(self, sock): ... + def set_blocking(self, blocking: bool) -> None: ... + def get_blocking(self) -> bool: ... + def set_timeout(self, timeout: int) -> None: ... + def get_timeout(self) -> int: ... + def userauth_authenticated(self) -> bool: ... + def userauth_list(self, username: AnyStr) -> List[str]: ... + def userauth_publickey_fromfile(self, username: AnyStr, privatekey: AnyStr, + passphrase: str=u'', publickey: AnyStr | None=None) -> int: ... + def userauth_publickey(self, username: AnyStr, pubkeydata: bytes) -> int: ... + def userauth_hostbased_fromfile(self, username: AnyStr, privatekey: AnyStr, hostname: AnyStr, + publickey: AnyStr | None=None, passphrase: str=u'') -> int: ... + def userauth_publickey_frommemory(self, username: AnyStr, privatekeyfiledata: bytes, passphrase: str=u'', + publickeyfiledata: bytes | None = None) -> int: ... + def userauth_password(self, username: AnyStr, password: AnyStr) -> int: ... + def userauth_keyboardinteractive(self, username: AnyStr, password: AnyStr) -> int: ... + def agent_init(self) -> Agent: ... + def agent_auth(self, username: AnyStr) -> None: ... + def open_session(self) -> Channel | None: ... + def direct_tcpip_ex(self, host: AnyStr, port: int, shost: AnyStr, sport: int) -> Channel | None: ... + def direct_tcpip(self, host: AnyStr, port: int) -> Channel | None: ... + def block_directions(self) -> int: ... + def forward_listen(self, port: int) -> "Listener" | None: ... + def forward_listen_ex(self, queue_maxsize: int, host: AnyStr | None=None, + port: int = 0) -> Tuple[Listener, int] | None: ... + def sftp_init(self) -> SFTP: ... + def last_error(self, msg_size: int = 1024): ... + def last_errno(self): ... + def set_last_error(self, errcode: int, errmsg: AnyStr) -> int: ... + def scp_recv(self, path): ... + def scp_recv2(self, path) -> Tuple[Channel, FileInfo] | None: ... + def scp_send(self, path, mode: int, size: int): ... + def scp_send64(self, path: AnyStr, mode: int, size: int, mtime: int, atime: int) -> Channel: ... + def publickey_init(self) -> PublicKeySystem: ... + def hostkey_hash(self, hash_type: int) -> bytes: ... + def hostkey(self) -> Tuple[bytes, int]: ... + def knownhost_init(self) -> KnownHost: ... + def keepalive_config(self, want_reply: bool, interval: int) -> None: ... + def keepalive_send(self) -> int: ... + def supported_algs(self, method_type: MethodType) -> List[str]: ... + def methods(self, method_type: MethodType) -> str: ... + def method_pref(self, method_type: MethodType, prefs) -> int: ... + + sock: Final[BinaryIO] = ... diff --git a/ssh2/session.pyx b/ssh2/session.pyx index 9030ec5f..8e2a3747 100644 --- a/ssh2/session.pyx +++ b/ssh2/session.pyx @@ -14,6 +14,8 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +from typing import Any, AnyStr, List, Tuple, BinaryIO + from cpython cimport PyObject_AsFileDescriptor from libc.stdlib cimport malloc, free from libc.time cimport time_t @@ -109,16 +111,22 @@ cdef class Session: c_ssh2.libssh2_session_free(self._session) self._session = NULL - def disconnect(self): + def disconnect(self) -> int: + """Disconnect session. + + :rtype: int + """ cdef int rc with nogil: rc = c_ssh2.libssh2_session_disconnect(self._session, b"end") return handle_error_codes(rc) - def handshake(self, sock not None): + def handshake(self, sock not None: BinaryIO) -> int: """Perform SSH handshake. - Must be called after Session initialisation.""" + Must be called after Session initialisation. + :param sock: A python compatible socket object. + """ cdef int _sock = PyObject_AsFileDescriptor(sock) cdef int rc with nogil: @@ -133,7 +141,7 @@ cdef class Session: cdef int rc = c_ssh2.libssh2_session_startup(self._session, _sock) return handle_error_codes(rc) - def set_blocking(self, bint blocking): + def set_blocking(self, bint blocking: bool) -> None: """Set session blocking mode on/off. :param blocking: ``False`` for non-blocking, ``True`` for blocking. @@ -143,7 +151,7 @@ cdef class Session: c_ssh2.libssh2_session_set_blocking( self._session, blocking) - def get_blocking(self): + def get_blocking(self) -> bool: """Get session blocking mode enabled True/False. :rtype: bool""" @@ -152,7 +160,7 @@ cdef class Session: rc = c_ssh2.libssh2_session_get_blocking(self._session) return bool(rc) - def set_timeout(self, long timeout): + def set_timeout(self, long timeout) -> None: """Set the timeout in milliseconds for how long a blocking call may wait until the situation is considered an error and :py:class:`ssh2.error_codes.LIBSSH2_ERROR_TIMEOUT` is returned. @@ -163,14 +171,16 @@ cdef class Session: with nogil: c_ssh2.libssh2_session_set_timeout(self._session, timeout) - def get_timeout(self): - """Get current session timeout setting""" + def get_timeout(self) -> int: + """Get current session timeout setting in milliseconds. + + :rtype: int""" cdef long timeout with nogil: timeout = c_ssh2.libssh2_session_get_timeout(self._session) return timeout - def userauth_authenticated(self): + def userauth_authenticated(self) -> bool: """True/False for is user authenticated or not. :rtype: bool""" @@ -179,7 +189,7 @@ cdef class Session: rc = c_ssh2.libssh2_userauth_authenticated(self._session) return bool(rc) - def userauth_list(self, username not None): + def userauth_list(self, username not None: AnyStr) -> List[str]: """Retrieve available authentication methodslist. :rtype: list""" @@ -196,10 +206,10 @@ cdef class Session: auth = to_str(_auth) return auth.split(',') - def userauth_publickey_fromfile(self, username not None, - privatekey not None, - passphrase='', - publickey=None): + def userauth_publickey_fromfile(self, username not None: AnyStr, + privatekey not None: AnyStr, + passphrase: AnyStr='', + publickey: AnyStr | None=None) -> int: """Authenticate with public key from file. :rtype: int""" @@ -220,8 +230,8 @@ cdef class Session: self._session, _username, _publickey, _privatekey, _passphrase) return handle_error_codes(rc) - def userauth_publickey(self, username not None, - bytes pubkeydata not None): + def userauth_publickey(self, username not None: AnyStr, + bytes pubkeydata not None) -> int: """Perform public key authentication with provided public key data :param username: User name to authenticate as @@ -242,11 +252,11 @@ cdef class Session: return handle_error_codes(rc) def userauth_hostbased_fromfile(self, - username not None, - privatekey not None, - hostname not None, - publickey=None, - passphrase=''): + username not None: AnyStr, + privatekey not None: AnyStr, + hostname not None: AnyStr, + publickey: AnyStr | None=None, + passphrase: str='') -> int: cdef int rc cdef bytes b_username = to_bytes(username) cdef bytes b_publickey = to_bytes(publickey) \ @@ -268,8 +278,8 @@ cdef class Session: return handle_error_codes(rc) def userauth_publickey_frommemory( - self, username, bytes privatekeyfiledata, - passphrase='', bytes publickeyfiledata=None): + self, username: AnyStr, bytes privatekeyfiledata, + passphrase: str='', bytes publickeyfiledata: bytes | None=None) -> int: cdef int rc cdef bytes b_username = to_bytes(username) cdef bytes b_passphrase = to_bytes(passphrase) @@ -291,7 +301,7 @@ cdef class Session: privatekeydata_len, _passphrase) return handle_error_codes(rc) - def userauth_password(self, username not None, password not None): + def userauth_password(self, username not None: AnyStr, password not None: AnyStr) -> int: """Perform password authentication :param username: User name to authenticate. @@ -308,8 +318,8 @@ cdef class Session: self._session, _username, _password) return handle_error_codes(rc) - def userauth_keyboardinteractive(self, username not None, - password not None): + def userauth_keyboardinteractive(self, username not None: AnyStr, + password not None: AnyStr) -> int: """Perform keyboard-interactive authentication :param username: User name to authenticate. @@ -330,7 +340,7 @@ cdef class Session: self._kbd_callback = None return handle_error_codes(rc) - def agent_init(self): + def agent_init(self) -> "Agent": """Initialise SSH agent. :rtype: :py:class:`ssh2.agent.Agent` @@ -340,11 +350,11 @@ cdef class Session: agent = agent_init(self._session) return PyAgent(agent, self) - def agent_auth(self, username not None): + def agent_auth(self, username not None: AnyStr) -> None: """Convenience function for performing user authentication via SSH Agent. Initialises, connects to, gets list of identities from and attempts - authentication with each identity from SSH agent. + authentication with each identity from SSH agent in order. Note that agent connections cannot be used in non-blocking mode - clients should call `set_blocking(0)` *after* calling this function. @@ -355,6 +365,8 @@ cdef class Session: better than calling the individual Agent class functions from Python. + :param username: The username to connect to agent as. + :raises: :py:class:`MemoryError` on error initialising agent :raises: :py:class:`ssh2.exceptions.AgentConnectionError` on error connecting to agent @@ -375,7 +387,7 @@ cdef class Session: with nogil: agent_auth(_username, agent) - def open_session(self): + def open_session(self) -> "Channel" | None: """Open new channel session. :rtype: :py:class:`ssh2.channel.Channel` @@ -389,8 +401,16 @@ cdef class Session: self._session)) return PyChannel(channel, self) - def direct_tcpip_ex(self, host not None, int port, - shost not None, int sport): + def direct_tcpip_ex(self, host not None: AnyStr, int port, + shost not None: AnyStr, int sport) -> "Channel" | None: + """Open direct TCP/IP channel to host:port and open listening connection + on shost:sport on the source host, meaning client side. + + Resulting connection is therefor shost:sport -> host:port. + + :rtype: :py:class:`ssh2.channel.Channel` or None + """ + cdef c_ssh2.LIBSSH2_CHANNEL *channel cdef bytes b_host = to_bytes(host) cdef bytes b_shost = to_bytes(shost) @@ -404,11 +424,13 @@ cdef class Session: self._session)) return PyChannel(channel, self) - def direct_tcpip(self, host not None, int port): + def direct_tcpip(self, host not None: AnyStr, int port) -> "Channel" | None: """Open direct TCP/IP channel to host:port Channel will be listening on an available open port on client side - as assigned by OS. + as assigned by OS, if available. + + :rtype: :py:class:`ssh2.channel.Channel or None """ cdef c_ssh2.LIBSSH2_CHANNEL *channel cdef bytes b_host = to_bytes(host) @@ -421,7 +443,7 @@ cdef class Session: self._session)) return PyChannel(channel, self) - def block_directions(self): + def block_directions(self) -> int: """Get blocked directions for the current session. From libssh2 documentation: @@ -436,7 +458,7 @@ cdef class Session: Application should wait for data to be available for socket prior to calling a libssh2 function again. If ``LIBSSH2_SESSION_BLOCK_INBOUND`` - is set select should contain the session socket in readfds set. + is set select/poll should contain the session socket in readfds set. Correspondingly in case of ``LIBSSH2_SESSION_BLOCK_OUTBOUND`` writefds set should contain the socket. @@ -448,7 +470,7 @@ cdef class Session: self._session) return rc - def forward_listen(self, int port): + def forward_listen(self, int port) -> "Listener" | None: """Create forward listener on port. :param port: Port to listen on. @@ -464,7 +486,8 @@ cdef class Session: self._session)) return PyListener(listener, self) - def forward_listen_ex(self, int queue_maxsize, host=None, int port=0): + def forward_listen_ex(self, int queue_maxsize, host: AnyStr | None=None, + int port=0) -> Tuple["Listener", int] | None: """ Instruct the remote SSH server to begin listening for inbound TCP/IP connections. New connections will be queued by the library @@ -484,7 +507,7 @@ cdef class Session: :returns: (listener, bound_port) tuple where bound_port is the listen port bound on the remote host. Useful when requesting dynamic port numbers. - :rtype: (:py:class:`ssh2.listener.Listener`, int) + :rtype: (:py:class:`ssh2.listener.Listener`, int) or None """ cdef c_ssh2.LIBSSH2_LISTENER *listener cdef bytes b_host = None if host is None else to_bytes(host) @@ -500,7 +523,7 @@ cdef class Session: self._session)), 0) return (PyListener(listener, self), bound_port) - def sftp_init(self): + def sftp_init(self) -> "SFTP": """Initialise SFTP channel. :rtype: :py:class:`ssh2.sftp.SFTP` @@ -533,7 +556,7 @@ cdef class Session: finally: free(_error_msg) - def last_errno(self): + def last_errno(self) -> int: """Retrieve last error number from libssh2, if any. Returns 0 on no last error. @@ -545,7 +568,7 @@ cdef class Session: self._session) return rc - def set_last_error(self, int errcode, errmsg not None): + def set_last_error(self, int errcode, errmsg not None: AnyStr) -> int: cdef bytes b_errmsg = to_bytes(errmsg) cdef char *_errmsg = b_errmsg cdef int rc @@ -576,7 +599,7 @@ cdef class Session: self._session)) return PyChannel(channel, self), statinfo - def scp_recv2(self, path not None): + def scp_recv2(self, path not None: AnyStr) -> Tuple["Channel", "FileInfo"] | None: """Receive file via SCP. :param path: File path to receive. @@ -618,8 +641,8 @@ cdef class Session: self._session)) return PyChannel(channel, self) - def scp_send64(self, path not None, int mode, c_ssh2.libssh2_uint64_t size, - time_t mtime, time_t atime): + def scp_send64(self, path not None: AnyStr, int mode, c_ssh2.libssh2_uint64_t size, + time_t mtime, time_t atime) -> "Channel": """Send file via SCP. :param path: Local file path to send. @@ -641,7 +664,7 @@ cdef class Session: self._session)) return PyChannel(channel, self) - def publickey_init(self): + def publickey_init(self) -> "PublicKeySystem": """Initialise public key subsystem for managing remote server public keys""" cdef c_pkey.LIBSSH2_PUBLICKEY *_pkey @@ -651,7 +674,7 @@ cdef class Session: raise PublicKeyInitError return PyPublicKeySystem(_pkey, self) - def hostkey_hash(self, int hash_type): + def hostkey_hash(self, int hash_type) -> bytes: """Get computed digest of the remote system's host key. :param hash_type: One of ``ssh2.session.LIBSSH2_HOSTKEY_HASH_MD5`` or @@ -668,7 +691,7 @@ cdef class Session: b_hash = _hash return b_hash - def hostkey(self): + def hostkey(self) -> Tuple[bytes, int]: """Get server host key for this session. Returns key, key_type tuple where key_type is one of @@ -690,7 +713,7 @@ cdef class Session: key = _key[:key_len] return key, key_type - def knownhost_init(self): + def knownhost_init(self) -> "KnownHost": """Initialise a collection of known hosts for this session. :rtype: :py:class:`ssh2.knownhost.KnownHost`""" @@ -702,7 +725,7 @@ cdef class Session: raise KnownHostError return PyKnownHost(self, known_hosts) - def keepalive_config(self, bint want_reply, unsigned interval): + def keepalive_config(self, bint want_reply, unsigned interval) -> None: """ Configure keep alive settings. @@ -715,7 +738,7 @@ cdef class Session: with nogil: c_ssh2.libssh2_keepalive_config(self._session, want_reply, interval) - def keepalive_send(self): + def keepalive_send(self) -> int: """Send keepalive. Returns seconds remaining before next keep alive should be sent. @@ -729,7 +752,7 @@ cdef class Session: handle_error_codes(rc) return c_seconds - def supported_algs(self, MethodType method_type): + def supported_algs(self, MethodType method_type) -> List[str]: """Get supportd algorithms for method type. :param method_type: Type of method to get @@ -754,7 +777,7 @@ cdef class Session: c_ssh2.libssh2_free(self._session, c_algs) return algs - def methods(self, MethodType method_type): + def methods(self, MethodType method_type) -> str: """Get currently active algorithms for method type. :param method_type: Type of method to get @@ -769,7 +792,7 @@ cdef class Session: self._session, method_type.value) return to_str(methods) - def method_pref(self, MethodType method_type, prefs not None): + def method_pref(self, MethodType method_type, prefs not None) -> int: """Set preference for session method. See :py:func:`Session.supported_algs` for supported algorithms diff --git a/ssh2/sftp.c b/ssh2/sftp.c index 9a6bb885..357b8fd0 100644 --- a/ssh2/sftp.c +++ b/ssh2/sftp.c @@ -1,4 +1,4 @@ -/* Generated by Cython 3.0.11 */ +/* Generated by Cython 3.0.12 */ /* BEGIN: Cython Metadata { @@ -55,10 +55,10 @@ END: Cython Metadata */ #else #define __PYX_EXTRA_ABI_MODULE_NAME "" #endif -#define CYTHON_ABI "3_0_11" __PYX_EXTRA_ABI_MODULE_NAME +#define CYTHON_ABI "3_0_12" __PYX_EXTRA_ABI_MODULE_NAME #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." -#define CYTHON_HEX_VERSION 0x03000BF0 +#define CYTHON_HEX_VERSION 0x03000CF0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -1537,6 +1537,18 @@ struct __pyx_obj_4ssh2_11sftp_handle_SFTPHandle; struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes; struct __pyx_obj_4ssh2_11sftp_handle_SFTPStatVFS; struct __pyx_obj_4ssh2_4sftp_SFTP; +struct __pyx_ctuple_int__and_int; +typedef struct __pyx_ctuple_int__and_int __pyx_ctuple_int__and_int; + +/* "utils.pxd":24 + * cdef object to_str_len(char *c_str, int length) + * cpdef int handle_error_codes(int errcode) except -1 + * cpdef (int, int) find_eol(bytes buf: bytes, Py_ssize_t pos: Py_ssize_t) # <<<<<<<<<<<<<< + */ +struct __pyx_ctuple_int__and_int { + int f0; + int f1; +}; /* "session.pxd":19 * from . cimport c_ssh2 @@ -1879,7 +1891,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #if !CYTHON_VECTORCALL #if PY_VERSION_HEX >= 0x03080000 #include "frameobject.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif @@ -2004,22 +2016,22 @@ static int __Pyx_setup_reduce(PyObject* type_obj); #endif /* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_11 -#define __PYX_HAVE_RT_ImportType_proto_3_0_11 +#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_12 +#define __PYX_HAVE_RT_ImportType_proto_3_0_12 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #include #endif #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L -#define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) alignof(s) +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_12(s) alignof(s) #else -#define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) sizeof(void*) +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_12(s) sizeof(void*) #endif -enum __Pyx_ImportType_CheckSize_3_0_11 { - __Pyx_ImportType_CheckSize_Error_3_0_11 = 0, - __Pyx_ImportType_CheckSize_Warn_3_0_11 = 1, - __Pyx_ImportType_CheckSize_Ignore_3_0_11 = 2 +enum __Pyx_ImportType_CheckSize_3_0_12 { + __Pyx_ImportType_CheckSize_Error_3_0_12 = 0, + __Pyx_ImportType_CheckSize_Warn_3_0_12 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_0_12 = 2 }; -static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size); +static PyTypeObject *__Pyx_ImportType_3_0_12(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_12 check_size); #endif /* FetchSharedCythonModule.proto */ @@ -2286,7 +2298,7 @@ static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig); /* FunctionImport.proto */ -static int __Pyx_ImportFunction_3_0_11(PyObject *module, const char *funcname, void (**f)(void), const char *sig); +static int __Pyx_ImportFunction_3_0_12(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); @@ -3738,7 +3750,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_4get_channel, "SFTP.get_channel(self)\nGet new channel from the SFTP session"); +PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_4get_channel, "get_channel(self)\nGet new channel from the SFTP session"); static PyMethodDef __pyx_mdef_4ssh2_4sftp_4SFTP_5get_channel = {"get_channel", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_4sftp_4SFTP_5get_channel, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_4sftp_4SFTP_4get_channel}; static PyObject *__pyx_pw_4ssh2_4sftp_4SFTP_5get_channel(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -3933,7 +3945,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_6open_ex, "SFTP.open_ex(self, const char *filename, unsigned int filename_len, unsigned long flags, long mode, int open_type)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_6open_ex, "open_ex(self, filename: bytes, filename_len: int, flags: int, mode: int, open_type: int)"); static PyMethodDef __pyx_mdef_4ssh2_4sftp_4SFTP_7open_ex = {"open_ex", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_4sftp_4SFTP_7open_ex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_4sftp_4SFTP_6open_ex}; static PyObject *__pyx_pw_4ssh2_4sftp_4SFTP_7open_ex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -4251,7 +4263,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_8open, "SFTP.open(self, filename, unsigned long flags, long mode)\nOpen file handle for file name.\n\n :param filename: Name of file to open.\n :type filename: str\n :param flags: One or more LIBSSH2_FXF_* flags.\n\n Eg for reading flags is ``LIBSSH2_FXF_READ``,\n\n for writing ``LIBSSH2_FXF_WRITE``,\n\n for both ``LIBSSH2_FXF_READ`` | ``LIBSSH2_FXF_WRITE``.\n :type flags: int\n :param mode: File permissions mode. ``LIBSSH2_SFTP_S_IRUSR`` for\n reading.\n\n For writing one or more ``LIBSSH2_SFTP_S_*`` flags.\n\n Eg, for 664 permission mask (read/write owner/group, read other),\n\n mode is\n\n ``LIBSSH2_SFTP_S_IRUSR | LIBSSH2_SFTP_S_IWUSR | \\``\n ``LIBSSH2_SFTP_S_IRGRP | LIBSSH2_SFTP_S_IWGRP | \\``\n ``LIBSSH2_SFTP_S_IROTH``\n :type mode: int\n\n :rtype: :py:class:`ssh2.sftp.SFTPHandle` or `None`\n\n :raises: :py:class:`ssh2.exceptions.SFTPHandleError` on errors opening\n file.\n "); +PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_8open, "open(self, filename, flags: int, mode: int)\nOpen file handle for file name.\n\n :param filename: Name of file to open.\n :type filename: str\n :param flags: One or more LIBSSH2_FXF_* flags.\n\n Eg for reading flags is ``LIBSSH2_FXF_READ``,\n\n for writing ``LIBSSH2_FXF_WRITE``,\n\n for both ``LIBSSH2_FXF_READ`` | ``LIBSSH2_FXF_WRITE``.\n :type flags: int\n :param mode: File permissions mode. ``LIBSSH2_SFTP_S_IRUSR`` for\n reading.\n\n For writing one or more ``LIBSSH2_SFTP_S_*`` flags.\n\n Eg, for 664 permission mask (read/write owner/group, read other),\n\n mode is\n\n ``LIBSSH2_SFTP_S_IRUSR | LIBSSH2_SFTP_S_IWUSR | \\``\n ``LIBSSH2_SFTP_S_IRGRP | LIBSSH2_SFTP_S_IWGRP | \\``\n ``LIBSSH2_SFTP_S_IROTH``\n :type mode: int\n\n :rtype: :py:class:`ssh2.sftp.SFTPHandle` or `None`\n\n :raises: :py:class:`ssh2.exceptions.SFTPHandleError` on errors opening\n file.\n "); static PyMethodDef __pyx_mdef_4ssh2_4sftp_4SFTP_9open = {"open", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_4sftp_4SFTP_9open, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_4sftp_4SFTP_8open}; static PyObject *__pyx_pw_4ssh2_4sftp_4SFTP_9open(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -4563,7 +4575,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_10opendir, "SFTP.opendir(self, path)\nOpen handle to directory path.\n\n :param path: Path of directory\n :type path: str\n\n :rtype: :py:class:`ssh2.sftp.SFTPHandle` or `None`\n\n :raises: :py:class:`ssh2.exceptions.SFTPHandleError` on errors opening\n directory.\n "); +PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_10opendir, "opendir(self, path)\nOpen handle to directory path.\n\n :param path: Path of directory\n :type path: str\n\n :rtype: :py:class:`ssh2.sftp.SFTPHandle` or `None`\n\n :raises: :py:class:`ssh2.exceptions.SFTPHandleError` on errors opening\n directory.\n "); static PyMethodDef __pyx_mdef_4ssh2_4sftp_4SFTP_11opendir = {"opendir", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_4sftp_4SFTP_11opendir, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_4sftp_4SFTP_10opendir}; static PyObject *__pyx_pw_4ssh2_4sftp_4SFTP_11opendir(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -4845,7 +4857,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_12rename_ex, "SFTP.rename_ex(self, const char *source_filename, unsigned int source_filename_len, const char *dest_filename, unsigned int dest_filename_len, long flags)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_12rename_ex, "rename_ex(self, source_filename: bytes, source_filename_len: int, dest_filename: bytes, dest_filename_len: int, flags: int)"); static PyMethodDef __pyx_mdef_4ssh2_4sftp_4SFTP_13rename_ex = {"rename_ex", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_4sftp_4SFTP_13rename_ex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_4sftp_4SFTP_12rename_ex}; static PyObject *__pyx_pw_4ssh2_4sftp_4SFTP_13rename_ex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -5100,7 +5112,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_14rename, "SFTP.rename(self, source_filename, dest_filename)\nRename file.\n\n :param source_filename: Old name of file.\n :type source_filename: str\n :param dest_filename: New name of file.\n :type dest_filename: str"); +PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_14rename, "rename(self, source_filename, dest_filename)\nRename file.\n\n :param source_filename: Old name of file.\n :type source_filename: str\n :param dest_filename: New name of file.\n :type dest_filename: str"); static PyMethodDef __pyx_mdef_4ssh2_4sftp_4SFTP_15rename = {"rename", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_4sftp_4SFTP_15rename, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_4sftp_4SFTP_14rename}; static PyObject *__pyx_pw_4ssh2_4sftp_4SFTP_15rename(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -5379,7 +5391,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_16unlink, "SFTP.unlink(self, filename)\nDelete/unlink file.\n\n :param filename: Name of file to delete/unlink.\n :type filename: str"); +PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_16unlink, "unlink(self, filename)\nDelete/unlink file.\n\n :param filename: Name of file to delete/unlink.\n :type filename: str"); static PyMethodDef __pyx_mdef_4ssh2_4sftp_4SFTP_17unlink = {"unlink", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_4sftp_4SFTP_17unlink, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_4sftp_4SFTP_16unlink}; static PyObject *__pyx_pw_4ssh2_4sftp_4SFTP_17unlink(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -5611,7 +5623,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_18statvfs, "SFTP.statvfs(self, path)\nGet file system statistics from path.\n\n :rtype: `ssh2.sftp.SFTPStatVFS` or int of error code"); +PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_18statvfs, "statvfs(self, path)\nGet file system statistics from path.\n\n :rtype: `ssh2.sftp.SFTPStatVFS` or int of error code"); static PyMethodDef __pyx_mdef_4ssh2_4sftp_4SFTP_19statvfs = {"statvfs", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_4sftp_4SFTP_19statvfs, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_4sftp_4SFTP_18statvfs}; static PyObject *__pyx_pw_4ssh2_4sftp_4SFTP_19statvfs(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -5877,7 +5889,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_20mkdir, "SFTP.mkdir(self, path, long mode)\nMake directory.\n\n :param path: Path of directory to create.\n :type path: str\n :param mode: Permissions mode of new directory.\n :type mode: int\n\n :rtype: int\n\n :raises: Appropriate exception from :py:mod:`ssh2.exceptions` on errors.\n "); +PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_20mkdir, "mkdir(self, path, mode: int)\nMake directory.\n\n :param path: Path of directory to create.\n :type path: str\n :param mode: Permissions mode of new directory.\n :type mode: int\n\n :rtype: int\n\n :raises: Appropriate exception from :py:mod:`ssh2.exceptions` on errors.\n "); static PyMethodDef __pyx_mdef_4ssh2_4sftp_4SFTP_21mkdir = {"mkdir", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_4sftp_4SFTP_21mkdir, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_4sftp_4SFTP_20mkdir}; static PyObject *__pyx_pw_4ssh2_4sftp_4SFTP_21mkdir(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6124,7 +6136,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_22rmdir, "SFTP.rmdir(self, path)\nRemove directory.\n\n :param path: Directory path to remove.\n :type path: str\n\n :rtype: int"); +PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_22rmdir, "rmdir(self, path)\nRemove directory.\n\n :param path: Directory path to remove.\n :type path: str\n\n :rtype: int"); static PyMethodDef __pyx_mdef_4ssh2_4sftp_4SFTP_23rmdir = {"rmdir", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_4sftp_4SFTP_23rmdir, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_4sftp_4SFTP_22rmdir}; static PyObject *__pyx_pw_4ssh2_4sftp_4SFTP_23rmdir(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6356,7 +6368,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_24stat, "SFTP.stat(self, path)\nStat file.\n\n :param path: Path of file to stat.\n :type path: str\n\n :rtype: :py:class:`ssh2.sftp_handle.SFTPAttributes` or\n LIBSSH2_ERROR_EAGAIN"); +PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_24stat, "stat(self, path)\nStat file.\n\n :param path: Path of file to stat.\n :type path: str\n\n :rtype: :py:class:`ssh2.sftp_handle.SFTPAttributes` or\n LIBSSH2_ERROR_EAGAIN"); static PyMethodDef __pyx_mdef_4ssh2_4sftp_4SFTP_25stat = {"stat", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_4sftp_4SFTP_25stat, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_4sftp_4SFTP_24stat}; static PyObject *__pyx_pw_4ssh2_4sftp_4SFTP_25stat(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6613,7 +6625,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_26lstat, "SFTP.lstat(self, path)\nLink stat a file."); +PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_26lstat, "lstat(self, path)\nLink stat a file."); static PyMethodDef __pyx_mdef_4ssh2_4sftp_4SFTP_27lstat = {"lstat", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_4sftp_4SFTP_27lstat, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_4sftp_4SFTP_26lstat}; static PyObject *__pyx_pw_4ssh2_4sftp_4SFTP_27lstat(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6870,7 +6882,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_28setstat, "SFTP.setstat(self, path, SFTPAttributes attrs)\nSet file attributes.\n\n :param path: File path.\n :type path: str\n :param attrs: File attributes to set.\n :type attrs: :py:class:`ssh2.sftp_handle.SFTPAttributes`\n\n :rtype: int"); +PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_28setstat, "setstat(self, path, attrs: SFTPAttributes)\nSet file attributes.\n\n :param path: File path.\n :type path: str\n :param attrs: File attributes to set.\n :type attrs: :py:class:`ssh2.sftp_handle.SFTPAttributes`\n\n :rtype: int"); static PyMethodDef __pyx_mdef_4ssh2_4sftp_4SFTP_29setstat = {"setstat", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_4sftp_4SFTP_29setstat, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_4sftp_4SFTP_28setstat}; static PyObject *__pyx_pw_4ssh2_4sftp_4SFTP_29setstat(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -7118,7 +7130,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_30symlink, "SFTP.symlink(self, path, target)\nCreate symlink.\n\n :param path: Source file path.\n :type path: str\n :param target: Target file path.\n :type target: str\n\n :rtype: int"); +PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_30symlink, "symlink(self, path, target)\nCreate symlink.\n\n :param path: Source file path.\n :type path: str\n :param target: Target file path.\n :type target: str\n\n :rtype: int"); static PyMethodDef __pyx_mdef_4ssh2_4sftp_4SFTP_31symlink = {"symlink", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_4sftp_4SFTP_31symlink, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_4sftp_4SFTP_30symlink}; static PyObject *__pyx_pw_4ssh2_4sftp_4SFTP_31symlink(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -7397,7 +7409,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_32realpath, "SFTP.realpath(self, path, size_t max_len=256)\nGet real path for path.\n\n :param: Path name to get real path for.\n :type param: str\n :param max_len: Max size of returned real path.\n :type max_len: int\n\n :raises: :py:class:`ssh2.exceptions.SFTPHandleError` on errors getting\n real path.\n :raises: :py:class:`ssh2.exceptions.SFTPBufferTooSmall` on max_len less\n than real path length."); +PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_32realpath, "realpath(self, path, max_len: int = 256)\nGet real path for path.\n\n :param: Path name to get real path for.\n :type param: str\n :param max_len: Max size of returned real path.\n :type max_len: int\n\n :raises: :py:class:`ssh2.exceptions.SFTPHandleError` on errors getting\n real path.\n :raises: :py:class:`ssh2.exceptions.SFTPBufferTooSmall` on max_len less\n than real path length."); static PyMethodDef __pyx_mdef_4ssh2_4sftp_4SFTP_33realpath = {"realpath", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_4sftp_4SFTP_33realpath, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_4sftp_4SFTP_32realpath}; static PyObject *__pyx_pw_4ssh2_4sftp_4SFTP_33realpath(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -7839,7 +7851,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_34last_error, "SFTP.last_error(self)\nGet last error code from SFTP channel.\n\n :rtype: int"); +PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_34last_error, "last_error(self)\nGet last error code from SFTP channel.\n\n :rtype: int"); static PyMethodDef __pyx_mdef_4ssh2_4sftp_4SFTP_35last_error = {"last_error", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_4sftp_4SFTP_35last_error, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_4sftp_4SFTP_34last_error}; static PyObject *__pyx_pw_4ssh2_4sftp_4SFTP_35last_error(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -7972,7 +7984,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_36__reduce_cython__, "SFTP.__reduce_cython__(self)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_36__reduce_cython__, "__reduce_cython__(self)"); static PyMethodDef __pyx_mdef_4ssh2_4sftp_4SFTP_37__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_4sftp_4SFTP_37__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_4sftp_4SFTP_36__reduce_cython__}; static PyObject *__pyx_pw_4ssh2_4sftp_4SFTP_37__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -8053,7 +8065,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_38__setstate_cython__, "SFTP.__setstate_cython__(self, __pyx_state)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_4sftp_4SFTP_38__setstate_cython__, "__setstate_cython__(self, __pyx_state)"); static PyMethodDef __pyx_mdef_4ssh2_4sftp_4SFTP_39__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_4sftp_4SFTP_39__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_4sftp_4SFTP_38__setstate_cython__}; static PyObject *__pyx_pw_4ssh2_4sftp_4SFTP_39__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -8856,18 +8868,18 @@ static int __Pyx_modinit_type_import_code(void) { /*--- Type import code ---*/ __pyx_t_1 = PyImport_ImportModule("ssh2.session"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_4ssh2_7session_Session = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.session", "Session", sizeof(struct __pyx_obj_4ssh2_7session_Session), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_7session_Session),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_7session_Session) __PYX_ERR(2, 19, __pyx_L1_error) - __pyx_ptype_4ssh2_7session_MethodType = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.session", "MethodType", sizeof(struct __pyx_obj_4ssh2_7session_MethodType), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_7session_MethodType),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_7session_MethodType) __PYX_ERR(2, 26, __pyx_L1_error) + __pyx_ptype_4ssh2_7session_Session = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.session", "Session", sizeof(struct __pyx_obj_4ssh2_7session_Session), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_7session_Session),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_7session_Session) __PYX_ERR(2, 19, __pyx_L1_error) + __pyx_ptype_4ssh2_7session_MethodType = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.session", "MethodType", sizeof(struct __pyx_obj_4ssh2_7session_MethodType), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_7session_MethodType),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_7session_MethodType) __PYX_ERR(2, 26, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyImport_ImportModule("ssh2.channel"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_4ssh2_7channel_Channel = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.channel", "Channel", sizeof(struct __pyx_obj_4ssh2_7channel_Channel), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_7channel_Channel),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_7channel_Channel) __PYX_ERR(3, 24, __pyx_L1_error) + __pyx_ptype_4ssh2_7channel_Channel = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.channel", "Channel", sizeof(struct __pyx_obj_4ssh2_7channel_Channel), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_7channel_Channel),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_7channel_Channel) __PYX_ERR(3, 24, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyImport_ImportModule("ssh2.sftp_handle"); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_4ssh2_11sftp_handle_SFTPHandle = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.sftp_handle", "SFTPHandle", sizeof(struct __pyx_obj_4ssh2_11sftp_handle_SFTPHandle), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_11sftp_handle_SFTPHandle),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle) __PYX_ERR(4, 25, __pyx_L1_error) - __pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.sftp_handle", "SFTPAttributes", sizeof(struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes) __PYX_ERR(4, 31, __pyx_L1_error) - __pyx_ptype_4ssh2_11sftp_handle_SFTPStatVFS = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.sftp_handle", "SFTPStatVFS", sizeof(struct __pyx_obj_4ssh2_11sftp_handle_SFTPStatVFS), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_11sftp_handle_SFTPStatVFS),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_11sftp_handle_SFTPStatVFS) __PYX_ERR(4, 35, __pyx_L1_error) + __pyx_ptype_4ssh2_11sftp_handle_SFTPHandle = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.sftp_handle", "SFTPHandle", sizeof(struct __pyx_obj_4ssh2_11sftp_handle_SFTPHandle), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_11sftp_handle_SFTPHandle),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle) __PYX_ERR(4, 25, __pyx_L1_error) + __pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.sftp_handle", "SFTPAttributes", sizeof(struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes) __PYX_ERR(4, 31, __pyx_L1_error) + __pyx_ptype_4ssh2_11sftp_handle_SFTPStatVFS = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.sftp_handle", "SFTPStatVFS", sizeof(struct __pyx_obj_4ssh2_11sftp_handle_SFTPStatVFS), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_11sftp_handle_SFTPStatVFS),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_11sftp_handle_SFTPStatVFS) __PYX_ERR(4, 35, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -8895,17 +8907,17 @@ static int __Pyx_modinit_function_import_code(void) { /*--- Function import code ---*/ __pyx_t_1 = PyImport_ImportModule("ssh2.channel"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction_3_0_11(__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_3_0_12(__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) __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_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction_3_0_11(__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_3_0_11(__pyx_t_1, "to_str_len", (void (**)(void))&__pyx_f_4ssh2_5utils_to_str_len, "PyObject *(char *, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction_3_0_11(__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_3_0_12(__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_3_0_12(__pyx_t_1, "to_str_len", (void (**)(void))&__pyx_f_4ssh2_5utils_to_str_len, "PyObject *(char *, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportFunction_3_0_12(__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) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyImport_ImportModule("ssh2.sftp_handle"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction_3_0_11(__pyx_t_1, "PySFTPHandle", (void (**)(void))&__pyx_f_4ssh2_11sftp_handle_PySFTPHandle, "PyObject *(LIBSSH2_SFTP_HANDLE *, struct __pyx_obj_4ssh2_4sftp_SFTP *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportFunction_3_0_12(__pyx_t_1, "PySFTPHandle", (void (**)(void))&__pyx_f_4ssh2_11sftp_handle_PySFTPHandle, "PyObject *(LIBSSH2_SFTP_HANDLE *, struct __pyx_obj_4ssh2_4sftp_SFTP *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -11774,10 +11786,10 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { #endif /* TypeImport */ -#ifndef __PYX_HAVE_RT_ImportType_3_0_11 -#define __PYX_HAVE_RT_ImportType_3_0_11 -static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *module_name, const char *class_name, - size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size) +#ifndef __PYX_HAVE_RT_ImportType_3_0_12 +#define __PYX_HAVE_RT_ImportType_3_0_12 +static PyTypeObject *__Pyx_ImportType_3_0_12(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_12 check_size) { PyObject *result = 0; char warning[200]; @@ -11831,7 +11843,7 @@ static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *modul module_name, class_name, size, basicsize+itemsize); goto bad; } - if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_11 && + if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_12 && ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " @@ -11839,7 +11851,7 @@ static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *modul module_name, class_name, size, basicsize, basicsize+itemsize); goto bad; } - else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_11 && (size_t)basicsize > size) { + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_12 && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", @@ -13188,7 +13200,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { #include "compile.h" #include "frameobject.h" #include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif @@ -15230,9 +15242,9 @@ static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *s } /* FunctionImport */ -#ifndef __PYX_HAVE_RT_ImportFunction_3_0_11 -#define __PYX_HAVE_RT_ImportFunction_3_0_11 -static int __Pyx_ImportFunction_3_0_11(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { +#ifndef __PYX_HAVE_RT_ImportFunction_3_0_12 +#define __PYX_HAVE_RT_ImportFunction_3_0_12 +static int __Pyx_ImportFunction_3_0_12(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { PyObject *d = 0; PyObject *cobj = 0; union { diff --git a/ssh2/sftp.pyi b/ssh2/sftp.pyi new file mode 100644 index 00000000..10cc8a45 --- /dev/null +++ b/ssh2/sftp.pyi @@ -0,0 +1,53 @@ +from typing import Final, AnyStr + +LIBSSH2_SFTP_S_IFMT: Final[int] = ... +LIBSSH2_SFTP_S_IFIFO: Final[int] = ... +LIBSSH2_SFTP_S_IFCHR: Final[int] = ... +LIBSSH2_SFTP_S_IFDIR: Final[int] = ... +LIBSSH2_SFTP_S_IFBLK: Final[int] = ... +LIBSSH2_SFTP_S_IFREG: Final[int] = ... +LIBSSH2_SFTP_S_IFLNK: Final[int] = ... +LIBSSH2_SFTP_S_IFSOCK: Final[int] = ... +LIBSSH2_SFTP_ATTR_SIZE: Final[int] = ... +LIBSSH2_SFTP_ATTR_UIDGID: Final[int] = ... +LIBSSH2_SFTP_ATTR_PERMISSIONS: Final[int] = ... +LIBSSH2_SFTP_ATTR_ACMODTIME: Final[int] = ... +LIBSSH2_SFTP_ATTR_EXTENDED: Final[int] = ... +LIBSSH2_FXF_READ: Final[int] = ... +LIBSSH2_FXF_WRITE: Final[int] = ... +LIBSSH2_FXF_APPEND: Final[int] = ... +LIBSSH2_FXF_CREAT: Final[int] = ... +LIBSSH2_FXF_TRUNC: Final[int] = ... +LIBSSH2_FXF_EXCL: Final[int] = ... +LIBSSH2_SFTP_S_IRWXU: Final[int] = ... +LIBSSH2_SFTP_S_IRUSR: Final[int] = ... +LIBSSH2_SFTP_S_IWUSR: Final[int] = ... +LIBSSH2_SFTP_S_IXUSR: Final[int] = ... +LIBSSH2_SFTP_S_IRWXG: Final[int] = ... +LIBSSH2_SFTP_S_IRGRP: Final[int] = ... +LIBSSH2_SFTP_S_IWGRP: Final[int] = ... +LIBSSH2_SFTP_S_IXGRP: Final[int] = ... +LIBSSH2_SFTP_S_IRWXO: Final[int] = ... +LIBSSH2_SFTP_S_IROTH: Final[int] = ... +LIBSSH2_SFTP_S_IWOTH: Final[int] = ... +LIBSSH2_SFTP_S_IXOTH: Final[int] = ... +LIBSSH2_SFTP_ST_RDONLY: Final[int] = ... +LIBSSH2_SFTP_ST_NOSUID: Final[int] = ... + +class SFTP: + def get_channel(self): ... + def open_ex(self, filename: bytes, filename_len: int, flags: int, mode: int, open_type: int): ... + def open(self, filename: AnyStr, flags: int, mode: int): ... + def opendir(self, path: AnyStr): ... + def rename_ex(self, source_filename: bytes, source_filename_len: int, dest_filename: bytes, dest_filename_len: int, flags: int): ... + def rename(self, source_filename: AnyStr, dest_filename: AnyStr): ... + def unlink(self, filename: AnyStr): ... + def statvfs(self, path: AnyStr): ... + def mkdir(self, path: AnyStr, mode: int): ... + def rmdir(self, path: AnyStr): ... + def stat(self, path: AnyStr): ... + def lstat(self, path: AnyStr): ... + # def setstat(self, path, attrs: SFTPAttributes): ... + def symlink(self, path: AnyStr, target: AnyStr): ... + def realpath(self, path: AnyStr, max_len: int = 256): ... + def last_error(self): ... diff --git a/ssh2/sftp_handle.c b/ssh2/sftp_handle.c index 8d96c08c..9284a2c4 100644 --- a/ssh2/sftp_handle.c +++ b/ssh2/sftp_handle.c @@ -1,4 +1,4 @@ -/* Generated by Cython 3.0.11 */ +/* Generated by Cython 3.0.12 */ /* BEGIN: Cython Metadata { @@ -55,10 +55,10 @@ END: Cython Metadata */ #else #define __PYX_EXTRA_ABI_MODULE_NAME "" #endif -#define CYTHON_ABI "3_0_11" __PYX_EXTRA_ABI_MODULE_NAME +#define CYTHON_ABI "3_0_12" __PYX_EXTRA_ABI_MODULE_NAME #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." -#define CYTHON_HEX_VERSION 0x03000BF0 +#define CYTHON_HEX_VERSION 0x03000CF0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -1537,6 +1537,18 @@ struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes; struct __pyx_obj_4ssh2_11sftp_handle_SFTPStatVFS; struct __pyx_obj_4ssh2_11sftp_handle___pyx_scope_struct__readdir_ex; struct __pyx_obj_4ssh2_11sftp_handle___pyx_scope_struct_1_readdir; +struct __pyx_ctuple_int__and_int; +typedef struct __pyx_ctuple_int__and_int __pyx_ctuple_int__and_int; + +/* "utils.pxd":24 + * cdef object to_str_len(char *c_str, int length) + * cpdef int handle_error_codes(int errcode) except -1 + * cpdef (int, int) find_eol(bytes buf: bytes, Py_ssize_t pos: Py_ssize_t) # <<<<<<<<<<<<<< + */ +struct __pyx_ctuple_int__and_int { + int f0; + int f1; +}; /* "session.pxd":19 * from . cimport c_ssh2 @@ -1622,12 +1634,12 @@ struct __pyx_obj_4ssh2_11sftp_handle_SFTPStatVFS { }; -/* "ssh2/sftp_handle.pyx":180 +/* "ssh2/sftp_handle.pyx":183 * return rc, buf * * def readdir_ex(self, # <<<<<<<<<<<<<< * size_t longentry_maxlen=1024, - * size_t buffer_maxlen=1024): + * size_t buffer_maxlen=1024) -> Generator[Tuple[int, bytes, bytes, SFTPAttributes]]: */ struct __pyx_obj_4ssh2_11sftp_handle___pyx_scope_struct__readdir_ex { PyObject_HEAD @@ -1642,10 +1654,10 @@ struct __pyx_obj_4ssh2_11sftp_handle___pyx_scope_struct__readdir_ex { }; -/* "ssh2/sftp_handle.pyx":229 +/* "ssh2/sftp_handle.pyx":232 * return rc, buf, b_longentry, attrs * - * def readdir(self, size_t buffer_maxlen=1024): # <<<<<<<<<<<<<< + * def readdir(self, size_t buffer_maxlen=1024) -> Generator[Tuple[int, bytes, SFTPAttributes]]: # <<<<<<<<<<<<<< * """Get directory listing from file handle, if any. * */ @@ -1905,7 +1917,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #if !CYTHON_VECTORCALL #if PY_VERSION_HEX >= 0x03080000 #include "frameobject.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif @@ -2045,24 +2057,30 @@ static int __Pyx_setup_reduce(PyObject* type_obj); #endif /* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_11 -#define __PYX_HAVE_RT_ImportType_proto_3_0_11 +#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_12 +#define __PYX_HAVE_RT_ImportType_proto_3_0_12 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #include #endif #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L -#define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) alignof(s) +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_12(s) alignof(s) #else -#define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) sizeof(void*) +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_12(s) sizeof(void*) #endif -enum __Pyx_ImportType_CheckSize_3_0_11 { - __Pyx_ImportType_CheckSize_Error_3_0_11 = 0, - __Pyx_ImportType_CheckSize_Warn_3_0_11 = 1, - __Pyx_ImportType_CheckSize_Ignore_3_0_11 = 2 +enum __Pyx_ImportType_CheckSize_3_0_12 { + __Pyx_ImportType_CheckSize_Error_3_0_12 = 0, + __Pyx_ImportType_CheckSize_Warn_3_0_12 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_0_12 = 2 }; -static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size); +static PyTypeObject *__Pyx_ImportType_3_0_12(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_12 check_size); #endif +/* Import.proto */ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); + +/* ImportFrom.proto */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); + /* FetchSharedCythonModule.proto */ static PyObject *__Pyx_FetchSharedCythonABIModule(void); @@ -2412,7 +2430,7 @@ static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig); /* FunctionImport.proto */ -static int __Pyx_ImportFunction_3_0_11(PyObject *module, const char *funcname, void (**f)(void), const char *sig); +static int __Pyx_ImportFunction_3_0_12(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); @@ -2456,11 +2474,14 @@ static PyObject *__pyx_builtin_TypeError; static PyObject *__pyx_builtin_StopIteration; /* #### Code section: string_decls ### */ static const char __pyx_k__2[] = ""; +static const char __pyx_k__5[] = "."; static const char __pyx_k_gc[] = "gc"; static const char __pyx_k_rc[] = "rc"; -static const char __pyx_k__45[] = "?"; +static const char __pyx_k__46[] = "?"; static const char __pyx_k_buf[] = "buf"; +static const char __pyx_k_int[] = "int"; static const char __pyx_k_vfs[] = "vfs"; +static const char __pyx_k_None[] = "None"; static const char __pyx_k_args[] = "args"; static const char __pyx_k_cbuf[] = "cbuf"; static const char __pyx_k_exit[] = "__exit__"; @@ -2474,6 +2495,7 @@ static const char __pyx_k_sftp[] = "sftp"; static const char __pyx_k_size[] = "_size"; static const char __pyx_k_tell[] = "tell"; static const char __pyx_k_test[] = "__test__"; +static const char __pyx_k_Tuple[] = "Tuple"; static const char __pyx_k_attrs[] = "attrs"; static const char __pyx_k_close[] = "close"; static const char __pyx_k_enter[] = "__enter__"; @@ -2484,11 +2506,14 @@ static const char __pyx_k_throw[] = "throw"; static const char __pyx_k_write[] = "write"; static const char __pyx_k_enable[] = "enable"; static const char __pyx_k_entryb[] = "entryb"; +static const char __pyx_k_import[] = "__import__"; static const char __pyx_k_offset[] = "offset"; static const char __pyx_k_reduce[] = "__reduce__"; +static const char __pyx_k_return[] = "return"; static const char __pyx_k_rewind[] = "rewind"; static const char __pyx_k_seek64[] = "seek64"; static const char __pyx_k_tell64[] = "tell64"; +static const char __pyx_k_typing[] = "typing"; static const char __pyx_k_disable[] = "disable"; static const char __pyx_k_readdir[] = "readdir"; static const char __pyx_k_setstat[] = "setstat"; @@ -2499,6 +2524,7 @@ static const char __pyx_k_getstate[] = "__getstate__"; static const char __pyx_k_setstate[] = "__setstate__"; static const char __pyx_k_sftp_ref[] = "_sftp_ref"; static const char __pyx_k_tot_size[] = "tot_size"; +static const char __pyx_k_Generator[] = "Generator"; static const char __pyx_k_TypeError[] = "TypeError"; static const char __pyx_k_isenabled[] = "isenabled"; static const char __pyx_k_longentry[] = "longentry"; @@ -2521,6 +2547,7 @@ static const char __pyx_k_SFTPAttributes[] = "SFTPAttributes"; static const char __pyx_k_SFTPHandle_read[] = "SFTPHandle.read"; static const char __pyx_k_SFTPHandle_seek[] = "SFTPHandle.seek"; static const char __pyx_k_SFTPHandle_tell[] = "SFTPHandle.tell"; +static const char __pyx_k_Tuple_int_bytes[] = "Tuple[int, bytes]"; static const char __pyx_k_setstate_cython[] = "__setstate_cython__"; static const char __pyx_k_SFTPHandle_close[] = "SFTPHandle.close"; static const char __pyx_k_SFTPHandle_fstat[] = "SFTPHandle.fstat"; @@ -2548,7 +2575,9 @@ static const char __pyx_k_SFTPStatVFS___reduce_cython[] = "SFTPStatVFS.__reduce_ static const char __pyx_k_SFTPHandle___setstate_cython[] = "SFTPHandle.__setstate_cython__"; static const char __pyx_k_SFTPStatVFS___setstate_cython[] = "SFTPStatVFS.__setstate_cython__"; static const char __pyx_k_SFTPAttributes___reduce_cython[] = "SFTPAttributes.__reduce_cython__"; +static const char __pyx_k_Generator_Tuple_int_bytes_bytes[] = "Generator[Tuple[int, bytes, bytes, SFTPAttributes]]"; static const char __pyx_k_SFTP_handle_attributes_and_stat[] = "SFTP handle, attributes and stat VFS classes."; +static const char __pyx_k_Generator_Tuple_int_bytes_SFTPAt[] = "Generator[Tuple[int, bytes, SFTPAttributes]]"; static const char __pyx_k_SFTPAttributes___setstate_cython[] = "SFTPAttributes.__setstate_cython__"; static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__"; /* #### Code section: decls ### */ @@ -2590,9 +2619,9 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_34rewind(struct __pyx static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_36tell(struct __pyx_obj_4ssh2_11sftp_handle_SFTPHandle *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_38tell64(struct __pyx_obj_4ssh2_11sftp_handle_SFTPHandle *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_40fstat_ex(struct __pyx_obj_4ssh2_11sftp_handle_SFTPHandle *__pyx_v_self, struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes *__pyx_v_attrs, int __pyx_v_setstat); /* proto */ -static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_42fstat(struct __pyx_obj_4ssh2_11sftp_handle_SFTPHandle *__pyx_v_self); /* proto */ +static struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_42fstat(struct __pyx_obj_4ssh2_11sftp_handle_SFTPHandle *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_44fsetstat(struct __pyx_obj_4ssh2_11sftp_handle_SFTPHandle *__pyx_v_self, struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes *__pyx_v_attrs); /* proto */ -static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_46fstatvfs(struct __pyx_obj_4ssh2_11sftp_handle_SFTPHandle *__pyx_v_self); /* proto */ +static struct __pyx_obj_4ssh2_11sftp_handle_SFTPStatVFS *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_46fstatvfs(struct __pyx_obj_4ssh2_11sftp_handle_SFTPHandle *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_48__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4ssh2_11sftp_handle_SFTPHandle *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_50__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4ssh2_11sftp_handle_SFTPHandle *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static int __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS___cinit__(struct __pyx_obj_4ssh2_11sftp_handle_SFTPStatVFS *__pyx_v_self, PyObject *__pyx_v__sftp_ref); /* proto */ @@ -2679,7 +2708,11 @@ typedef struct { PyTypeObject *__pyx_ptype_4ssh2_11sftp_handle_SFTPStatVFS; PyTypeObject *__pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct__readdir_ex; PyTypeObject *__pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct_1_readdir; + PyObject *__pyx_n_s_Generator; + PyObject *__pyx_kp_s_Generator_Tuple_int_bytes_SFTPAt; + PyObject *__pyx_kp_s_Generator_Tuple_int_bytes_bytes; PyObject *__pyx_n_s_MemoryError; + PyObject *__pyx_n_s_None; PyObject *__pyx_n_s_SFTPAttributes; PyObject *__pyx_n_s_SFTPAttributes___reduce_cython; PyObject *__pyx_n_s_SFTPAttributes___setstate_cython; @@ -2709,9 +2742,12 @@ typedef struct { PyObject *__pyx_n_s_SFTPStatVFS___reduce_cython; PyObject *__pyx_n_s_SFTPStatVFS___setstate_cython; PyObject *__pyx_n_s_StopIteration; + PyObject *__pyx_n_s_Tuple; + PyObject *__pyx_kp_s_Tuple_int_bytes; PyObject *__pyx_n_s_TypeError; PyObject *__pyx_kp_b__2; - PyObject *__pyx_n_s__45; + PyObject *__pyx_n_s__46; + PyObject *__pyx_kp_u__5; PyObject *__pyx_n_s_args; PyObject *__pyx_n_s_asyncio_coroutines; PyObject *__pyx_n_s_attrs; @@ -2735,6 +2771,8 @@ typedef struct { PyObject *__pyx_n_s_fsync; PyObject *__pyx_kp_u_gc; PyObject *__pyx_n_s_getstate; + PyObject *__pyx_n_s_import; + PyObject *__pyx_n_s_int; PyObject *__pyx_n_s_is_coroutine; PyObject *__pyx_kp_u_isenabled; PyObject *__pyx_n_s_longentry; @@ -2753,6 +2791,7 @@ typedef struct { PyObject *__pyx_n_s_reduce; PyObject *__pyx_n_s_reduce_cython; PyObject *__pyx_n_s_reduce_ex; + PyObject *__pyx_n_s_return; PyObject *__pyx_n_s_rewind; PyObject *__pyx_n_s_seek; PyObject *__pyx_n_s_seek64; @@ -2772,53 +2811,54 @@ typedef struct { PyObject *__pyx_n_s_test; PyObject *__pyx_n_s_throw; PyObject *__pyx_n_s_tot_size; + PyObject *__pyx_n_s_typing; PyObject *__pyx_n_s_vfs; PyObject *__pyx_n_s_write; PyObject *__pyx_int_0; PyObject *__pyx_int_1024; size_t __pyx_k_; - PyObject *__pyx_tuple__5; - PyObject *__pyx_tuple__7; - PyObject *__pyx_tuple__10; - PyObject *__pyx_tuple__12; - PyObject *__pyx_tuple__14; - PyObject *__pyx_tuple__16; + PyObject *__pyx_tuple__6; + PyObject *__pyx_tuple__8; + PyObject *__pyx_tuple__11; + PyObject *__pyx_tuple__13; + PyObject *__pyx_tuple__15; PyObject *__pyx_tuple__17; PyObject *__pyx_tuple__18; - PyObject *__pyx_tuple__20; + PyObject *__pyx_tuple__19; PyObject *__pyx_tuple__21; PyObject *__pyx_tuple__22; - PyObject *__pyx_tuple__24; - PyObject *__pyx_tuple__27; - PyObject *__pyx_tuple__33; - PyObject *__pyx_tuple__35; - PyObject *__pyx_tuple__37; - PyObject *__pyx_tuple__39; + PyObject *__pyx_tuple__23; + PyObject *__pyx_tuple__25; + PyObject *__pyx_tuple__28; + PyObject *__pyx_tuple__34; + PyObject *__pyx_tuple__36; + PyObject *__pyx_tuple__38; + PyObject *__pyx_tuple__40; PyObject *__pyx_codeobj__3; PyObject *__pyx_codeobj__4; - PyObject *__pyx_codeobj__6; - PyObject *__pyx_codeobj__8; + PyObject *__pyx_codeobj__7; PyObject *__pyx_codeobj__9; - PyObject *__pyx_codeobj__11; - PyObject *__pyx_codeobj__13; - PyObject *__pyx_codeobj__15; - PyObject *__pyx_codeobj__19; - PyObject *__pyx_codeobj__23; - PyObject *__pyx_codeobj__25; + PyObject *__pyx_codeobj__10; + PyObject *__pyx_codeobj__12; + PyObject *__pyx_codeobj__14; + PyObject *__pyx_codeobj__16; + PyObject *__pyx_codeobj__20; + PyObject *__pyx_codeobj__24; PyObject *__pyx_codeobj__26; - PyObject *__pyx_codeobj__28; + PyObject *__pyx_codeobj__27; PyObject *__pyx_codeobj__29; PyObject *__pyx_codeobj__30; PyObject *__pyx_codeobj__31; PyObject *__pyx_codeobj__32; - PyObject *__pyx_codeobj__34; - PyObject *__pyx_codeobj__36; - PyObject *__pyx_codeobj__38; - PyObject *__pyx_codeobj__40; + PyObject *__pyx_codeobj__33; + PyObject *__pyx_codeobj__35; + PyObject *__pyx_codeobj__37; + PyObject *__pyx_codeobj__39; PyObject *__pyx_codeobj__41; PyObject *__pyx_codeobj__42; PyObject *__pyx_codeobj__43; PyObject *__pyx_codeobj__44; + PyObject *__pyx_codeobj__45; } __pyx_mstate; #if CYTHON_USE_MODULE_STATE @@ -2874,7 +2914,11 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_type_4ssh2_11sftp_handle___pyx_scope_struct__readdir_ex); Py_CLEAR(clear_module_state->__pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct_1_readdir); Py_CLEAR(clear_module_state->__pyx_type_4ssh2_11sftp_handle___pyx_scope_struct_1_readdir); + Py_CLEAR(clear_module_state->__pyx_n_s_Generator); + Py_CLEAR(clear_module_state->__pyx_kp_s_Generator_Tuple_int_bytes_SFTPAt); + Py_CLEAR(clear_module_state->__pyx_kp_s_Generator_Tuple_int_bytes_bytes); Py_CLEAR(clear_module_state->__pyx_n_s_MemoryError); + Py_CLEAR(clear_module_state->__pyx_n_s_None); Py_CLEAR(clear_module_state->__pyx_n_s_SFTPAttributes); Py_CLEAR(clear_module_state->__pyx_n_s_SFTPAttributes___reduce_cython); Py_CLEAR(clear_module_state->__pyx_n_s_SFTPAttributes___setstate_cython); @@ -2904,9 +2948,12 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_SFTPStatVFS___reduce_cython); Py_CLEAR(clear_module_state->__pyx_n_s_SFTPStatVFS___setstate_cython); Py_CLEAR(clear_module_state->__pyx_n_s_StopIteration); + Py_CLEAR(clear_module_state->__pyx_n_s_Tuple); + Py_CLEAR(clear_module_state->__pyx_kp_s_Tuple_int_bytes); Py_CLEAR(clear_module_state->__pyx_n_s_TypeError); Py_CLEAR(clear_module_state->__pyx_kp_b__2); - Py_CLEAR(clear_module_state->__pyx_n_s__45); + Py_CLEAR(clear_module_state->__pyx_n_s__46); + Py_CLEAR(clear_module_state->__pyx_kp_u__5); Py_CLEAR(clear_module_state->__pyx_n_s_args); Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); Py_CLEAR(clear_module_state->__pyx_n_s_attrs); @@ -2930,6 +2977,8 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_fsync); Py_CLEAR(clear_module_state->__pyx_kp_u_gc); Py_CLEAR(clear_module_state->__pyx_n_s_getstate); + Py_CLEAR(clear_module_state->__pyx_n_s_import); + Py_CLEAR(clear_module_state->__pyx_n_s_int); Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled); Py_CLEAR(clear_module_state->__pyx_n_s_longentry); @@ -2948,6 +2997,7 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_reduce); Py_CLEAR(clear_module_state->__pyx_n_s_reduce_cython); Py_CLEAR(clear_module_state->__pyx_n_s_reduce_ex); + Py_CLEAR(clear_module_state->__pyx_n_s_return); Py_CLEAR(clear_module_state->__pyx_n_s_rewind); Py_CLEAR(clear_module_state->__pyx_n_s_seek); Py_CLEAR(clear_module_state->__pyx_n_s_seek64); @@ -2967,52 +3017,53 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_test); Py_CLEAR(clear_module_state->__pyx_n_s_throw); Py_CLEAR(clear_module_state->__pyx_n_s_tot_size); + Py_CLEAR(clear_module_state->__pyx_n_s_typing); Py_CLEAR(clear_module_state->__pyx_n_s_vfs); Py_CLEAR(clear_module_state->__pyx_n_s_write); Py_CLEAR(clear_module_state->__pyx_int_0); Py_CLEAR(clear_module_state->__pyx_int_1024); - Py_CLEAR(clear_module_state->__pyx_tuple__5); - Py_CLEAR(clear_module_state->__pyx_tuple__7); - Py_CLEAR(clear_module_state->__pyx_tuple__10); - Py_CLEAR(clear_module_state->__pyx_tuple__12); - Py_CLEAR(clear_module_state->__pyx_tuple__14); - Py_CLEAR(clear_module_state->__pyx_tuple__16); + Py_CLEAR(clear_module_state->__pyx_tuple__6); + Py_CLEAR(clear_module_state->__pyx_tuple__8); + Py_CLEAR(clear_module_state->__pyx_tuple__11); + Py_CLEAR(clear_module_state->__pyx_tuple__13); + Py_CLEAR(clear_module_state->__pyx_tuple__15); Py_CLEAR(clear_module_state->__pyx_tuple__17); Py_CLEAR(clear_module_state->__pyx_tuple__18); - Py_CLEAR(clear_module_state->__pyx_tuple__20); + Py_CLEAR(clear_module_state->__pyx_tuple__19); Py_CLEAR(clear_module_state->__pyx_tuple__21); Py_CLEAR(clear_module_state->__pyx_tuple__22); - Py_CLEAR(clear_module_state->__pyx_tuple__24); - Py_CLEAR(clear_module_state->__pyx_tuple__27); - Py_CLEAR(clear_module_state->__pyx_tuple__33); - Py_CLEAR(clear_module_state->__pyx_tuple__35); - Py_CLEAR(clear_module_state->__pyx_tuple__37); - Py_CLEAR(clear_module_state->__pyx_tuple__39); + Py_CLEAR(clear_module_state->__pyx_tuple__23); + Py_CLEAR(clear_module_state->__pyx_tuple__25); + Py_CLEAR(clear_module_state->__pyx_tuple__28); + Py_CLEAR(clear_module_state->__pyx_tuple__34); + Py_CLEAR(clear_module_state->__pyx_tuple__36); + Py_CLEAR(clear_module_state->__pyx_tuple__38); + Py_CLEAR(clear_module_state->__pyx_tuple__40); Py_CLEAR(clear_module_state->__pyx_codeobj__3); Py_CLEAR(clear_module_state->__pyx_codeobj__4); - Py_CLEAR(clear_module_state->__pyx_codeobj__6); - Py_CLEAR(clear_module_state->__pyx_codeobj__8); + Py_CLEAR(clear_module_state->__pyx_codeobj__7); Py_CLEAR(clear_module_state->__pyx_codeobj__9); - Py_CLEAR(clear_module_state->__pyx_codeobj__11); - Py_CLEAR(clear_module_state->__pyx_codeobj__13); - Py_CLEAR(clear_module_state->__pyx_codeobj__15); - Py_CLEAR(clear_module_state->__pyx_codeobj__19); - Py_CLEAR(clear_module_state->__pyx_codeobj__23); - Py_CLEAR(clear_module_state->__pyx_codeobj__25); + Py_CLEAR(clear_module_state->__pyx_codeobj__10); + Py_CLEAR(clear_module_state->__pyx_codeobj__12); + Py_CLEAR(clear_module_state->__pyx_codeobj__14); + Py_CLEAR(clear_module_state->__pyx_codeobj__16); + Py_CLEAR(clear_module_state->__pyx_codeobj__20); + Py_CLEAR(clear_module_state->__pyx_codeobj__24); Py_CLEAR(clear_module_state->__pyx_codeobj__26); - Py_CLEAR(clear_module_state->__pyx_codeobj__28); + Py_CLEAR(clear_module_state->__pyx_codeobj__27); Py_CLEAR(clear_module_state->__pyx_codeobj__29); Py_CLEAR(clear_module_state->__pyx_codeobj__30); Py_CLEAR(clear_module_state->__pyx_codeobj__31); Py_CLEAR(clear_module_state->__pyx_codeobj__32); - Py_CLEAR(clear_module_state->__pyx_codeobj__34); - Py_CLEAR(clear_module_state->__pyx_codeobj__36); - Py_CLEAR(clear_module_state->__pyx_codeobj__38); - Py_CLEAR(clear_module_state->__pyx_codeobj__40); + Py_CLEAR(clear_module_state->__pyx_codeobj__33); + Py_CLEAR(clear_module_state->__pyx_codeobj__35); + Py_CLEAR(clear_module_state->__pyx_codeobj__37); + Py_CLEAR(clear_module_state->__pyx_codeobj__39); Py_CLEAR(clear_module_state->__pyx_codeobj__41); Py_CLEAR(clear_module_state->__pyx_codeobj__42); Py_CLEAR(clear_module_state->__pyx_codeobj__43); Py_CLEAR(clear_module_state->__pyx_codeobj__44); + Py_CLEAR(clear_module_state->__pyx_codeobj__45); return 0; } #endif @@ -3046,7 +3097,11 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_type_4ssh2_11sftp_handle___pyx_scope_struct__readdir_ex); Py_VISIT(traverse_module_state->__pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct_1_readdir); Py_VISIT(traverse_module_state->__pyx_type_4ssh2_11sftp_handle___pyx_scope_struct_1_readdir); + Py_VISIT(traverse_module_state->__pyx_n_s_Generator); + Py_VISIT(traverse_module_state->__pyx_kp_s_Generator_Tuple_int_bytes_SFTPAt); + Py_VISIT(traverse_module_state->__pyx_kp_s_Generator_Tuple_int_bytes_bytes); Py_VISIT(traverse_module_state->__pyx_n_s_MemoryError); + Py_VISIT(traverse_module_state->__pyx_n_s_None); Py_VISIT(traverse_module_state->__pyx_n_s_SFTPAttributes); Py_VISIT(traverse_module_state->__pyx_n_s_SFTPAttributes___reduce_cython); Py_VISIT(traverse_module_state->__pyx_n_s_SFTPAttributes___setstate_cython); @@ -3076,9 +3131,12 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_SFTPStatVFS___reduce_cython); Py_VISIT(traverse_module_state->__pyx_n_s_SFTPStatVFS___setstate_cython); Py_VISIT(traverse_module_state->__pyx_n_s_StopIteration); + Py_VISIT(traverse_module_state->__pyx_n_s_Tuple); + Py_VISIT(traverse_module_state->__pyx_kp_s_Tuple_int_bytes); Py_VISIT(traverse_module_state->__pyx_n_s_TypeError); Py_VISIT(traverse_module_state->__pyx_kp_b__2); - Py_VISIT(traverse_module_state->__pyx_n_s__45); + Py_VISIT(traverse_module_state->__pyx_n_s__46); + Py_VISIT(traverse_module_state->__pyx_kp_u__5); Py_VISIT(traverse_module_state->__pyx_n_s_args); Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); Py_VISIT(traverse_module_state->__pyx_n_s_attrs); @@ -3102,6 +3160,8 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_fsync); Py_VISIT(traverse_module_state->__pyx_kp_u_gc); Py_VISIT(traverse_module_state->__pyx_n_s_getstate); + Py_VISIT(traverse_module_state->__pyx_n_s_import); + Py_VISIT(traverse_module_state->__pyx_n_s_int); Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled); Py_VISIT(traverse_module_state->__pyx_n_s_longentry); @@ -3120,6 +3180,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_reduce); Py_VISIT(traverse_module_state->__pyx_n_s_reduce_cython); Py_VISIT(traverse_module_state->__pyx_n_s_reduce_ex); + Py_VISIT(traverse_module_state->__pyx_n_s_return); Py_VISIT(traverse_module_state->__pyx_n_s_rewind); Py_VISIT(traverse_module_state->__pyx_n_s_seek); Py_VISIT(traverse_module_state->__pyx_n_s_seek64); @@ -3139,52 +3200,53 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_test); Py_VISIT(traverse_module_state->__pyx_n_s_throw); Py_VISIT(traverse_module_state->__pyx_n_s_tot_size); + Py_VISIT(traverse_module_state->__pyx_n_s_typing); Py_VISIT(traverse_module_state->__pyx_n_s_vfs); Py_VISIT(traverse_module_state->__pyx_n_s_write); Py_VISIT(traverse_module_state->__pyx_int_0); Py_VISIT(traverse_module_state->__pyx_int_1024); - Py_VISIT(traverse_module_state->__pyx_tuple__5); - Py_VISIT(traverse_module_state->__pyx_tuple__7); - Py_VISIT(traverse_module_state->__pyx_tuple__10); - Py_VISIT(traverse_module_state->__pyx_tuple__12); - Py_VISIT(traverse_module_state->__pyx_tuple__14); - Py_VISIT(traverse_module_state->__pyx_tuple__16); + Py_VISIT(traverse_module_state->__pyx_tuple__6); + Py_VISIT(traverse_module_state->__pyx_tuple__8); + Py_VISIT(traverse_module_state->__pyx_tuple__11); + Py_VISIT(traverse_module_state->__pyx_tuple__13); + Py_VISIT(traverse_module_state->__pyx_tuple__15); Py_VISIT(traverse_module_state->__pyx_tuple__17); Py_VISIT(traverse_module_state->__pyx_tuple__18); - Py_VISIT(traverse_module_state->__pyx_tuple__20); + Py_VISIT(traverse_module_state->__pyx_tuple__19); Py_VISIT(traverse_module_state->__pyx_tuple__21); Py_VISIT(traverse_module_state->__pyx_tuple__22); - Py_VISIT(traverse_module_state->__pyx_tuple__24); - Py_VISIT(traverse_module_state->__pyx_tuple__27); - Py_VISIT(traverse_module_state->__pyx_tuple__33); - Py_VISIT(traverse_module_state->__pyx_tuple__35); - Py_VISIT(traverse_module_state->__pyx_tuple__37); - Py_VISIT(traverse_module_state->__pyx_tuple__39); + Py_VISIT(traverse_module_state->__pyx_tuple__23); + Py_VISIT(traverse_module_state->__pyx_tuple__25); + Py_VISIT(traverse_module_state->__pyx_tuple__28); + Py_VISIT(traverse_module_state->__pyx_tuple__34); + Py_VISIT(traverse_module_state->__pyx_tuple__36); + Py_VISIT(traverse_module_state->__pyx_tuple__38); + Py_VISIT(traverse_module_state->__pyx_tuple__40); Py_VISIT(traverse_module_state->__pyx_codeobj__3); Py_VISIT(traverse_module_state->__pyx_codeobj__4); - Py_VISIT(traverse_module_state->__pyx_codeobj__6); - Py_VISIT(traverse_module_state->__pyx_codeobj__8); + Py_VISIT(traverse_module_state->__pyx_codeobj__7); Py_VISIT(traverse_module_state->__pyx_codeobj__9); - Py_VISIT(traverse_module_state->__pyx_codeobj__11); - Py_VISIT(traverse_module_state->__pyx_codeobj__13); - Py_VISIT(traverse_module_state->__pyx_codeobj__15); - Py_VISIT(traverse_module_state->__pyx_codeobj__19); - Py_VISIT(traverse_module_state->__pyx_codeobj__23); - Py_VISIT(traverse_module_state->__pyx_codeobj__25); + Py_VISIT(traverse_module_state->__pyx_codeobj__10); + Py_VISIT(traverse_module_state->__pyx_codeobj__12); + Py_VISIT(traverse_module_state->__pyx_codeobj__14); + Py_VISIT(traverse_module_state->__pyx_codeobj__16); + Py_VISIT(traverse_module_state->__pyx_codeobj__20); + Py_VISIT(traverse_module_state->__pyx_codeobj__24); Py_VISIT(traverse_module_state->__pyx_codeobj__26); - Py_VISIT(traverse_module_state->__pyx_codeobj__28); + Py_VISIT(traverse_module_state->__pyx_codeobj__27); Py_VISIT(traverse_module_state->__pyx_codeobj__29); Py_VISIT(traverse_module_state->__pyx_codeobj__30); Py_VISIT(traverse_module_state->__pyx_codeobj__31); Py_VISIT(traverse_module_state->__pyx_codeobj__32); - Py_VISIT(traverse_module_state->__pyx_codeobj__34); - Py_VISIT(traverse_module_state->__pyx_codeobj__36); - Py_VISIT(traverse_module_state->__pyx_codeobj__38); - Py_VISIT(traverse_module_state->__pyx_codeobj__40); + Py_VISIT(traverse_module_state->__pyx_codeobj__33); + Py_VISIT(traverse_module_state->__pyx_codeobj__35); + Py_VISIT(traverse_module_state->__pyx_codeobj__37); + Py_VISIT(traverse_module_state->__pyx_codeobj__39); Py_VISIT(traverse_module_state->__pyx_codeobj__41); Py_VISIT(traverse_module_state->__pyx_codeobj__42); Py_VISIT(traverse_module_state->__pyx_codeobj__43); Py_VISIT(traverse_module_state->__pyx_codeobj__44); + Py_VISIT(traverse_module_state->__pyx_codeobj__45); return 0; } #endif @@ -3250,7 +3312,11 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_ptype_4ssh2_11sftp_handle_SFTPStatVFS __pyx_mstate_global->__pyx_ptype_4ssh2_11sftp_handle_SFTPStatVFS #define __pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct__readdir_ex __pyx_mstate_global->__pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct__readdir_ex #define __pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct_1_readdir __pyx_mstate_global->__pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct_1_readdir +#define __pyx_n_s_Generator __pyx_mstate_global->__pyx_n_s_Generator +#define __pyx_kp_s_Generator_Tuple_int_bytes_SFTPAt __pyx_mstate_global->__pyx_kp_s_Generator_Tuple_int_bytes_SFTPAt +#define __pyx_kp_s_Generator_Tuple_int_bytes_bytes __pyx_mstate_global->__pyx_kp_s_Generator_Tuple_int_bytes_bytes #define __pyx_n_s_MemoryError __pyx_mstate_global->__pyx_n_s_MemoryError +#define __pyx_n_s_None __pyx_mstate_global->__pyx_n_s_None #define __pyx_n_s_SFTPAttributes __pyx_mstate_global->__pyx_n_s_SFTPAttributes #define __pyx_n_s_SFTPAttributes___reduce_cython __pyx_mstate_global->__pyx_n_s_SFTPAttributes___reduce_cython #define __pyx_n_s_SFTPAttributes___setstate_cython __pyx_mstate_global->__pyx_n_s_SFTPAttributes___setstate_cython @@ -3280,9 +3346,12 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_SFTPStatVFS___reduce_cython __pyx_mstate_global->__pyx_n_s_SFTPStatVFS___reduce_cython #define __pyx_n_s_SFTPStatVFS___setstate_cython __pyx_mstate_global->__pyx_n_s_SFTPStatVFS___setstate_cython #define __pyx_n_s_StopIteration __pyx_mstate_global->__pyx_n_s_StopIteration +#define __pyx_n_s_Tuple __pyx_mstate_global->__pyx_n_s_Tuple +#define __pyx_kp_s_Tuple_int_bytes __pyx_mstate_global->__pyx_kp_s_Tuple_int_bytes #define __pyx_n_s_TypeError __pyx_mstate_global->__pyx_n_s_TypeError #define __pyx_kp_b__2 __pyx_mstate_global->__pyx_kp_b__2 -#define __pyx_n_s__45 __pyx_mstate_global->__pyx_n_s__45 +#define __pyx_n_s__46 __pyx_mstate_global->__pyx_n_s__46 +#define __pyx_kp_u__5 __pyx_mstate_global->__pyx_kp_u__5 #define __pyx_n_s_args __pyx_mstate_global->__pyx_n_s_args #define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines #define __pyx_n_s_attrs __pyx_mstate_global->__pyx_n_s_attrs @@ -3306,6 +3375,8 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_fsync __pyx_mstate_global->__pyx_n_s_fsync #define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc #define __pyx_n_s_getstate __pyx_mstate_global->__pyx_n_s_getstate +#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import +#define __pyx_n_s_int __pyx_mstate_global->__pyx_n_s_int #define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine #define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled #define __pyx_n_s_longentry __pyx_mstate_global->__pyx_n_s_longentry @@ -3324,6 +3395,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_reduce __pyx_mstate_global->__pyx_n_s_reduce #define __pyx_n_s_reduce_cython __pyx_mstate_global->__pyx_n_s_reduce_cython #define __pyx_n_s_reduce_ex __pyx_mstate_global->__pyx_n_s_reduce_ex +#define __pyx_n_s_return __pyx_mstate_global->__pyx_n_s_return #define __pyx_n_s_rewind __pyx_mstate_global->__pyx_n_s_rewind #define __pyx_n_s_seek __pyx_mstate_global->__pyx_n_s_seek #define __pyx_n_s_seek64 __pyx_mstate_global->__pyx_n_s_seek64 @@ -3343,56 +3415,57 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test #define __pyx_n_s_throw __pyx_mstate_global->__pyx_n_s_throw #define __pyx_n_s_tot_size __pyx_mstate_global->__pyx_n_s_tot_size +#define __pyx_n_s_typing __pyx_mstate_global->__pyx_n_s_typing #define __pyx_n_s_vfs __pyx_mstate_global->__pyx_n_s_vfs #define __pyx_n_s_write __pyx_mstate_global->__pyx_n_s_write #define __pyx_int_0 __pyx_mstate_global->__pyx_int_0 #define __pyx_int_1024 __pyx_mstate_global->__pyx_int_1024 #define __pyx_k_ __pyx_mstate_global->__pyx_k_ -#define __pyx_tuple__5 __pyx_mstate_global->__pyx_tuple__5 -#define __pyx_tuple__7 __pyx_mstate_global->__pyx_tuple__7 -#define __pyx_tuple__10 __pyx_mstate_global->__pyx_tuple__10 -#define __pyx_tuple__12 __pyx_mstate_global->__pyx_tuple__12 -#define __pyx_tuple__14 __pyx_mstate_global->__pyx_tuple__14 -#define __pyx_tuple__16 __pyx_mstate_global->__pyx_tuple__16 +#define __pyx_tuple__6 __pyx_mstate_global->__pyx_tuple__6 +#define __pyx_tuple__8 __pyx_mstate_global->__pyx_tuple__8 +#define __pyx_tuple__11 __pyx_mstate_global->__pyx_tuple__11 +#define __pyx_tuple__13 __pyx_mstate_global->__pyx_tuple__13 +#define __pyx_tuple__15 __pyx_mstate_global->__pyx_tuple__15 #define __pyx_tuple__17 __pyx_mstate_global->__pyx_tuple__17 #define __pyx_tuple__18 __pyx_mstate_global->__pyx_tuple__18 -#define __pyx_tuple__20 __pyx_mstate_global->__pyx_tuple__20 +#define __pyx_tuple__19 __pyx_mstate_global->__pyx_tuple__19 #define __pyx_tuple__21 __pyx_mstate_global->__pyx_tuple__21 #define __pyx_tuple__22 __pyx_mstate_global->__pyx_tuple__22 -#define __pyx_tuple__24 __pyx_mstate_global->__pyx_tuple__24 -#define __pyx_tuple__27 __pyx_mstate_global->__pyx_tuple__27 -#define __pyx_tuple__33 __pyx_mstate_global->__pyx_tuple__33 -#define __pyx_tuple__35 __pyx_mstate_global->__pyx_tuple__35 -#define __pyx_tuple__37 __pyx_mstate_global->__pyx_tuple__37 -#define __pyx_tuple__39 __pyx_mstate_global->__pyx_tuple__39 +#define __pyx_tuple__23 __pyx_mstate_global->__pyx_tuple__23 +#define __pyx_tuple__25 __pyx_mstate_global->__pyx_tuple__25 +#define __pyx_tuple__28 __pyx_mstate_global->__pyx_tuple__28 +#define __pyx_tuple__34 __pyx_mstate_global->__pyx_tuple__34 +#define __pyx_tuple__36 __pyx_mstate_global->__pyx_tuple__36 +#define __pyx_tuple__38 __pyx_mstate_global->__pyx_tuple__38 +#define __pyx_tuple__40 __pyx_mstate_global->__pyx_tuple__40 #define __pyx_codeobj__3 __pyx_mstate_global->__pyx_codeobj__3 #define __pyx_codeobj__4 __pyx_mstate_global->__pyx_codeobj__4 -#define __pyx_codeobj__6 __pyx_mstate_global->__pyx_codeobj__6 -#define __pyx_codeobj__8 __pyx_mstate_global->__pyx_codeobj__8 +#define __pyx_codeobj__7 __pyx_mstate_global->__pyx_codeobj__7 #define __pyx_codeobj__9 __pyx_mstate_global->__pyx_codeobj__9 -#define __pyx_codeobj__11 __pyx_mstate_global->__pyx_codeobj__11 -#define __pyx_codeobj__13 __pyx_mstate_global->__pyx_codeobj__13 -#define __pyx_codeobj__15 __pyx_mstate_global->__pyx_codeobj__15 -#define __pyx_codeobj__19 __pyx_mstate_global->__pyx_codeobj__19 -#define __pyx_codeobj__23 __pyx_mstate_global->__pyx_codeobj__23 -#define __pyx_codeobj__25 __pyx_mstate_global->__pyx_codeobj__25 +#define __pyx_codeobj__10 __pyx_mstate_global->__pyx_codeobj__10 +#define __pyx_codeobj__12 __pyx_mstate_global->__pyx_codeobj__12 +#define __pyx_codeobj__14 __pyx_mstate_global->__pyx_codeobj__14 +#define __pyx_codeobj__16 __pyx_mstate_global->__pyx_codeobj__16 +#define __pyx_codeobj__20 __pyx_mstate_global->__pyx_codeobj__20 +#define __pyx_codeobj__24 __pyx_mstate_global->__pyx_codeobj__24 #define __pyx_codeobj__26 __pyx_mstate_global->__pyx_codeobj__26 -#define __pyx_codeobj__28 __pyx_mstate_global->__pyx_codeobj__28 +#define __pyx_codeobj__27 __pyx_mstate_global->__pyx_codeobj__27 #define __pyx_codeobj__29 __pyx_mstate_global->__pyx_codeobj__29 #define __pyx_codeobj__30 __pyx_mstate_global->__pyx_codeobj__30 #define __pyx_codeobj__31 __pyx_mstate_global->__pyx_codeobj__31 #define __pyx_codeobj__32 __pyx_mstate_global->__pyx_codeobj__32 -#define __pyx_codeobj__34 __pyx_mstate_global->__pyx_codeobj__34 -#define __pyx_codeobj__36 __pyx_mstate_global->__pyx_codeobj__36 -#define __pyx_codeobj__38 __pyx_mstate_global->__pyx_codeobj__38 -#define __pyx_codeobj__40 __pyx_mstate_global->__pyx_codeobj__40 +#define __pyx_codeobj__33 __pyx_mstate_global->__pyx_codeobj__33 +#define __pyx_codeobj__35 __pyx_mstate_global->__pyx_codeobj__35 +#define __pyx_codeobj__37 __pyx_mstate_global->__pyx_codeobj__37 +#define __pyx_codeobj__39 __pyx_mstate_global->__pyx_codeobj__39 #define __pyx_codeobj__41 __pyx_mstate_global->__pyx_codeobj__41 #define __pyx_codeobj__42 __pyx_mstate_global->__pyx_codeobj__42 #define __pyx_codeobj__43 __pyx_mstate_global->__pyx_codeobj__43 #define __pyx_codeobj__44 __pyx_mstate_global->__pyx_codeobj__44 +#define __pyx_codeobj__45 __pyx_mstate_global->__pyx_codeobj__45 /* #### Code section: module_code ### */ -/* "ssh2/sftp_handle.pyx":27 +/* "ssh2/sftp_handle.pyx":29 * * * cdef object PySFTPHandle(c_sftp.LIBSSH2_SFTP_HANDLE *handle, SFTP sftp): # <<<<<<<<<<<<<< @@ -3411,25 +3484,25 @@ static PyObject *__pyx_f_4ssh2_11sftp_handle_PySFTPHandle(LIBSSH2_SFTP_HANDLE *_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PySFTPHandle", 1); - /* "ssh2/sftp_handle.pyx":28 + /* "ssh2/sftp_handle.pyx":30 * * cdef object PySFTPHandle(c_sftp.LIBSSH2_SFTP_HANDLE *handle, SFTP sftp): * cdef SFTPHandle _handle = SFTPHandle.__new__(SFTPHandle, sftp) # <<<<<<<<<<<<<< * _handle._handle = handle * return _handle */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF((PyObject *)__pyx_v_sftp); __Pyx_GIVEREF((PyObject *)__pyx_v_sftp); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_sftp))) __PYX_ERR(0, 28, __pyx_L1_error); - __pyx_t_2 = ((PyObject *)__pyx_tp_new_4ssh2_11sftp_handle_SFTPHandle(((PyTypeObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle), __pyx_t_1, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error) + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_sftp))) __PYX_ERR(0, 30, __pyx_L1_error); + __pyx_t_2 = ((PyObject *)__pyx_tp_new_4ssh2_11sftp_handle_SFTPHandle(((PyTypeObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle), __pyx_t_1, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF((PyObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v__handle = ((struct __pyx_obj_4ssh2_11sftp_handle_SFTPHandle *)__pyx_t_2); __pyx_t_2 = 0; - /* "ssh2/sftp_handle.pyx":29 + /* "ssh2/sftp_handle.pyx":31 * cdef object PySFTPHandle(c_sftp.LIBSSH2_SFTP_HANDLE *handle, SFTP sftp): * cdef SFTPHandle _handle = SFTPHandle.__new__(SFTPHandle, sftp) * _handle._handle = handle # <<<<<<<<<<<<<< @@ -3438,7 +3511,7 @@ static PyObject *__pyx_f_4ssh2_11sftp_handle_PySFTPHandle(LIBSSH2_SFTP_HANDLE *_ */ __pyx_v__handle->_handle = __pyx_v_handle; - /* "ssh2/sftp_handle.pyx":30 + /* "ssh2/sftp_handle.pyx":32 * cdef SFTPHandle _handle = SFTPHandle.__new__(SFTPHandle, sftp) * _handle._handle = handle * return _handle # <<<<<<<<<<<<<< @@ -3450,7 +3523,7 @@ static PyObject *__pyx_f_4ssh2_11sftp_handle_PySFTPHandle(LIBSSH2_SFTP_HANDLE *_ __pyx_r = ((PyObject *)__pyx_v__handle); goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":27 + /* "ssh2/sftp_handle.pyx":29 * * * cdef object PySFTPHandle(c_sftp.LIBSSH2_SFTP_HANDLE *handle, SFTP sftp): # <<<<<<<<<<<<<< @@ -3471,7 +3544,7 @@ static PyObject *__pyx_f_4ssh2_11sftp_handle_PySFTPHandle(LIBSSH2_SFTP_HANDLE *_ return __pyx_r; } -/* "ssh2/sftp_handle.pyx":35 +/* "ssh2/sftp_handle.pyx":37 * cdef class SFTPAttributes: * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -3510,7 +3583,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes___cinit__(struct __pyx_ const char *__pyx_filename = NULL; int __pyx_clineno = 0; - /* "ssh2/sftp_handle.pyx":36 + /* "ssh2/sftp_handle.pyx":38 * * def __cinit__(self): * with nogil: # <<<<<<<<<<<<<< @@ -3526,7 +3599,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes___cinit__(struct __pyx_ #endif /*try:*/ { - /* "ssh2/sftp_handle.pyx":37 + /* "ssh2/sftp_handle.pyx":39 * def __cinit__(self): * with nogil: * self._attrs = malloc( # <<<<<<<<<<<<<< @@ -3535,7 +3608,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes___cinit__(struct __pyx_ */ __pyx_v_self->_attrs = ((LIBSSH2_SFTP_ATTRIBUTES *)malloc((sizeof(LIBSSH2_SFTP_ATTRIBUTES)))); - /* "ssh2/sftp_handle.pyx":39 + /* "ssh2/sftp_handle.pyx":41 * self._attrs = malloc( * sizeof(c_sftp.LIBSSH2_SFTP_ATTRIBUTES)) * if self._attrs is NULL: # <<<<<<<<<<<<<< @@ -3545,7 +3618,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes___cinit__(struct __pyx_ __pyx_t_1 = (__pyx_v_self->_attrs == NULL); if (unlikely(__pyx_t_1)) { - /* "ssh2/sftp_handle.pyx":40 + /* "ssh2/sftp_handle.pyx":42 * sizeof(c_sftp.LIBSSH2_SFTP_ATTRIBUTES)) * if self._attrs is NULL: * with gil: # <<<<<<<<<<<<<< @@ -3558,17 +3631,17 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes___cinit__(struct __pyx_ #endif /*try:*/ { - /* "ssh2/sftp_handle.pyx":41 + /* "ssh2/sftp_handle.pyx":43 * if self._attrs is NULL: * with gil: * raise MemoryError # <<<<<<<<<<<<<< * self._attrs.flags = 0 * self._attrs.filesize = 0 */ - PyErr_NoMemory(); __PYX_ERR(0, 41, __pyx_L8_error) + PyErr_NoMemory(); __PYX_ERR(0, 43, __pyx_L8_error) } - /* "ssh2/sftp_handle.pyx":40 + /* "ssh2/sftp_handle.pyx":42 * sizeof(c_sftp.LIBSSH2_SFTP_ATTRIBUTES)) * if self._attrs is NULL: * with gil: # <<<<<<<<<<<<<< @@ -3585,7 +3658,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes___cinit__(struct __pyx_ } } - /* "ssh2/sftp_handle.pyx":39 + /* "ssh2/sftp_handle.pyx":41 * self._attrs = malloc( * sizeof(c_sftp.LIBSSH2_SFTP_ATTRIBUTES)) * if self._attrs is NULL: # <<<<<<<<<<<<<< @@ -3594,7 +3667,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes___cinit__(struct __pyx_ */ } - /* "ssh2/sftp_handle.pyx":42 + /* "ssh2/sftp_handle.pyx":44 * with gil: * raise MemoryError * self._attrs.flags = 0 # <<<<<<<<<<<<<< @@ -3603,7 +3676,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes___cinit__(struct __pyx_ */ __pyx_v_self->_attrs->flags = 0; - /* "ssh2/sftp_handle.pyx":43 + /* "ssh2/sftp_handle.pyx":45 * raise MemoryError * self._attrs.flags = 0 * self._attrs.filesize = 0 # <<<<<<<<<<<<<< @@ -3612,7 +3685,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes___cinit__(struct __pyx_ */ __pyx_v_self->_attrs->filesize = 0; - /* "ssh2/sftp_handle.pyx":44 + /* "ssh2/sftp_handle.pyx":46 * self._attrs.flags = 0 * self._attrs.filesize = 0 * self._attrs.uid = 0 # <<<<<<<<<<<<<< @@ -3621,7 +3694,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes___cinit__(struct __pyx_ */ __pyx_v_self->_attrs->uid = 0; - /* "ssh2/sftp_handle.pyx":45 + /* "ssh2/sftp_handle.pyx":47 * self._attrs.filesize = 0 * self._attrs.uid = 0 * self._attrs.gid = 0 # <<<<<<<<<<<<<< @@ -3630,7 +3703,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes___cinit__(struct __pyx_ */ __pyx_v_self->_attrs->gid = 0; - /* "ssh2/sftp_handle.pyx":46 + /* "ssh2/sftp_handle.pyx":48 * self._attrs.uid = 0 * self._attrs.gid = 0 * self._attrs.permissions = 0 # <<<<<<<<<<<<<< @@ -3639,7 +3712,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes___cinit__(struct __pyx_ */ __pyx_v_self->_attrs->permissions = 0; - /* "ssh2/sftp_handle.pyx":47 + /* "ssh2/sftp_handle.pyx":49 * self._attrs.gid = 0 * self._attrs.permissions = 0 * self._attrs.atime = 0 # <<<<<<<<<<<<<< @@ -3648,7 +3721,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes___cinit__(struct __pyx_ */ __pyx_v_self->_attrs->atime = 0; - /* "ssh2/sftp_handle.pyx":48 + /* "ssh2/sftp_handle.pyx":50 * self._attrs.permissions = 0 * self._attrs.atime = 0 * self._attrs.mtime = 0 # <<<<<<<<<<<<<< @@ -3658,7 +3731,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes___cinit__(struct __pyx_ __pyx_v_self->_attrs->mtime = 0; } - /* "ssh2/sftp_handle.pyx":36 + /* "ssh2/sftp_handle.pyx":38 * * def __cinit__(self): * with nogil: # <<<<<<<<<<<<<< @@ -3684,7 +3757,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes___cinit__(struct __pyx_ } } - /* "ssh2/sftp_handle.pyx":35 + /* "ssh2/sftp_handle.pyx":37 * cdef class SFTPAttributes: * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -3702,7 +3775,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes___cinit__(struct __pyx_ return __pyx_r; } -/* "ssh2/sftp_handle.pyx":50 +/* "ssh2/sftp_handle.pyx":52 * self._attrs.mtime = 0 * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -3725,7 +3798,7 @@ static void __pyx_pw_4ssh2_11sftp_handle_14SFTPAttributes_3__dealloc__(PyObject static void __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_2__dealloc__(struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes *__pyx_v_self) { - /* "ssh2/sftp_handle.pyx":51 + /* "ssh2/sftp_handle.pyx":53 * * def __dealloc__(self): * with nogil: # <<<<<<<<<<<<<< @@ -3741,7 +3814,7 @@ static void __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_2__dealloc__(struct __ #endif /*try:*/ { - /* "ssh2/sftp_handle.pyx":52 + /* "ssh2/sftp_handle.pyx":54 * def __dealloc__(self): * with nogil: * free(self._attrs) # <<<<<<<<<<<<<< @@ -3751,7 +3824,7 @@ static void __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_2__dealloc__(struct __ free(__pyx_v_self->_attrs); } - /* "ssh2/sftp_handle.pyx":51 + /* "ssh2/sftp_handle.pyx":53 * * def __dealloc__(self): * with nogil: # <<<<<<<<<<<<<< @@ -3770,7 +3843,7 @@ static void __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_2__dealloc__(struct __ } } - /* "ssh2/sftp_handle.pyx":50 + /* "ssh2/sftp_handle.pyx":52 * self._attrs.mtime = 0 * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -3781,11 +3854,11 @@ static void __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_2__dealloc__(struct __ /* function exit code */ } -/* "ssh2/sftp_handle.pyx":54 +/* "ssh2/sftp_handle.pyx":56 * free(self._attrs) * * @property # <<<<<<<<<<<<<< - * def flags(self): + * def flags(self) -> int: * return self._attrs.flags */ @@ -3813,25 +3886,25 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_5flags___get__(st int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 1); - /* "ssh2/sftp_handle.pyx":56 + /* "ssh2/sftp_handle.pyx":58 * @property - * def flags(self): + * def flags(self) -> int: * return self._attrs.flags # <<<<<<<<<<<<<< * * @flags.setter */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->_attrs->flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->_attrs->flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":54 + /* "ssh2/sftp_handle.pyx":56 * free(self._attrs) * * @property # <<<<<<<<<<<<<< - * def flags(self): + * def flags(self) -> int: * return self._attrs.flags */ @@ -3846,7 +3919,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_5flags___get__(st return __pyx_r; } -/* "ssh2/sftp_handle.pyx":58 +/* "ssh2/sftp_handle.pyx":60 * return self._attrs.flags * * @flags.setter # <<<<<<<<<<<<<< @@ -3867,7 +3940,7 @@ static int __pyx_pw_4ssh2_11sftp_handle_14SFTPAttributes_5flags_3__set__(PyObjec __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); assert(__pyx_arg_flags); { - __pyx_v_flags = __Pyx_PyInt_As_unsigned_long(__pyx_arg_flags); if (unlikely((__pyx_v_flags == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error) + __pyx_v_flags = __Pyx_PyInt_As_unsigned_long(__pyx_arg_flags); if (unlikely((__pyx_v_flags == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 61, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3885,7 +3958,7 @@ static int __pyx_pw_4ssh2_11sftp_handle_14SFTPAttributes_5flags_3__set__(PyObjec static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_5flags_2__set__(struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes *__pyx_v_self, unsigned long __pyx_v_flags) { int __pyx_r; - /* "ssh2/sftp_handle.pyx":60 + /* "ssh2/sftp_handle.pyx":62 * @flags.setter * def flags(self, unsigned long flags): * self._attrs.flags = flags # <<<<<<<<<<<<<< @@ -3894,7 +3967,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_5flags_2__set__(struct */ __pyx_v_self->_attrs->flags = __pyx_v_flags; - /* "ssh2/sftp_handle.pyx":58 + /* "ssh2/sftp_handle.pyx":60 * return self._attrs.flags * * @flags.setter # <<<<<<<<<<<<<< @@ -3907,11 +3980,11 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_5flags_2__set__(struct return __pyx_r; } -/* "ssh2/sftp_handle.pyx":62 +/* "ssh2/sftp_handle.pyx":64 * self._attrs.flags = flags * * @property # <<<<<<<<<<<<<< - * def filesize(self): + * def filesize(self) -> int: * return self._attrs.filesize */ @@ -3939,25 +4012,25 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_8filesize___get__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 1); - /* "ssh2/sftp_handle.pyx":64 + /* "ssh2/sftp_handle.pyx":66 * @property - * def filesize(self): + * def filesize(self) -> int: * return self._attrs.filesize # <<<<<<<<<<<<<< * * @filesize.setter */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_libssh2_uint64_t(__pyx_v_self->_attrs->filesize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_libssh2_uint64_t(__pyx_v_self->_attrs->filesize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":62 + /* "ssh2/sftp_handle.pyx":64 * self._attrs.flags = flags * * @property # <<<<<<<<<<<<<< - * def filesize(self): + * def filesize(self) -> int: * return self._attrs.filesize */ @@ -3972,7 +4045,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_8filesize___get__ return __pyx_r; } -/* "ssh2/sftp_handle.pyx":66 +/* "ssh2/sftp_handle.pyx":68 * return self._attrs.filesize * * @filesize.setter # <<<<<<<<<<<<<< @@ -3993,7 +4066,7 @@ static int __pyx_pw_4ssh2_11sftp_handle_14SFTPAttributes_8filesize_3__set__(PyOb __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); assert(__pyx_arg_filesize); { - __pyx_v_filesize = __Pyx_PyInt_As_libssh2_uint64_t(__pyx_arg_filesize); if (unlikely((__pyx_v_filesize == ((libssh2_uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 67, __pyx_L3_error) + __pyx_v_filesize = __Pyx_PyInt_As_libssh2_uint64_t(__pyx_arg_filesize); if (unlikely((__pyx_v_filesize == ((libssh2_uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -4011,7 +4084,7 @@ static int __pyx_pw_4ssh2_11sftp_handle_14SFTPAttributes_8filesize_3__set__(PyOb static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_8filesize_2__set__(struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes *__pyx_v_self, libssh2_uint64_t __pyx_v_filesize) { int __pyx_r; - /* "ssh2/sftp_handle.pyx":68 + /* "ssh2/sftp_handle.pyx":70 * @filesize.setter * def filesize(self, c_ssh2.libssh2_uint64_t filesize): * self._attrs.filesize = filesize # <<<<<<<<<<<<<< @@ -4020,7 +4093,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_8filesize_2__set__(stru */ __pyx_v_self->_attrs->filesize = __pyx_v_filesize; - /* "ssh2/sftp_handle.pyx":66 + /* "ssh2/sftp_handle.pyx":68 * return self._attrs.filesize * * @filesize.setter # <<<<<<<<<<<<<< @@ -4033,11 +4106,11 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_8filesize_2__set__(stru return __pyx_r; } -/* "ssh2/sftp_handle.pyx":70 +/* "ssh2/sftp_handle.pyx":72 * self._attrs.filesize = filesize * * @property # <<<<<<<<<<<<<< - * def uid(self): + * def uid(self) -> int: * return self._attrs.uid */ @@ -4065,25 +4138,25 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_3uid___get__(stru int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 1); - /* "ssh2/sftp_handle.pyx":72 + /* "ssh2/sftp_handle.pyx":74 * @property - * def uid(self): + * def uid(self) -> int: * return self._attrs.uid # <<<<<<<<<<<<<< * * @uid.setter */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->_attrs->uid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->_attrs->uid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":70 + /* "ssh2/sftp_handle.pyx":72 * self._attrs.filesize = filesize * * @property # <<<<<<<<<<<<<< - * def uid(self): + * def uid(self) -> int: * return self._attrs.uid */ @@ -4098,7 +4171,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_3uid___get__(stru return __pyx_r; } -/* "ssh2/sftp_handle.pyx":74 +/* "ssh2/sftp_handle.pyx":76 * return self._attrs.uid * * @uid.setter # <<<<<<<<<<<<<< @@ -4119,7 +4192,7 @@ static int __pyx_pw_4ssh2_11sftp_handle_14SFTPAttributes_3uid_3__set__(PyObject __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); assert(__pyx_arg_uid); { - __pyx_v_uid = __Pyx_PyInt_As_unsigned_long(__pyx_arg_uid); if (unlikely((__pyx_v_uid == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 75, __pyx_L3_error) + __pyx_v_uid = __Pyx_PyInt_As_unsigned_long(__pyx_arg_uid); if (unlikely((__pyx_v_uid == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 77, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -4137,7 +4210,7 @@ static int __pyx_pw_4ssh2_11sftp_handle_14SFTPAttributes_3uid_3__set__(PyObject static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_3uid_2__set__(struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes *__pyx_v_self, unsigned long __pyx_v_uid) { int __pyx_r; - /* "ssh2/sftp_handle.pyx":76 + /* "ssh2/sftp_handle.pyx":78 * @uid.setter * def uid(self, unsigned long uid): * self._attrs.uid = uid # <<<<<<<<<<<<<< @@ -4146,7 +4219,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_3uid_2__set__(struct __ */ __pyx_v_self->_attrs->uid = __pyx_v_uid; - /* "ssh2/sftp_handle.pyx":74 + /* "ssh2/sftp_handle.pyx":76 * return self._attrs.uid * * @uid.setter # <<<<<<<<<<<<<< @@ -4159,11 +4232,11 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_3uid_2__set__(struct __ return __pyx_r; } -/* "ssh2/sftp_handle.pyx":78 +/* "ssh2/sftp_handle.pyx":80 * self._attrs.uid = uid * * @property # <<<<<<<<<<<<<< - * def gid(self): + * def gid(self) -> int: * return self._attrs.gid */ @@ -4191,25 +4264,25 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_3gid___get__(stru int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 1); - /* "ssh2/sftp_handle.pyx":80 + /* "ssh2/sftp_handle.pyx":82 * @property - * def gid(self): + * def gid(self) -> int: * return self._attrs.gid # <<<<<<<<<<<<<< * * @gid.setter */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->_attrs->gid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->_attrs->gid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":78 + /* "ssh2/sftp_handle.pyx":80 * self._attrs.uid = uid * * @property # <<<<<<<<<<<<<< - * def gid(self): + * def gid(self) -> int: * return self._attrs.gid */ @@ -4224,7 +4297,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_3gid___get__(stru return __pyx_r; } -/* "ssh2/sftp_handle.pyx":82 +/* "ssh2/sftp_handle.pyx":84 * return self._attrs.gid * * @gid.setter # <<<<<<<<<<<<<< @@ -4245,7 +4318,7 @@ static int __pyx_pw_4ssh2_11sftp_handle_14SFTPAttributes_3gid_3__set__(PyObject __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); assert(__pyx_arg_gid); { - __pyx_v_gid = __Pyx_PyInt_As_unsigned_long(__pyx_arg_gid); if (unlikely((__pyx_v_gid == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 83, __pyx_L3_error) + __pyx_v_gid = __Pyx_PyInt_As_unsigned_long(__pyx_arg_gid); if (unlikely((__pyx_v_gid == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 85, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -4263,7 +4336,7 @@ static int __pyx_pw_4ssh2_11sftp_handle_14SFTPAttributes_3gid_3__set__(PyObject static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_3gid_2__set__(struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes *__pyx_v_self, unsigned long __pyx_v_gid) { int __pyx_r; - /* "ssh2/sftp_handle.pyx":84 + /* "ssh2/sftp_handle.pyx":86 * @gid.setter * def gid(self, unsigned long gid): * self._attrs.gid = gid # <<<<<<<<<<<<<< @@ -4272,7 +4345,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_3gid_2__set__(struct __ */ __pyx_v_self->_attrs->gid = __pyx_v_gid; - /* "ssh2/sftp_handle.pyx":82 + /* "ssh2/sftp_handle.pyx":84 * return self._attrs.gid * * @gid.setter # <<<<<<<<<<<<<< @@ -4285,11 +4358,11 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_3gid_2__set__(struct __ return __pyx_r; } -/* "ssh2/sftp_handle.pyx":86 +/* "ssh2/sftp_handle.pyx":88 * self._attrs.gid = gid * * @property # <<<<<<<<<<<<<< - * def permissions(self): + * def permissions(self) -> int: * return self._attrs.permissions */ @@ -4317,25 +4390,25 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_11permissions___g int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 1); - /* "ssh2/sftp_handle.pyx":88 + /* "ssh2/sftp_handle.pyx":90 * @property - * def permissions(self): + * def permissions(self) -> int: * return self._attrs.permissions # <<<<<<<<<<<<<< * * @permissions.setter */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->_attrs->permissions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->_attrs->permissions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":86 + /* "ssh2/sftp_handle.pyx":88 * self._attrs.gid = gid * * @property # <<<<<<<<<<<<<< - * def permissions(self): + * def permissions(self) -> int: * return self._attrs.permissions */ @@ -4350,7 +4423,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_11permissions___g return __pyx_r; } -/* "ssh2/sftp_handle.pyx":90 +/* "ssh2/sftp_handle.pyx":92 * return self._attrs.permissions * * @permissions.setter # <<<<<<<<<<<<<< @@ -4371,7 +4444,7 @@ static int __pyx_pw_4ssh2_11sftp_handle_14SFTPAttributes_11permissions_3__set__( __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); assert(__pyx_arg_permissions); { - __pyx_v_permissions = __Pyx_PyInt_As_unsigned_long(__pyx_arg_permissions); if (unlikely((__pyx_v_permissions == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L3_error) + __pyx_v_permissions = __Pyx_PyInt_As_unsigned_long(__pyx_arg_permissions); if (unlikely((__pyx_v_permissions == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 93, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -4389,7 +4462,7 @@ static int __pyx_pw_4ssh2_11sftp_handle_14SFTPAttributes_11permissions_3__set__( static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_11permissions_2__set__(struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes *__pyx_v_self, unsigned long __pyx_v_permissions) { int __pyx_r; - /* "ssh2/sftp_handle.pyx":92 + /* "ssh2/sftp_handle.pyx":94 * @permissions.setter * def permissions(self, unsigned long permissions): * self._attrs.permissions = permissions # <<<<<<<<<<<<<< @@ -4398,7 +4471,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_11permissions_2__set__( */ __pyx_v_self->_attrs->permissions = __pyx_v_permissions; - /* "ssh2/sftp_handle.pyx":90 + /* "ssh2/sftp_handle.pyx":92 * return self._attrs.permissions * * @permissions.setter # <<<<<<<<<<<<<< @@ -4411,11 +4484,11 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_11permissions_2__set__( return __pyx_r; } -/* "ssh2/sftp_handle.pyx":94 +/* "ssh2/sftp_handle.pyx":96 * self._attrs.permissions = permissions * * @property # <<<<<<<<<<<<<< - * def atime(self): + * def atime(self) -> int: * return self._attrs.atime */ @@ -4443,25 +4516,25 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_5atime___get__(st int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 1); - /* "ssh2/sftp_handle.pyx":96 + /* "ssh2/sftp_handle.pyx":98 * @property - * def atime(self): + * def atime(self) -> int: * return self._attrs.atime # <<<<<<<<<<<<<< * * @atime.setter */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->_attrs->atime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->_attrs->atime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":94 + /* "ssh2/sftp_handle.pyx":96 * self._attrs.permissions = permissions * * @property # <<<<<<<<<<<<<< - * def atime(self): + * def atime(self) -> int: * return self._attrs.atime */ @@ -4476,7 +4549,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_5atime___get__(st return __pyx_r; } -/* "ssh2/sftp_handle.pyx":98 +/* "ssh2/sftp_handle.pyx":100 * return self._attrs.atime * * @atime.setter # <<<<<<<<<<<<<< @@ -4497,7 +4570,7 @@ static int __pyx_pw_4ssh2_11sftp_handle_14SFTPAttributes_5atime_3__set__(PyObjec __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); assert(__pyx_arg_atime); { - __pyx_v_atime = __Pyx_PyInt_As_unsigned_long(__pyx_arg_atime); if (unlikely((__pyx_v_atime == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 99, __pyx_L3_error) + __pyx_v_atime = __Pyx_PyInt_As_unsigned_long(__pyx_arg_atime); if (unlikely((__pyx_v_atime == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -4515,7 +4588,7 @@ static int __pyx_pw_4ssh2_11sftp_handle_14SFTPAttributes_5atime_3__set__(PyObjec static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_5atime_2__set__(struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes *__pyx_v_self, unsigned long __pyx_v_atime) { int __pyx_r; - /* "ssh2/sftp_handle.pyx":100 + /* "ssh2/sftp_handle.pyx":102 * @atime.setter * def atime(self, unsigned long atime): * self._attrs.atime = atime # <<<<<<<<<<<<<< @@ -4524,7 +4597,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_5atime_2__set__(struct */ __pyx_v_self->_attrs->atime = __pyx_v_atime; - /* "ssh2/sftp_handle.pyx":98 + /* "ssh2/sftp_handle.pyx":100 * return self._attrs.atime * * @atime.setter # <<<<<<<<<<<<<< @@ -4537,11 +4610,11 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_5atime_2__set__(struct return __pyx_r; } -/* "ssh2/sftp_handle.pyx":102 +/* "ssh2/sftp_handle.pyx":104 * self._attrs.atime = atime * * @property # <<<<<<<<<<<<<< - * def mtime(self): + * def mtime(self) -> int: * return self._attrs.mtime */ @@ -4569,25 +4642,25 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_5mtime___get__(st int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 1); - /* "ssh2/sftp_handle.pyx":104 + /* "ssh2/sftp_handle.pyx":106 * @property - * def mtime(self): + * def mtime(self) -> int: * return self._attrs.mtime # <<<<<<<<<<<<<< * * @mtime.setter */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->_attrs->mtime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->_attrs->mtime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":102 + /* "ssh2/sftp_handle.pyx":104 * self._attrs.atime = atime * * @property # <<<<<<<<<<<<<< - * def mtime(self): + * def mtime(self) -> int: * return self._attrs.mtime */ @@ -4602,7 +4675,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_5mtime___get__(st return __pyx_r; } -/* "ssh2/sftp_handle.pyx":106 +/* "ssh2/sftp_handle.pyx":108 * return self._attrs.mtime * * @mtime.setter # <<<<<<<<<<<<<< @@ -4623,7 +4696,7 @@ static int __pyx_pw_4ssh2_11sftp_handle_14SFTPAttributes_5mtime_3__set__(PyObjec __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); assert(__pyx_arg_mtime); { - __pyx_v_mtime = __Pyx_PyInt_As_unsigned_long(__pyx_arg_mtime); if (unlikely((__pyx_v_mtime == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L3_error) + __pyx_v_mtime = __Pyx_PyInt_As_unsigned_long(__pyx_arg_mtime); if (unlikely((__pyx_v_mtime == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 109, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -4641,7 +4714,7 @@ static int __pyx_pw_4ssh2_11sftp_handle_14SFTPAttributes_5mtime_3__set__(PyObjec static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_5mtime_2__set__(struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes *__pyx_v_self, unsigned long __pyx_v_mtime) { int __pyx_r; - /* "ssh2/sftp_handle.pyx":108 + /* "ssh2/sftp_handle.pyx":110 * @mtime.setter * def mtime(self, unsigned long mtime): * self._attrs.mtime = mtime # <<<<<<<<<<<<<< @@ -4650,7 +4723,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_5mtime_2__set__(struct */ __pyx_v_self->_attrs->mtime = __pyx_v_mtime; - /* "ssh2/sftp_handle.pyx":106 + /* "ssh2/sftp_handle.pyx":108 * return self._attrs.mtime * * @mtime.setter # <<<<<<<<<<<<<< @@ -4677,7 +4750,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_14SFTPAttributes_4__reduce_cython__, "SFTPAttributes.__reduce_cython__(self)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_14SFTPAttributes_4__reduce_cython__, "__reduce_cython__(self)"); static PyMethodDef __pyx_mdef_4ssh2_11sftp_handle_14SFTPAttributes_5__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_11sftp_handle_14SFTPAttributes_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_11sftp_handle_14SFTPAttributes_4__reduce_cython__}; static PyObject *__pyx_pw_4ssh2_11sftp_handle_14SFTPAttributes_5__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -4758,7 +4831,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_14SFTPAttributes_6__setstate_cython__, "SFTPAttributes.__setstate_cython__(self, __pyx_state)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_14SFTPAttributes_6__setstate_cython__, "__setstate_cython__(self, __pyx_state)"); static PyMethodDef __pyx_mdef_4ssh2_11sftp_handle_14SFTPAttributes_7__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_11sftp_handle_14SFTPAttributes_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_11sftp_handle_14SFTPAttributes_6__setstate_cython__}; static PyObject *__pyx_pw_4ssh2_11sftp_handle_14SFTPAttributes_7__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -4879,7 +4952,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_14SFTPAttributes_6__setstate_cytho return __pyx_r; } -/* "ssh2/sftp_handle.pyx":113 +/* "ssh2/sftp_handle.pyx":115 * cdef class SFTPHandle: * * def __cinit__(self, sftp): # <<<<<<<<<<<<<< @@ -4923,12 +4996,12 @@ static int __pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_1__cinit__(PyObject *__pyx_ (void)__Pyx_Arg_NewRef_VARARGS(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 113, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(0, 113, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(0, 115, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; @@ -4939,7 +5012,7 @@ static int __pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_1__cinit__(PyObject *__pyx_ } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 113, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 115, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -4975,7 +5048,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_10SFTPHandle___cinit__(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 1); - /* "ssh2/sftp_handle.pyx":114 + /* "ssh2/sftp_handle.pyx":116 * * def __cinit__(self, sftp): * self._handle = NULL # <<<<<<<<<<<<<< @@ -4984,14 +5057,14 @@ static int __pyx_pf_4ssh2_11sftp_handle_10SFTPHandle___cinit__(struct __pyx_obj_ */ __pyx_v_self->_handle = NULL; - /* "ssh2/sftp_handle.pyx":115 + /* "ssh2/sftp_handle.pyx":117 * def __cinit__(self, sftp): * self._handle = NULL * self._sftp = sftp # <<<<<<<<<<<<<< * self.closed = 0 * */ - if (!(likely(((__pyx_v_sftp) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_sftp, __pyx_ptype_4ssh2_4sftp_SFTP))))) __PYX_ERR(0, 115, __pyx_L1_error) + if (!(likely(((__pyx_v_sftp) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_sftp, __pyx_ptype_4ssh2_4sftp_SFTP))))) __PYX_ERR(0, 117, __pyx_L1_error) __pyx_t_1 = __pyx_v_sftp; __Pyx_INCREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -5000,7 +5073,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_10SFTPHandle___cinit__(struct __pyx_obj_ __pyx_v_self->_sftp = ((struct __pyx_obj_4ssh2_4sftp_SFTP *)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/sftp_handle.pyx":116 + /* "ssh2/sftp_handle.pyx":118 * self._handle = NULL * self._sftp = sftp * self.closed = 0 # <<<<<<<<<<<<<< @@ -5009,7 +5082,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_10SFTPHandle___cinit__(struct __pyx_obj_ */ __pyx_v_self->closed = 0; - /* "ssh2/sftp_handle.pyx":113 + /* "ssh2/sftp_handle.pyx":115 * cdef class SFTPHandle: * * def __cinit__(self, sftp): # <<<<<<<<<<<<<< @@ -5029,7 +5102,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_10SFTPHandle___cinit__(struct __pyx_obj_ return __pyx_r; } -/* "ssh2/sftp_handle.pyx":118 +/* "ssh2/sftp_handle.pyx":120 * self.closed = 0 * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -5053,7 +5126,7 @@ static void __pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_3__dealloc__(PyObject *__p static void __pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_2__dealloc__(struct __pyx_obj_4ssh2_11sftp_handle_SFTPHandle *__pyx_v_self) { int __pyx_t_1; - /* "ssh2/sftp_handle.pyx":119 + /* "ssh2/sftp_handle.pyx":121 * * def __dealloc__(self): * if self.closed == 0: # <<<<<<<<<<<<<< @@ -5063,7 +5136,7 @@ static void __pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_2__dealloc__(struct __pyx_ __pyx_t_1 = (__pyx_v_self->closed == 0); if (__pyx_t_1) { - /* "ssh2/sftp_handle.pyx":120 + /* "ssh2/sftp_handle.pyx":122 * def __dealloc__(self): * if self.closed == 0: * with nogil: # <<<<<<<<<<<<<< @@ -5079,7 +5152,7 @@ static void __pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_2__dealloc__(struct __pyx_ #endif /*try:*/ { - /* "ssh2/sftp_handle.pyx":121 + /* "ssh2/sftp_handle.pyx":123 * if self.closed == 0: * with nogil: * c_sftp.libssh2_sftp_close_handle(self._handle) # <<<<<<<<<<<<<< @@ -5089,7 +5162,7 @@ static void __pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_2__dealloc__(struct __pyx_ (void)(libssh2_sftp_close_handle(__pyx_v_self->_handle)); } - /* "ssh2/sftp_handle.pyx":120 + /* "ssh2/sftp_handle.pyx":122 * def __dealloc__(self): * if self.closed == 0: * with nogil: # <<<<<<<<<<<<<< @@ -5108,7 +5181,7 @@ static void __pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_2__dealloc__(struct __pyx_ } } - /* "ssh2/sftp_handle.pyx":122 + /* "ssh2/sftp_handle.pyx":124 * with nogil: * c_sftp.libssh2_sftp_close_handle(self._handle) * self.closed = 1 # <<<<<<<<<<<<<< @@ -5117,7 +5190,7 @@ static void __pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_2__dealloc__(struct __pyx_ */ __pyx_v_self->closed = 1; - /* "ssh2/sftp_handle.pyx":119 + /* "ssh2/sftp_handle.pyx":121 * * def __dealloc__(self): * if self.closed == 0: # <<<<<<<<<<<<<< @@ -5126,7 +5199,7 @@ static void __pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_2__dealloc__(struct __pyx_ */ } - /* "ssh2/sftp_handle.pyx":118 + /* "ssh2/sftp_handle.pyx":120 * self.closed = 0 * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -5137,7 +5210,7 @@ static void __pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_2__dealloc__(struct __pyx_ /* function exit code */ } -/* "ssh2/sftp_handle.pyx":124 +/* "ssh2/sftp_handle.pyx":126 * self.closed = 1 * * def __iter__(self): # <<<<<<<<<<<<<< @@ -5165,19 +5238,19 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_4__iter__(struct __py __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__", 1); - /* "ssh2/sftp_handle.pyx":125 + /* "ssh2/sftp_handle.pyx":127 * * def __iter__(self): * return self # <<<<<<<<<<<<<< * - * def __next__(self): + * def __next__(self) -> Tuple[int, bytes]: */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_self); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":124 + /* "ssh2/sftp_handle.pyx":126 * self.closed = 1 * * def __iter__(self): # <<<<<<<<<<<<<< @@ -5192,10 +5265,10 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_4__iter__(struct __py return __pyx_r; } -/* "ssh2/sftp_handle.pyx":127 +/* "ssh2/sftp_handle.pyx":129 * return self * - * def __next__(self): # <<<<<<<<<<<<<< + * def __next__(self) -> Tuple[int, bytes]: # <<<<<<<<<<<<<< * cdef int rc * cdef bytes data */ @@ -5235,14 +5308,14 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_6__next__(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__next__", 1); - /* "ssh2/sftp_handle.pyx":130 + /* "ssh2/sftp_handle.pyx":132 * cdef int rc * cdef bytes data * rc, data = self.read() # <<<<<<<<<<<<<< * if rc != c_ssh2.LIBSSH2_ERROR_EAGAIN and rc <= 0: * raise StopIteration */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 130, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; __pyx_t_4 = 0; @@ -5262,7 +5335,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_6__next__(struct __py PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } @@ -5272,7 +5345,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_6__next__(struct __py if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 130, __pyx_L1_error) + __PYX_ERR(0, 132, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -5285,15 +5358,15 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_6__next__(struct __py __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 130, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 130, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; - __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 130, __pyx_L1_error) + __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); @@ -5301,7 +5374,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_6__next__(struct __py __Pyx_GOTREF(__pyx_t_2); index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 130, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 132, __pyx_L1_error) __pyx_t_6 = NULL; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L4_unpacking_done; @@ -5309,17 +5382,17 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_6__next__(struct __py __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 130, __pyx_L1_error) + __PYX_ERR(0, 132, __pyx_L1_error) __pyx_L4_unpacking_done:; } - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 130, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_3))) __PYX_ERR(0, 130, __pyx_L1_error) + if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_3))) __PYX_ERR(0, 132, __pyx_L1_error) __pyx_v_rc = __pyx_t_7; __pyx_v_data = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "ssh2/sftp_handle.pyx":131 + /* "ssh2/sftp_handle.pyx":133 * cdef bytes data * rc, data = self.read() * if rc != c_ssh2.LIBSSH2_ERROR_EAGAIN and rc <= 0: # <<<<<<<<<<<<<< @@ -5337,7 +5410,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_6__next__(struct __py __pyx_L6_bool_binop_done:; if (unlikely(__pyx_t_8)) { - /* "ssh2/sftp_handle.pyx":132 + /* "ssh2/sftp_handle.pyx":134 * rc, data = self.read() * if rc != c_ssh2.LIBSSH2_ERROR_EAGAIN and rc <= 0: * raise StopIteration # <<<<<<<<<<<<<< @@ -5347,7 +5420,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_6__next__(struct __py __pyx_error_without_exception = 1; goto __pyx_L1_error;; - /* "ssh2/sftp_handle.pyx":131 + /* "ssh2/sftp_handle.pyx":133 * cdef bytes data * rc, data = self.read() * if rc != c_ssh2.LIBSSH2_ERROR_EAGAIN and rc <= 0: # <<<<<<<<<<<<<< @@ -5356,7 +5429,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_6__next__(struct __py */ } - /* "ssh2/sftp_handle.pyx":133 + /* "ssh2/sftp_handle.pyx":135 * if rc != c_ssh2.LIBSSH2_ERROR_EAGAIN and rc <= 0: * raise StopIteration * return rc, data # <<<<<<<<<<<<<< @@ -5364,24 +5437,24 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_6__next__(struct __py * def __enter__(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 133, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error); __Pyx_INCREF(__pyx_v_data); __Pyx_GIVEREF(__pyx_v_data); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_data)) __PYX_ERR(0, 133, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_data)) __PYX_ERR(0, 135, __pyx_L1_error); __pyx_t_1 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":127 + /* "ssh2/sftp_handle.pyx":129 * return self * - * def __next__(self): # <<<<<<<<<<<<<< + * def __next__(self) -> Tuple[int, bytes]: # <<<<<<<<<<<<<< * cdef int rc * cdef bytes data */ @@ -5403,7 +5476,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_6__next__(struct __py return __pyx_r; } -/* "ssh2/sftp_handle.pyx":135 +/* "ssh2/sftp_handle.pyx":137 * return rc, data * * def __enter__(self): # <<<<<<<<<<<<<< @@ -5419,7 +5492,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_8__enter__, "SFTPHandle.__enter__(self)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_8__enter__, "__enter__(self)"); static PyMethodDef __pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_9__enter__ = {"__enter__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_9__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_8__enter__}; static PyObject *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_9__enter__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -5458,7 +5531,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_8__enter__(struct __p __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__enter__", 1); - /* "ssh2/sftp_handle.pyx":136 + /* "ssh2/sftp_handle.pyx":138 * * def __enter__(self): * return self # <<<<<<<<<<<<<< @@ -5470,7 +5543,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_8__enter__(struct __p __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":135 + /* "ssh2/sftp_handle.pyx":137 * return rc, data * * def __enter__(self): # <<<<<<<<<<<<<< @@ -5485,7 +5558,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_8__enter__(struct __p return __pyx_r; } -/* "ssh2/sftp_handle.pyx":138 +/* "ssh2/sftp_handle.pyx":140 * return self * * def __exit__(self, *args): # <<<<<<<<<<<<<< @@ -5495,7 +5568,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_8__enter__(struct __p /* Python wrapper */ static PyObject *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_11__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_10__exit__, "SFTPHandle.__exit__(self, *args)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_10__exit__, "__exit__(self, *args)"); static PyMethodDef __pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_11__exit__ = {"__exit__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_11__exit__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_10__exit__}; static PyObject *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_11__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { CYTHON_UNUSED PyObject *__pyx_v_args = 0; @@ -5533,14 +5606,14 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_10__exit__(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__exit__", 1); - /* "ssh2/sftp_handle.pyx":139 + /* "ssh2/sftp_handle.pyx":141 * * def __exit__(self, *args): * self.close() # <<<<<<<<<<<<<< * - * def close(self): + * def close(self) -> int: */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 141, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; __pyx_t_4 = 0; @@ -5560,13 +5633,13 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_10__exit__(struct __p PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/sftp_handle.pyx":138 + /* "ssh2/sftp_handle.pyx":140 * return self * * def __exit__(self, *args): # <<<<<<<<<<<<<< @@ -5589,12 +5662,12 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_10__exit__(struct __p return __pyx_r; } -/* "ssh2/sftp_handle.pyx":141 +/* "ssh2/sftp_handle.pyx":143 * self.close() * - * def close(self): # <<<<<<<<<<<<<< - * """Close handle. Called automatically when object is deleted - * and/or garbage collected. + * def close(self) -> int: # <<<<<<<<<<<<<< + * """Close handle. + * */ /* Python wrapper */ @@ -5605,7 +5678,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_12close, "SFTPHandle.close(self)\nClose handle. Called automatically when object is deleted\n and/or garbage collected.\n\n :rtype: int"); +PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_12close, "close(self) -> int\nClose handle.\n\n Called automatically when object is de-allocated if not already closed.\n\n :rtype: int"); static PyMethodDef __pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_13close = {"close", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_13close, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_12close}; static PyObject *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_13close(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -5650,7 +5723,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_12close(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("close", 1); - /* "ssh2/sftp_handle.pyx":147 + /* "ssh2/sftp_handle.pyx":150 * :rtype: int""" * cdef int rc * if self.closed == 0: # <<<<<<<<<<<<<< @@ -5660,7 +5733,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_12close(struct __pyx_ __pyx_t_1 = (__pyx_v_self->closed == 0); if (__pyx_t_1) { - /* "ssh2/sftp_handle.pyx":148 + /* "ssh2/sftp_handle.pyx":151 * cdef int rc * if self.closed == 0: * with nogil: # <<<<<<<<<<<<<< @@ -5676,7 +5749,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_12close(struct __pyx_ #endif /*try:*/ { - /* "ssh2/sftp_handle.pyx":149 + /* "ssh2/sftp_handle.pyx":152 * if self.closed == 0: * with nogil: * rc = c_sftp.libssh2_sftp_close_handle(self._handle) # <<<<<<<<<<<<<< @@ -5686,7 +5759,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_12close(struct __pyx_ __pyx_v_rc = libssh2_sftp_close_handle(__pyx_v_self->_handle); } - /* "ssh2/sftp_handle.pyx":148 + /* "ssh2/sftp_handle.pyx":151 * cdef int rc * if self.closed == 0: * with nogil: # <<<<<<<<<<<<<< @@ -5705,7 +5778,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_12close(struct __pyx_ } } - /* "ssh2/sftp_handle.pyx":150 + /* "ssh2/sftp_handle.pyx":153 * with nogil: * rc = c_sftp.libssh2_sftp_close_handle(self._handle) * self.closed = 1 # <<<<<<<<<<<<<< @@ -5714,7 +5787,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_12close(struct __pyx_ */ __pyx_v_self->closed = 1; - /* "ssh2/sftp_handle.pyx":147 + /* "ssh2/sftp_handle.pyx":150 * :rtype: int""" * cdef int rc * if self.closed == 0: # <<<<<<<<<<<<<< @@ -5724,7 +5797,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_12close(struct __pyx_ goto __pyx_L3; } - /* "ssh2/sftp_handle.pyx":152 + /* "ssh2/sftp_handle.pyx":155 * self.closed = 1 * else: * return # <<<<<<<<<<<<<< @@ -5733,31 +5806,32 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_12close(struct __pyx_ */ /*else*/ { __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; } __pyx_L3:; - /* "ssh2/sftp_handle.pyx":153 + /* "ssh2/sftp_handle.pyx":156 * else: * return * return rc # <<<<<<<<<<<<<< * - * def read(self, size_t buffer_maxlen=c_ssh2.LIBSSH2_CHANNEL_WINDOW_DEFAULT): + * def read(self, size_t buffer_maxlen=c_ssh2.LIBSSH2_CHANNEL_WINDOW_DEFAULT) -> Tuple[int, bytes]: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; + if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_t_2)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_t_2))) __PYX_ERR(0, 156, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":141 + /* "ssh2/sftp_handle.pyx":143 * self.close() * - * def close(self): # <<<<<<<<<<<<<< - * """Close handle. Called automatically when object is deleted - * and/or garbage collected. + * def close(self) -> int: # <<<<<<<<<<<<<< + * """Close handle. + * */ /* function exit code */ @@ -5771,10 +5845,10 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_12close(struct __pyx_ return __pyx_r; } -/* "ssh2/sftp_handle.pyx":155 +/* "ssh2/sftp_handle.pyx":158 * return rc * - * def read(self, size_t buffer_maxlen=c_ssh2.LIBSSH2_CHANNEL_WINDOW_DEFAULT): # <<<<<<<<<<<<<< + * def read(self, size_t buffer_maxlen=c_ssh2.LIBSSH2_CHANNEL_WINDOW_DEFAULT) -> Tuple[int, bytes]: # <<<<<<<<<<<<<< * """Read buffer from file handle. * */ @@ -5787,7 +5861,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_14read, "SFTPHandle.read(self, size_t buffer_maxlen=c_ssh2.LIBSSH2_CHANNEL_WINDOW_DEFAULT)\nRead buffer from file handle.\n\n :param buffer_maxlen: Max length of buffer to return.\n :type buffer_maxlen: int\n\n :returns: Size and buffer tuple.\n :rtype: (int, bytes)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_14read, "read(self, buffer_maxlen: int = c_ssh2.LIBSSH2_CHANNEL_WINDOW_DEFAULT) -> Tuple[int, bytes]\nRead buffer from file handle.\n\n :param buffer_maxlen: Max length of buffer to return.\n :type buffer_maxlen: int\n\n :returns: Size and buffer tuple.\n :rtype: (int, bytes)"); static PyMethodDef __pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_15read = {"read", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_15read, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_14read}; static PyObject *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_15read(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -5832,12 +5906,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_buffer_maxlen); if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 155, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 158, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "read") < 0)) __PYX_ERR(0, 155, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "read") < 0)) __PYX_ERR(0, 158, __pyx_L3_error) } } else { switch (__pyx_nargs) { @@ -5848,14 +5922,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } } if (values[0]) { - __pyx_v_buffer_maxlen = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_buffer_maxlen == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 155, __pyx_L3_error) + __pyx_v_buffer_maxlen = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_buffer_maxlen == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 158, __pyx_L3_error) } else { __pyx_v_buffer_maxlen = __pyx_k_; } } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("read", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 155, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("read", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 158, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -5905,7 +5979,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_14read(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read", 1); - /* "ssh2/sftp_handle.pyx":164 + /* "ssh2/sftp_handle.pyx":167 * :rtype: (int, bytes)""" * cdef ssize_t rc * cdef bytes buf = b'' # <<<<<<<<<<<<<< @@ -5915,7 +5989,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_14read(struct __pyx_o __Pyx_INCREF(__pyx_kp_b__2); __pyx_v_buf = __pyx_kp_b__2; - /* "ssh2/sftp_handle.pyx":166 + /* "ssh2/sftp_handle.pyx":169 * cdef bytes buf = b'' * cdef char *cbuf * with nogil: # <<<<<<<<<<<<<< @@ -5931,7 +6005,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_14read(struct __pyx_o #endif /*try:*/ { - /* "ssh2/sftp_handle.pyx":167 + /* "ssh2/sftp_handle.pyx":170 * cdef char *cbuf * with nogil: * cbuf = malloc(sizeof(char)*buffer_maxlen) # <<<<<<<<<<<<<< @@ -5940,7 +6014,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_14read(struct __pyx_o */ __pyx_v_cbuf = ((char *)malloc(((sizeof(char)) * __pyx_v_buffer_maxlen))); - /* "ssh2/sftp_handle.pyx":168 + /* "ssh2/sftp_handle.pyx":171 * with nogil: * cbuf = malloc(sizeof(char)*buffer_maxlen) * if cbuf is NULL: # <<<<<<<<<<<<<< @@ -5950,7 +6024,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_14read(struct __pyx_o __pyx_t_1 = (__pyx_v_cbuf == NULL); if (unlikely(__pyx_t_1)) { - /* "ssh2/sftp_handle.pyx":169 + /* "ssh2/sftp_handle.pyx":172 * cbuf = malloc(sizeof(char)*buffer_maxlen) * if cbuf is NULL: * with gil: # <<<<<<<<<<<<<< @@ -5963,17 +6037,17 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_14read(struct __pyx_o #endif /*try:*/ { - /* "ssh2/sftp_handle.pyx":170 + /* "ssh2/sftp_handle.pyx":173 * if cbuf is NULL: * with gil: * raise MemoryError # <<<<<<<<<<<<<< * rc = c_sftp.libssh2_sftp_read( * self._handle, cbuf, buffer_maxlen) */ - PyErr_NoMemory(); __PYX_ERR(0, 170, __pyx_L8_error) + PyErr_NoMemory(); __PYX_ERR(0, 173, __pyx_L8_error) } - /* "ssh2/sftp_handle.pyx":169 + /* "ssh2/sftp_handle.pyx":172 * cbuf = malloc(sizeof(char)*buffer_maxlen) * if cbuf is NULL: * with gil: # <<<<<<<<<<<<<< @@ -5990,7 +6064,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_14read(struct __pyx_o } } - /* "ssh2/sftp_handle.pyx":168 + /* "ssh2/sftp_handle.pyx":171 * with nogil: * cbuf = malloc(sizeof(char)*buffer_maxlen) * if cbuf is NULL: # <<<<<<<<<<<<<< @@ -5999,7 +6073,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_14read(struct __pyx_o */ } - /* "ssh2/sftp_handle.pyx":171 + /* "ssh2/sftp_handle.pyx":174 * with gil: * raise MemoryError * rc = c_sftp.libssh2_sftp_read( # <<<<<<<<<<<<<< @@ -6009,7 +6083,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_14read(struct __pyx_o __pyx_v_rc = libssh2_sftp_read(__pyx_v_self->_handle, __pyx_v_cbuf, __pyx_v_buffer_maxlen); } - /* "ssh2/sftp_handle.pyx":166 + /* "ssh2/sftp_handle.pyx":169 * cdef bytes buf = b'' * cdef char *cbuf * with nogil: # <<<<<<<<<<<<<< @@ -6035,7 +6109,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_14read(struct __pyx_o } } - /* "ssh2/sftp_handle.pyx":173 + /* "ssh2/sftp_handle.pyx":176 * rc = c_sftp.libssh2_sftp_read( * self._handle, cbuf, buffer_maxlen) * try: # <<<<<<<<<<<<<< @@ -6044,7 +6118,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_14read(struct __pyx_o */ /*try:*/ { - /* "ssh2/sftp_handle.pyx":174 + /* "ssh2/sftp_handle.pyx":177 * self._handle, cbuf, buffer_maxlen) * try: * if rc > 0: # <<<<<<<<<<<<<< @@ -6054,19 +6128,19 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_14read(struct __pyx_o __pyx_t_1 = (__pyx_v_rc > 0); if (__pyx_t_1) { - /* "ssh2/sftp_handle.pyx":175 + /* "ssh2/sftp_handle.pyx":178 * try: * if rc > 0: * buf = cbuf[:rc] # <<<<<<<<<<<<<< * finally: * free(cbuf) */ - __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_cbuf + 0, __pyx_v_rc - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 175, __pyx_L11_error) + __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_cbuf + 0, __pyx_v_rc - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF_SET(__pyx_v_buf, ((PyObject*)__pyx_t_2)); __pyx_t_2 = 0; - /* "ssh2/sftp_handle.pyx":174 + /* "ssh2/sftp_handle.pyx":177 * self._handle, cbuf, buffer_maxlen) * try: * if rc > 0: # <<<<<<<<<<<<<< @@ -6076,7 +6150,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_14read(struct __pyx_o } } - /* "ssh2/sftp_handle.pyx":177 + /* "ssh2/sftp_handle.pyx":180 * buf = cbuf[:rc] * finally: * free(cbuf) # <<<<<<<<<<<<<< @@ -6123,7 +6197,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_14read(struct __pyx_o __pyx_L12:; } - /* "ssh2/sftp_handle.pyx":178 + /* "ssh2/sftp_handle.pyx":181 * finally: * free(cbuf) * return rc, buf # <<<<<<<<<<<<<< @@ -6131,24 +6205,24 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_14read(struct __pyx_o * def readdir_ex(self, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_rc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error) + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_rc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 178, __pyx_L1_error) + __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 181, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_GIVEREF(__pyx_t_2); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error); __Pyx_INCREF(__pyx_v_buf); __Pyx_GIVEREF(__pyx_v_buf); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_buf)) __PYX_ERR(0, 178, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_buf)) __PYX_ERR(0, 181, __pyx_L1_error); __pyx_t_2 = 0; - __pyx_r = __pyx_t_12; + __pyx_r = ((PyObject*)__pyx_t_12); __pyx_t_12 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":155 + /* "ssh2/sftp_handle.pyx":158 * return rc * - * def read(self, size_t buffer_maxlen=c_ssh2.LIBSSH2_CHANNEL_WINDOW_DEFAULT): # <<<<<<<<<<<<<< + * def read(self, size_t buffer_maxlen=c_ssh2.LIBSSH2_CHANNEL_WINDOW_DEFAULT) -> Tuple[int, bytes]: # <<<<<<<<<<<<<< * """Read buffer from file handle. * */ @@ -6167,12 +6241,12 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_14read(struct __pyx_o } static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_18generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "ssh2/sftp_handle.pyx":180 +/* "ssh2/sftp_handle.pyx":183 * return rc, buf * * def readdir_ex(self, # <<<<<<<<<<<<<< * size_t longentry_maxlen=1024, - * size_t buffer_maxlen=1024): + * size_t buffer_maxlen=1024) -> Generator[Tuple[int, bytes, bytes, SFTPAttributes]]: */ /* Python wrapper */ @@ -6183,7 +6257,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_16readdir_ex, "SFTPHandle.readdir_ex(self, size_t longentry_maxlen=1024, size_t buffer_maxlen=1024)\nGet directory listing from file handle, if any.\n\n File handle *must* be opened with :py:func:`ssh2.sftp.SFTP.readdir()`\n\n This function is a generator and should be iterated on.\n\n :param buffer_maxlen: Max length of returned buffer.\n :param longentry_maxlen: Max length of file list entry.\n\n :rtype: bytes\n "); +PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_16readdir_ex, "readdir_ex(self, longentry_maxlen: int = 1024, buffer_maxlen: int = 1024) -> Generator[Tuple[int, bytes, bytes, SFTPAttributes]]\nGet directory listing from file handle, if any.\n\n File handle *must* be opened with :py:func:`ssh2.sftp.SFTP.readdir()`\n\n This function is a generator and should be iterated on.\n\n :param buffer_maxlen: Max length of returned buffer.\n :param longentry_maxlen: Max length of file list entry.\n\n :rtype: bytes\n "); static PyMethodDef __pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_17readdir_ex = {"readdir_ex", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_17readdir_ex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_16readdir_ex}; static PyObject *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_17readdir_ex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6231,19 +6305,19 @@ PyObject *__pyx_args, PyObject *__pyx_kwds if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_longentry_maxlen); if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_buffer_maxlen); if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "readdir_ex") < 0)) __PYX_ERR(0, 180, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "readdir_ex") < 0)) __PYX_ERR(0, 183, __pyx_L3_error) } } else { switch (__pyx_nargs) { @@ -6256,19 +6330,19 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } } if (values[0]) { - __pyx_v_longentry_maxlen = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_longentry_maxlen == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 181, __pyx_L3_error) + __pyx_v_longentry_maxlen = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_longentry_maxlen == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 184, __pyx_L3_error) } else { __pyx_v_longentry_maxlen = ((size_t)0x400); } if (values[1]) { - __pyx_v_buffer_maxlen = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_buffer_maxlen == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L3_error) + __pyx_v_buffer_maxlen = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_buffer_maxlen == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L3_error) } else { __pyx_v_buffer_maxlen = ((size_t)0x400); } } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("readdir_ex", 0, 0, 2, __pyx_nargs); __PYX_ERR(0, 180, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("readdir_ex", 0, 0, 2, __pyx_nargs); __PYX_ERR(0, 183, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -6307,7 +6381,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_16readdir_ex(struct _ if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_4ssh2_11sftp_handle___pyx_scope_struct__readdir_ex *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 180, __pyx_L1_error) + __PYX_ERR(0, 183, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -6317,7 +6391,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_16readdir_ex(struct _ __pyx_cur_scope->__pyx_v_longentry_maxlen = __pyx_v_longentry_maxlen; __pyx_cur_scope->__pyx_v_buffer_maxlen = __pyx_v_buffer_maxlen; { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_18generator, __pyx_codeobj__3, (PyObject *) __pyx_cur_scope, __pyx_n_s_readdir_ex, __pyx_n_s_SFTPHandle_readdir_ex, __pyx_n_s_ssh2_sftp_handle); if (unlikely(!gen)) __PYX_ERR(0, 180, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_18generator, __pyx_codeobj__3, (PyObject *) __pyx_cur_scope, __pyx_n_s_readdir_ex, __pyx_n_s_SFTPHandle_readdir_ex, __pyx_n_s_ssh2_sftp_handle); if (unlikely(!gen)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -6359,52 +6433,52 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_18generator(__pyx_Cor return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 180, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 183, __pyx_L1_error) - /* "ssh2/sftp_handle.pyx":194 + /* "ssh2/sftp_handle.pyx":197 * :rtype: bytes * """ * rc, buf, entry, attrs = self._readdir_ex( # <<<<<<<<<<<<<< * longentry_maxlen=longentry_maxlen, * buffer_maxlen=buffer_maxlen) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_readdir_ex_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_readdir_ex_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - /* "ssh2/sftp_handle.pyx":195 + /* "ssh2/sftp_handle.pyx":198 * """ * rc, buf, entry, attrs = self._readdir_ex( * longentry_maxlen=longentry_maxlen, # <<<<<<<<<<<<<< * buffer_maxlen=buffer_maxlen) * while rc == c_ssh2.LIBSSH2_ERROR_EAGAIN or rc > 0: */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 195, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 198, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_cur_scope->__pyx_v_longentry_maxlen); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 195, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_cur_scope->__pyx_v_longentry_maxlen); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 198, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_longentry_maxlen, __pyx_t_3) < 0) __PYX_ERR(0, 195, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_longentry_maxlen, __pyx_t_3) < 0) __PYX_ERR(0, 198, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ssh2/sftp_handle.pyx":196 + /* "ssh2/sftp_handle.pyx":199 * rc, buf, entry, attrs = self._readdir_ex( * longentry_maxlen=longentry_maxlen, * buffer_maxlen=buffer_maxlen) # <<<<<<<<<<<<<< * while rc == c_ssh2.LIBSSH2_ERROR_EAGAIN or rc > 0: * yield rc, buf, entry, attrs */ - __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_cur_scope->__pyx_v_buffer_maxlen); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_cur_scope->__pyx_v_buffer_maxlen); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_buffer_maxlen, __pyx_t_3) < 0) __PYX_ERR(0, 195, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_buffer_maxlen, __pyx_t_3) < 0) __PYX_ERR(0, 198, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ssh2/sftp_handle.pyx":194 + /* "ssh2/sftp_handle.pyx":197 * :rtype: bytes * """ * rc, buf, entry, attrs = self._readdir_ex( # <<<<<<<<<<<<<< * longentry_maxlen=longentry_maxlen, * buffer_maxlen=buffer_maxlen) */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -6414,7 +6488,7 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_18generator(__pyx_Cor if (unlikely(size != 4)) { if (size > 4) __Pyx_RaiseTooManyValuesError(4); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 194, __pyx_L1_error) + __PYX_ERR(0, 197, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -6437,7 +6511,7 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_18generator(__pyx_Cor Py_ssize_t i; PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_1,&__pyx_t_4,&__pyx_t_5}; for (i=0; i < 4; i++) { - PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 194, __pyx_L1_error) + PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(item); *(temps[i]) = item; } @@ -6447,7 +6521,7 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_18generator(__pyx_Cor } else { Py_ssize_t index = -1; PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_1,&__pyx_t_4,&__pyx_t_5}; - __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); @@ -6456,7 +6530,7 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_18generator(__pyx_Cor __Pyx_GOTREF(item); *(temps[index]) = item; } - if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 4) < 0) __PYX_ERR(0, 194, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 4) < 0) __PYX_ERR(0, 197, __pyx_L1_error) __pyx_t_7 = NULL; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L5_unpacking_done; @@ -6464,7 +6538,7 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_18generator(__pyx_Cor __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_7 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 194, __pyx_L1_error) + __PYX_ERR(0, 197, __pyx_L1_error) __pyx_L5_unpacking_done:; } __Pyx_GIVEREF(__pyx_t_2); @@ -6480,7 +6554,7 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_18generator(__pyx_Cor __pyx_cur_scope->__pyx_v_attrs = __pyx_t_5; __pyx_t_5 = 0; - /* "ssh2/sftp_handle.pyx":197 + /* "ssh2/sftp_handle.pyx":200 * longentry_maxlen=longentry_maxlen, * buffer_maxlen=buffer_maxlen) * while rc == c_ssh2.LIBSSH2_ERROR_EAGAIN or rc > 0: # <<<<<<<<<<<<<< @@ -6488,45 +6562,45 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_18generator(__pyx_Cor * rc, buf, entryb, attrs = self._readdir_ex( */ while (1) { - __pyx_t_3 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_ERROR_EAGAIN); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 197, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_ERROR_EAGAIN); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_rc, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 197, __pyx_L1_error) + __pyx_t_5 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_rc, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 197, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (!__pyx_t_9) { } else { __pyx_t_8 = __pyx_t_9; goto __pyx_L8_bool_binop_done; } - __pyx_t_5 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_rc, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 197, __pyx_L1_error) - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 197, __pyx_L1_error) + __pyx_t_5 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_rc, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 200, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_8 = __pyx_t_9; __pyx_L8_bool_binop_done:; if (!__pyx_t_8) break; - /* "ssh2/sftp_handle.pyx":198 + /* "ssh2/sftp_handle.pyx":201 * buffer_maxlen=buffer_maxlen) * while rc == c_ssh2.LIBSSH2_ERROR_EAGAIN or rc > 0: * yield rc, buf, entry, attrs # <<<<<<<<<<<<<< * rc, buf, entryb, attrs = self._readdir_ex( * longentry_maxlen=longentry_maxlen, */ - __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 198, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_rc); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_rc); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_rc)) __PYX_ERR(0, 198, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_rc)) __PYX_ERR(0, 201, __pyx_L1_error); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_buf); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_buf); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_cur_scope->__pyx_v_buf)) __PYX_ERR(0, 198, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_cur_scope->__pyx_v_buf)) __PYX_ERR(0, 201, __pyx_L1_error); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_entry); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_entry); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_cur_scope->__pyx_v_entry)) __PYX_ERR(0, 198, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_cur_scope->__pyx_v_entry)) __PYX_ERR(0, 201, __pyx_L1_error); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_attrs); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_attrs); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_cur_scope->__pyx_v_attrs)) __PYX_ERR(0, 198, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_cur_scope->__pyx_v_attrs)) __PYX_ERR(0, 201, __pyx_L1_error); __pyx_r = __pyx_t_5; __pyx_t_5 = 0; __Pyx_XGIVEREF(__pyx_r); @@ -6536,52 +6610,52 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_18generator(__pyx_Cor __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L10_resume_from_yield:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 198, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 201, __pyx_L1_error) - /* "ssh2/sftp_handle.pyx":199 + /* "ssh2/sftp_handle.pyx":202 * while rc == c_ssh2.LIBSSH2_ERROR_EAGAIN or rc > 0: * yield rc, buf, entry, attrs * rc, buf, entryb, attrs = self._readdir_ex( # <<<<<<<<<<<<<< * longentry_maxlen=longentry_maxlen, * buffer_maxlen=buffer_maxlen) */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_readdir_ex_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 199, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_readdir_ex_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - /* "ssh2/sftp_handle.pyx":200 + /* "ssh2/sftp_handle.pyx":203 * yield rc, buf, entry, attrs * rc, buf, entryb, attrs = self._readdir_ex( * longentry_maxlen=longentry_maxlen, # <<<<<<<<<<<<<< * buffer_maxlen=buffer_maxlen) * */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 200, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_cur_scope->__pyx_v_longentry_maxlen); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 200, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_cur_scope->__pyx_v_longentry_maxlen); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_longentry_maxlen, __pyx_t_4) < 0) __PYX_ERR(0, 200, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_longentry_maxlen, __pyx_t_4) < 0) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "ssh2/sftp_handle.pyx":201 + /* "ssh2/sftp_handle.pyx":204 * rc, buf, entryb, attrs = self._readdir_ex( * longentry_maxlen=longentry_maxlen, * buffer_maxlen=buffer_maxlen) # <<<<<<<<<<<<<< * * def _readdir_ex(self, */ - __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_cur_scope->__pyx_v_buffer_maxlen); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 201, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_cur_scope->__pyx_v_buffer_maxlen); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_buffer_maxlen, __pyx_t_4) < 0) __PYX_ERR(0, 200, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_buffer_maxlen, __pyx_t_4) < 0) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "ssh2/sftp_handle.pyx":199 + /* "ssh2/sftp_handle.pyx":202 * while rc == c_ssh2.LIBSSH2_ERROR_EAGAIN or rc > 0: * yield rc, buf, entry, attrs * rc, buf, entryb, attrs = self._readdir_ex( # <<<<<<<<<<<<<< * longentry_maxlen=longentry_maxlen, * buffer_maxlen=buffer_maxlen) */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 199, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -6591,7 +6665,7 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_18generator(__pyx_Cor if (unlikely(size != 4)) { if (size > 4) __Pyx_RaiseTooManyValuesError(4); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 199, __pyx_L1_error) + __PYX_ERR(0, 202, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -6614,7 +6688,7 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_18generator(__pyx_Cor Py_ssize_t i; PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_5,&__pyx_t_1,&__pyx_t_2}; for (i=0; i < 4; i++) { - PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 199, __pyx_L1_error) + PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(item); *(temps[i]) = item; } @@ -6624,7 +6698,7 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_18generator(__pyx_Cor } else { Py_ssize_t index = -1; PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_5,&__pyx_t_1,&__pyx_t_2}; - __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 199, __pyx_L1_error) + __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); @@ -6633,7 +6707,7 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_18generator(__pyx_Cor __Pyx_GOTREF(item); *(temps[index]) = item; } - if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 4) < 0) __PYX_ERR(0, 199, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 4) < 0) __PYX_ERR(0, 202, __pyx_L1_error) __pyx_t_7 = NULL; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L12_unpacking_done; @@ -6641,7 +6715,7 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_18generator(__pyx_Cor __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_7 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 199, __pyx_L1_error) + __PYX_ERR(0, 202, __pyx_L1_error) __pyx_L12_unpacking_done:; } __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_rc); @@ -6663,12 +6737,12 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_18generator(__pyx_Cor } CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); - /* "ssh2/sftp_handle.pyx":180 + /* "ssh2/sftp_handle.pyx":183 * return rc, buf * * def readdir_ex(self, # <<<<<<<<<<<<<< * size_t longentry_maxlen=1024, - * size_t buffer_maxlen=1024): + * size_t buffer_maxlen=1024) -> Generator[Tuple[int, bytes, bytes, SFTPAttributes]]: */ /* function exit code */ @@ -6694,7 +6768,7 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_18generator(__pyx_Cor return __pyx_r; } -/* "ssh2/sftp_handle.pyx":203 +/* "ssh2/sftp_handle.pyx":206 * buffer_maxlen=buffer_maxlen) * * def _readdir_ex(self, # <<<<<<<<<<<<<< @@ -6710,7 +6784,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_19_readdir_ex, "SFTPHandle._readdir_ex(self, size_t longentry_maxlen=1024, size_t buffer_maxlen=1024)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_19_readdir_ex, "_readdir_ex(self, longentry_maxlen: int = 1024, buffer_maxlen: int = 1024)"); static PyMethodDef __pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_20_readdir_ex = {"_readdir_ex", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_20_readdir_ex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_19_readdir_ex}; static PyObject *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_20_readdir_ex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -6758,19 +6832,19 @@ PyObject *__pyx_args, PyObject *__pyx_kwds if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_longentry_maxlen); if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 203, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 206, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_buffer_maxlen); if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 203, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 206, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_readdir_ex") < 0)) __PYX_ERR(0, 203, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_readdir_ex") < 0)) __PYX_ERR(0, 206, __pyx_L3_error) } } else { switch (__pyx_nargs) { @@ -6783,19 +6857,19 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } } if (values[0]) { - __pyx_v_longentry_maxlen = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_longentry_maxlen == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 204, __pyx_L3_error) + __pyx_v_longentry_maxlen = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_longentry_maxlen == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 207, __pyx_L3_error) } else { __pyx_v_longentry_maxlen = ((size_t)0x400); } if (values[1]) { - __pyx_v_buffer_maxlen = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_buffer_maxlen == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 205, __pyx_L3_error) + __pyx_v_buffer_maxlen = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_buffer_maxlen == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 208, __pyx_L3_error) } else { __pyx_v_buffer_maxlen = ((size_t)0x400); } } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_readdir_ex", 0, 0, 2, __pyx_nargs); __PYX_ERR(0, 203, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("_readdir_ex", 0, 0, 2, __pyx_nargs); __PYX_ERR(0, 206, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -6849,7 +6923,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_19_readdir_ex(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_readdir_ex", 1); - /* "ssh2/sftp_handle.pyx":206 + /* "ssh2/sftp_handle.pyx":209 * size_t longentry_maxlen=1024, * size_t buffer_maxlen=1024): * cdef bytes buf = b'' # <<<<<<<<<<<<<< @@ -6859,7 +6933,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_19_readdir_ex(struct __Pyx_INCREF(__pyx_kp_b__2); __pyx_v_buf = __pyx_kp_b__2; - /* "ssh2/sftp_handle.pyx":207 + /* "ssh2/sftp_handle.pyx":210 * size_t buffer_maxlen=1024): * cdef bytes buf = b'' * cdef bytes b_longentry = b'' # <<<<<<<<<<<<<< @@ -6869,19 +6943,19 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_19_readdir_ex(struct __Pyx_INCREF(__pyx_kp_b__2); __pyx_v_b_longentry = __pyx_kp_b__2; - /* "ssh2/sftp_handle.pyx":210 + /* "ssh2/sftp_handle.pyx":213 * cdef char *cbuf * cdef char *longentry * cdef SFTPAttributes attrs = SFTPAttributes() # <<<<<<<<<<<<<< * with nogil: * cbuf = malloc(sizeof(char)*buffer_maxlen) */ - __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_attrs = ((struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes *)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/sftp_handle.pyx":211 + /* "ssh2/sftp_handle.pyx":214 * cdef char *longentry * cdef SFTPAttributes attrs = SFTPAttributes() * with nogil: # <<<<<<<<<<<<<< @@ -6897,7 +6971,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_19_readdir_ex(struct #endif /*try:*/ { - /* "ssh2/sftp_handle.pyx":212 + /* "ssh2/sftp_handle.pyx":215 * cdef SFTPAttributes attrs = SFTPAttributes() * with nogil: * cbuf = malloc(sizeof(char)*buffer_maxlen) # <<<<<<<<<<<<<< @@ -6906,7 +6980,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_19_readdir_ex(struct */ __pyx_v_cbuf = ((char *)malloc(((sizeof(char)) * __pyx_v_buffer_maxlen))); - /* "ssh2/sftp_handle.pyx":213 + /* "ssh2/sftp_handle.pyx":216 * with nogil: * cbuf = malloc(sizeof(char)*buffer_maxlen) * longentry = malloc(sizeof(char)*longentry_maxlen) # <<<<<<<<<<<<<< @@ -6915,7 +6989,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_19_readdir_ex(struct */ __pyx_v_longentry = ((char *)malloc(((sizeof(char)) * __pyx_v_longentry_maxlen))); - /* "ssh2/sftp_handle.pyx":214 + /* "ssh2/sftp_handle.pyx":217 * cbuf = malloc(sizeof(char)*buffer_maxlen) * longentry = malloc(sizeof(char)*longentry_maxlen) * if cbuf is NULL or longentry is NULL: # <<<<<<<<<<<<<< @@ -6933,7 +7007,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_19_readdir_ex(struct __pyx_L7_bool_binop_done:; if (unlikely(__pyx_t_2)) { - /* "ssh2/sftp_handle.pyx":215 + /* "ssh2/sftp_handle.pyx":218 * longentry = malloc(sizeof(char)*longentry_maxlen) * if cbuf is NULL or longentry is NULL: * with gil: # <<<<<<<<<<<<<< @@ -6946,17 +7020,17 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_19_readdir_ex(struct #endif /*try:*/ { - /* "ssh2/sftp_handle.pyx":216 + /* "ssh2/sftp_handle.pyx":219 * if cbuf is NULL or longentry is NULL: * with gil: * raise MemoryError # <<<<<<<<<<<<<< * rc = c_sftp.libssh2_sftp_readdir_ex( * self._handle, cbuf, buffer_maxlen, longentry, */ - PyErr_NoMemory(); __PYX_ERR(0, 216, __pyx_L10_error) + PyErr_NoMemory(); __PYX_ERR(0, 219, __pyx_L10_error) } - /* "ssh2/sftp_handle.pyx":215 + /* "ssh2/sftp_handle.pyx":218 * longentry = malloc(sizeof(char)*longentry_maxlen) * if cbuf is NULL or longentry is NULL: * with gil: # <<<<<<<<<<<<<< @@ -6973,7 +7047,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_19_readdir_ex(struct } } - /* "ssh2/sftp_handle.pyx":214 + /* "ssh2/sftp_handle.pyx":217 * cbuf = malloc(sizeof(char)*buffer_maxlen) * longentry = malloc(sizeof(char)*longentry_maxlen) * if cbuf is NULL or longentry is NULL: # <<<<<<<<<<<<<< @@ -6982,7 +7056,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_19_readdir_ex(struct */ } - /* "ssh2/sftp_handle.pyx":217 + /* "ssh2/sftp_handle.pyx":220 * with gil: * raise MemoryError * rc = c_sftp.libssh2_sftp_readdir_ex( # <<<<<<<<<<<<<< @@ -6992,7 +7066,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_19_readdir_ex(struct __pyx_v_rc = libssh2_sftp_readdir_ex(__pyx_v_self->_handle, __pyx_v_cbuf, __pyx_v_buffer_maxlen, __pyx_v_longentry, __pyx_v_longentry_maxlen, __pyx_v_attrs->_attrs); } - /* "ssh2/sftp_handle.pyx":211 + /* "ssh2/sftp_handle.pyx":214 * cdef char *longentry * cdef SFTPAttributes attrs = SFTPAttributes() * with nogil: # <<<<<<<<<<<<<< @@ -7018,7 +7092,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_19_readdir_ex(struct } } - /* "ssh2/sftp_handle.pyx":220 + /* "ssh2/sftp_handle.pyx":223 * self._handle, cbuf, buffer_maxlen, longentry, * longentry_maxlen, attrs._attrs) * try: # <<<<<<<<<<<<<< @@ -7027,7 +7101,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_19_readdir_ex(struct */ /*try:*/ { - /* "ssh2/sftp_handle.pyx":221 + /* "ssh2/sftp_handle.pyx":224 * longentry_maxlen, attrs._attrs) * try: * if rc > 0: # <<<<<<<<<<<<<< @@ -7037,31 +7111,31 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_19_readdir_ex(struct __pyx_t_2 = (__pyx_v_rc > 0); if (__pyx_t_2) { - /* "ssh2/sftp_handle.pyx":222 + /* "ssh2/sftp_handle.pyx":225 * try: * if rc > 0: * buf = cbuf[:rc] # <<<<<<<<<<<<<< * b_longentry = longentry * finally: */ - __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_cbuf + 0, __pyx_v_rc - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L13_error) + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_cbuf + 0, __pyx_v_rc - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L13_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF_SET(__pyx_v_buf, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0; - /* "ssh2/sftp_handle.pyx":223 + /* "ssh2/sftp_handle.pyx":226 * if rc > 0: * buf = cbuf[:rc] * b_longentry = longentry # <<<<<<<<<<<<<< * finally: * free(cbuf) */ - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_longentry); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L13_error) + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_longentry); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L13_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF_SET(__pyx_v_b_longentry, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0; - /* "ssh2/sftp_handle.pyx":221 + /* "ssh2/sftp_handle.pyx":224 * longentry_maxlen, attrs._attrs) * try: * if rc > 0: # <<<<<<<<<<<<<< @@ -7071,7 +7145,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_19_readdir_ex(struct } } - /* "ssh2/sftp_handle.pyx":225 + /* "ssh2/sftp_handle.pyx":228 * b_longentry = longentry * finally: * free(cbuf) # <<<<<<<<<<<<<< @@ -7082,7 +7156,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_19_readdir_ex(struct /*normal exit:*/{ free(__pyx_v_cbuf); - /* "ssh2/sftp_handle.pyx":226 + /* "ssh2/sftp_handle.pyx":229 * finally: * free(cbuf) * free(longentry) # <<<<<<<<<<<<<< @@ -7109,7 +7183,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_19_readdir_ex(struct __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename; { - /* "ssh2/sftp_handle.pyx":225 + /* "ssh2/sftp_handle.pyx":228 * b_longentry = longentry * finally: * free(cbuf) # <<<<<<<<<<<<<< @@ -7118,7 +7192,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_19_readdir_ex(struct */ free(__pyx_v_cbuf); - /* "ssh2/sftp_handle.pyx":226 + /* "ssh2/sftp_handle.pyx":229 * finally: * free(cbuf) * free(longentry) # <<<<<<<<<<<<<< @@ -7144,35 +7218,35 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_19_readdir_ex(struct __pyx_L14:; } - /* "ssh2/sftp_handle.pyx":227 + /* "ssh2/sftp_handle.pyx":230 * free(cbuf) * free(longentry) * return rc, buf, b_longentry, attrs # <<<<<<<<<<<<<< * - * def readdir(self, size_t buffer_maxlen=1024): + * def readdir(self, size_t buffer_maxlen=1024) -> Generator[Tuple[int, bytes, SFTPAttributes]]: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = PyTuple_New(4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_t_13 = PyTuple_New(4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 230, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error); __Pyx_INCREF(__pyx_v_buf); __Pyx_GIVEREF(__pyx_v_buf); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_v_buf)) __PYX_ERR(0, 227, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_v_buf)) __PYX_ERR(0, 230, __pyx_L1_error); __Pyx_INCREF(__pyx_v_b_longentry); __Pyx_GIVEREF(__pyx_v_b_longentry); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_v_b_longentry)) __PYX_ERR(0, 227, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_v_b_longentry)) __PYX_ERR(0, 230, __pyx_L1_error); __Pyx_INCREF((PyObject *)__pyx_v_attrs); __Pyx_GIVEREF((PyObject *)__pyx_v_attrs); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 3, ((PyObject *)__pyx_v_attrs))) __PYX_ERR(0, 227, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 3, ((PyObject *)__pyx_v_attrs))) __PYX_ERR(0, 230, __pyx_L1_error); __pyx_t_1 = 0; __pyx_r = __pyx_t_13; __pyx_t_13 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":203 + /* "ssh2/sftp_handle.pyx":206 * buffer_maxlen=buffer_maxlen) * * def _readdir_ex(self, # <<<<<<<<<<<<<< @@ -7196,10 +7270,10 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_19_readdir_ex(struct } static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_23generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "ssh2/sftp_handle.pyx":229 +/* "ssh2/sftp_handle.pyx":232 * return rc, buf, b_longentry, attrs * - * def readdir(self, size_t buffer_maxlen=1024): # <<<<<<<<<<<<<< + * def readdir(self, size_t buffer_maxlen=1024) -> Generator[Tuple[int, bytes, SFTPAttributes]]: # <<<<<<<<<<<<<< * """Get directory listing from file handle, if any. * */ @@ -7212,7 +7286,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_21readdir, "SFTPHandle.readdir(self, size_t buffer_maxlen=1024)\nGet directory listing from file handle, if any.\n\n This function is a generator and should be iterated on.\n\n File handle *must* be opened with :py:func:`ssh2.sftp.SFTP.readdir()`\n\n :param buffer_maxlen: Max length of returned file entry.\n\n :rtype: iter(bytes)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_21readdir, "readdir(self, buffer_maxlen: int = 1024) -> Generator[Tuple[int, bytes, SFTPAttributes]]\nGet directory listing from file handle, if any.\n\n This function is a generator and should be iterated on.\n\n File handle *must* be opened with :py:func:`ssh2.sftp.SFTP.readdir()`\n\n :param buffer_maxlen: Max length of returned file entry.\n\n :rtype: iter(bytes)"); static PyMethodDef __pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_22readdir = {"readdir", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_22readdir, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_21readdir}; static PyObject *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_22readdir(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -7257,12 +7331,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_buffer_maxlen); if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 229, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 232, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "readdir") < 0)) __PYX_ERR(0, 229, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "readdir") < 0)) __PYX_ERR(0, 232, __pyx_L3_error) } } else { switch (__pyx_nargs) { @@ -7273,14 +7347,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } } if (values[0]) { - __pyx_v_buffer_maxlen = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_buffer_maxlen == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 229, __pyx_L3_error) + __pyx_v_buffer_maxlen = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_buffer_maxlen == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 232, __pyx_L3_error) } else { __pyx_v_buffer_maxlen = ((size_t)0x400); } } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("readdir", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 229, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("readdir", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 232, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -7319,7 +7393,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_21readdir(struct __py if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_4ssh2_11sftp_handle___pyx_scope_struct_1_readdir *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 229, __pyx_L1_error) + __PYX_ERR(0, 232, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -7328,7 +7402,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_21readdir(struct __py __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __pyx_cur_scope->__pyx_v_buffer_maxlen = __pyx_v_buffer_maxlen; { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_23generator1, __pyx_codeobj__4, (PyObject *) __pyx_cur_scope, __pyx_n_s_readdir, __pyx_n_s_SFTPHandle_readdir, __pyx_n_s_ssh2_sftp_handle); if (unlikely(!gen)) __PYX_ERR(0, 229, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_23generator1, __pyx_codeobj__4, (PyObject *) __pyx_cur_scope, __pyx_n_s_readdir, __pyx_n_s_SFTPHandle_readdir, __pyx_n_s_ssh2_sftp_handle); if (unlikely(!gen)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -7370,18 +7444,18 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_23generator1(__pyx_Co return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 229, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 232, __pyx_L1_error) - /* "ssh2/sftp_handle.pyx":239 + /* "ssh2/sftp_handle.pyx":242 * * :rtype: iter(bytes)""" * rc, buf, attrs = self._readdir(buffer_maxlen) # <<<<<<<<<<<<<< * while rc == c_ssh2.LIBSSH2_ERROR_EAGAIN or rc > 0: * yield rc, buf, attrs */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_readdir_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_readdir_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_cur_scope->__pyx_v_buffer_maxlen); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_cur_scope->__pyx_v_buffer_maxlen); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; __pyx_t_5 = 0; @@ -7402,7 +7476,7 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_23generator1(__pyx_Co __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } @@ -7412,7 +7486,7 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_23generator1(__pyx_Co if (unlikely(size != 3)) { if (size > 3) __Pyx_RaiseTooManyValuesError(3); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 239, __pyx_L1_error) + __PYX_ERR(0, 242, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -7428,17 +7502,17 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_23generator1(__pyx_Co __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; - __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); @@ -7448,7 +7522,7 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_23generator1(__pyx_Co __Pyx_GOTREF(__pyx_t_3); index = 2; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed; __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) __PYX_ERR(0, 239, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) __PYX_ERR(0, 242, __pyx_L1_error) __pyx_t_7 = NULL; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L5_unpacking_done; @@ -7456,7 +7530,7 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_23generator1(__pyx_Co __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_7 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 239, __pyx_L1_error) + __PYX_ERR(0, 242, __pyx_L1_error) __pyx_L5_unpacking_done:; } __Pyx_GIVEREF(__pyx_t_2); @@ -7469,7 +7543,7 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_23generator1(__pyx_Co __pyx_cur_scope->__pyx_v_attrs = __pyx_t_4; __pyx_t_4 = 0; - /* "ssh2/sftp_handle.pyx":240 + /* "ssh2/sftp_handle.pyx":243 * :rtype: iter(bytes)""" * rc, buf, attrs = self._readdir(buffer_maxlen) * while rc == c_ssh2.LIBSSH2_ERROR_EAGAIN or rc > 0: # <<<<<<<<<<<<<< @@ -7477,42 +7551,42 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_23generator1(__pyx_Co * rc, buf, attrs = self._readdir(buffer_maxlen) */ while (1) { - __pyx_t_1 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_ERROR_EAGAIN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_ERROR_EAGAIN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_rc, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 240, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_rc, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 240, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!__pyx_t_9) { } else { __pyx_t_8 = __pyx_t_9; goto __pyx_L8_bool_binop_done; } - __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_rc, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 240, __pyx_L1_error) - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 240, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_rc, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 243, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_8 = __pyx_t_9; __pyx_L8_bool_binop_done:; if (!__pyx_t_8) break; - /* "ssh2/sftp_handle.pyx":241 + /* "ssh2/sftp_handle.pyx":244 * rc, buf, attrs = self._readdir(buffer_maxlen) * while rc == c_ssh2.LIBSSH2_ERROR_EAGAIN or rc > 0: * yield rc, buf, attrs # <<<<<<<<<<<<<< * rc, buf, attrs = self._readdir(buffer_maxlen) * */ - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 244, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_rc); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_rc); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_rc)) __PYX_ERR(0, 241, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_rc)) __PYX_ERR(0, 244, __pyx_L1_error); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_buf); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_buf); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_cur_scope->__pyx_v_buf)) __PYX_ERR(0, 241, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_cur_scope->__pyx_v_buf)) __PYX_ERR(0, 244, __pyx_L1_error); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_attrs); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_attrs); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_cur_scope->__pyx_v_attrs)) __PYX_ERR(0, 241, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_cur_scope->__pyx_v_attrs)) __PYX_ERR(0, 244, __pyx_L1_error); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; __Pyx_XGIVEREF(__pyx_r); @@ -7522,18 +7596,18 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_23generator1(__pyx_Co __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L10_resume_from_yield:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 241, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 244, __pyx_L1_error) - /* "ssh2/sftp_handle.pyx":242 + /* "ssh2/sftp_handle.pyx":245 * while rc == c_ssh2.LIBSSH2_ERROR_EAGAIN or rc > 0: * yield rc, buf, attrs * rc, buf, attrs = self._readdir(buffer_maxlen) # <<<<<<<<<<<<<< * * def _readdir(self, */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_readdir_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_readdir_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_cur_scope->__pyx_v_buffer_maxlen); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 242, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_cur_scope->__pyx_v_buffer_maxlen); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = NULL; __pyx_t_5 = 0; @@ -7554,7 +7628,7 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_23generator1(__pyx_Co __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 242, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } @@ -7564,7 +7638,7 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_23generator1(__pyx_Co if (unlikely(size != 3)) { if (size > 3) __Pyx_RaiseTooManyValuesError(3); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 242, __pyx_L1_error) + __PYX_ERR(0, 245, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -7580,17 +7654,17 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_23generator1(__pyx_Co __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); #else - __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 242, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 242, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { Py_ssize_t index = -1; - __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 242, __pyx_L1_error) + __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); @@ -7600,7 +7674,7 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_23generator1(__pyx_Co __Pyx_GOTREF(__pyx_t_3); index = 2; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L11_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) __PYX_ERR(0, 242, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) __PYX_ERR(0, 245, __pyx_L1_error) __pyx_t_7 = NULL; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L12_unpacking_done; @@ -7608,7 +7682,7 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_23generator1(__pyx_Co __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_7 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 242, __pyx_L1_error) + __PYX_ERR(0, 245, __pyx_L1_error) __pyx_L12_unpacking_done:; } __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_rc); @@ -7626,10 +7700,10 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_23generator1(__pyx_Co } CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); - /* "ssh2/sftp_handle.pyx":229 + /* "ssh2/sftp_handle.pyx":232 * return rc, buf, b_longentry, attrs * - * def readdir(self, size_t buffer_maxlen=1024): # <<<<<<<<<<<<<< + * def readdir(self, size_t buffer_maxlen=1024) -> Generator[Tuple[int, bytes, SFTPAttributes]]: # <<<<<<<<<<<<<< * """Get directory listing from file handle, if any. * */ @@ -7656,7 +7730,7 @@ static PyObject *__pyx_gb_4ssh2_11sftp_handle_10SFTPHandle_23generator1(__pyx_Co return __pyx_r; } -/* "ssh2/sftp_handle.pyx":244 +/* "ssh2/sftp_handle.pyx":247 * rc, buf, attrs = self._readdir(buffer_maxlen) * * def _readdir(self, # <<<<<<<<<<<<<< @@ -7672,7 +7746,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_24_readdir, "SFTPHandle._readdir(self, size_t buffer_maxlen=1024)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_24_readdir, "_readdir(self, buffer_maxlen: int = 1024)"); static PyMethodDef __pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_25_readdir = {"_readdir", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_25_readdir, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_24_readdir}; static PyObject *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_25_readdir(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -7717,12 +7791,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_buffer_maxlen); if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 244, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 247, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_readdir") < 0)) __PYX_ERR(0, 244, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_readdir") < 0)) __PYX_ERR(0, 247, __pyx_L3_error) } } else { switch (__pyx_nargs) { @@ -7733,14 +7807,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } } if (values[0]) { - __pyx_v_buffer_maxlen = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_buffer_maxlen == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 245, __pyx_L3_error) + __pyx_v_buffer_maxlen = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_buffer_maxlen == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 248, __pyx_L3_error) } else { __pyx_v_buffer_maxlen = ((size_t)0x400); } } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_readdir", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 244, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("_readdir", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 247, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -7791,7 +7865,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_24_readdir(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_readdir", 1); - /* "ssh2/sftp_handle.pyx":246 + /* "ssh2/sftp_handle.pyx":249 * def _readdir(self, * size_t buffer_maxlen=1024): * cdef bytes buf = b'' # <<<<<<<<<<<<<< @@ -7801,19 +7875,19 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_24_readdir(struct __p __Pyx_INCREF(__pyx_kp_b__2); __pyx_v_buf = __pyx_kp_b__2; - /* "ssh2/sftp_handle.pyx":248 + /* "ssh2/sftp_handle.pyx":251 * cdef bytes buf = b'' * cdef char *cbuf * cdef SFTPAttributes attrs = SFTPAttributes() # <<<<<<<<<<<<<< * with nogil: * cbuf = malloc(sizeof(char)*buffer_maxlen) */ - __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_attrs = ((struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes *)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/sftp_handle.pyx":249 + /* "ssh2/sftp_handle.pyx":252 * cdef char *cbuf * cdef SFTPAttributes attrs = SFTPAttributes() * with nogil: # <<<<<<<<<<<<<< @@ -7829,7 +7903,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_24_readdir(struct __p #endif /*try:*/ { - /* "ssh2/sftp_handle.pyx":250 + /* "ssh2/sftp_handle.pyx":253 * cdef SFTPAttributes attrs = SFTPAttributes() * with nogil: * cbuf = malloc(sizeof(char)*buffer_maxlen) # <<<<<<<<<<<<<< @@ -7838,7 +7912,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_24_readdir(struct __p */ __pyx_v_cbuf = ((char *)malloc(((sizeof(char)) * __pyx_v_buffer_maxlen))); - /* "ssh2/sftp_handle.pyx":251 + /* "ssh2/sftp_handle.pyx":254 * with nogil: * cbuf = malloc(sizeof(char)*buffer_maxlen) * if cbuf is NULL: # <<<<<<<<<<<<<< @@ -7848,7 +7922,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_24_readdir(struct __p __pyx_t_2 = (__pyx_v_cbuf == NULL); if (unlikely(__pyx_t_2)) { - /* "ssh2/sftp_handle.pyx":252 + /* "ssh2/sftp_handle.pyx":255 * cbuf = malloc(sizeof(char)*buffer_maxlen) * if cbuf is NULL: * with gil: # <<<<<<<<<<<<<< @@ -7861,17 +7935,17 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_24_readdir(struct __p #endif /*try:*/ { - /* "ssh2/sftp_handle.pyx":253 + /* "ssh2/sftp_handle.pyx":256 * if cbuf is NULL: * with gil: * raise MemoryError # <<<<<<<<<<<<<< * rc = c_sftp.libssh2_sftp_readdir( * self._handle, cbuf, buffer_maxlen, attrs._attrs) */ - PyErr_NoMemory(); __PYX_ERR(0, 253, __pyx_L8_error) + PyErr_NoMemory(); __PYX_ERR(0, 256, __pyx_L8_error) } - /* "ssh2/sftp_handle.pyx":252 + /* "ssh2/sftp_handle.pyx":255 * cbuf = malloc(sizeof(char)*buffer_maxlen) * if cbuf is NULL: * with gil: # <<<<<<<<<<<<<< @@ -7888,7 +7962,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_24_readdir(struct __p } } - /* "ssh2/sftp_handle.pyx":251 + /* "ssh2/sftp_handle.pyx":254 * with nogil: * cbuf = malloc(sizeof(char)*buffer_maxlen) * if cbuf is NULL: # <<<<<<<<<<<<<< @@ -7897,7 +7971,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_24_readdir(struct __p */ } - /* "ssh2/sftp_handle.pyx":254 + /* "ssh2/sftp_handle.pyx":257 * with gil: * raise MemoryError * rc = c_sftp.libssh2_sftp_readdir( # <<<<<<<<<<<<<< @@ -7907,7 +7981,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_24_readdir(struct __p __pyx_v_rc = libssh2_sftp_readdir(__pyx_v_self->_handle, __pyx_v_cbuf, __pyx_v_buffer_maxlen, __pyx_v_attrs->_attrs); } - /* "ssh2/sftp_handle.pyx":249 + /* "ssh2/sftp_handle.pyx":252 * cdef char *cbuf * cdef SFTPAttributes attrs = SFTPAttributes() * with nogil: # <<<<<<<<<<<<<< @@ -7933,7 +8007,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_24_readdir(struct __p } } - /* "ssh2/sftp_handle.pyx":256 + /* "ssh2/sftp_handle.pyx":259 * rc = c_sftp.libssh2_sftp_readdir( * self._handle, cbuf, buffer_maxlen, attrs._attrs) * try: # <<<<<<<<<<<<<< @@ -7942,7 +8016,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_24_readdir(struct __p */ /*try:*/ { - /* "ssh2/sftp_handle.pyx":257 + /* "ssh2/sftp_handle.pyx":260 * self._handle, cbuf, buffer_maxlen, attrs._attrs) * try: * if rc > 0: # <<<<<<<<<<<<<< @@ -7952,19 +8026,19 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_24_readdir(struct __p __pyx_t_2 = (__pyx_v_rc > 0); if (__pyx_t_2) { - /* "ssh2/sftp_handle.pyx":258 + /* "ssh2/sftp_handle.pyx":261 * try: * if rc > 0: * buf = cbuf[:rc] # <<<<<<<<<<<<<< * finally: * free(cbuf) */ - __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_cbuf + 0, __pyx_v_rc - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L11_error) + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_cbuf + 0, __pyx_v_rc - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF_SET(__pyx_v_buf, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0; - /* "ssh2/sftp_handle.pyx":257 + /* "ssh2/sftp_handle.pyx":260 * self._handle, cbuf, buffer_maxlen, attrs._attrs) * try: * if rc > 0: # <<<<<<<<<<<<<< @@ -7974,7 +8048,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_24_readdir(struct __p } } - /* "ssh2/sftp_handle.pyx":260 + /* "ssh2/sftp_handle.pyx":263 * buf = cbuf[:rc] * finally: * free(cbuf) # <<<<<<<<<<<<<< @@ -8021,32 +8095,32 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_24_readdir(struct __p __pyx_L12:; } - /* "ssh2/sftp_handle.pyx":261 + /* "ssh2/sftp_handle.pyx":264 * finally: * free(cbuf) * return rc, buf, attrs # <<<<<<<<<<<<<< * - * def write(self, bytes buf): + * def write(self, bytes buf) -> Tuple[int, bytes]: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 261, __pyx_L1_error) + __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 264, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_1)) __PYX_ERR(0, 264, __pyx_L1_error); __Pyx_INCREF(__pyx_v_buf); __Pyx_GIVEREF(__pyx_v_buf); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_buf)) __PYX_ERR(0, 261, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_buf)) __PYX_ERR(0, 264, __pyx_L1_error); __Pyx_INCREF((PyObject *)__pyx_v_attrs); __Pyx_GIVEREF((PyObject *)__pyx_v_attrs); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 2, ((PyObject *)__pyx_v_attrs))) __PYX_ERR(0, 261, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 2, ((PyObject *)__pyx_v_attrs))) __PYX_ERR(0, 264, __pyx_L1_error); __pyx_t_1 = 0; __pyx_r = __pyx_t_12; __pyx_t_12 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":244 + /* "ssh2/sftp_handle.pyx":247 * rc, buf, attrs = self._readdir(buffer_maxlen) * * def _readdir(self, # <<<<<<<<<<<<<< @@ -8068,10 +8142,10 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_24_readdir(struct __p return __pyx_r; } -/* "ssh2/sftp_handle.pyx":263 +/* "ssh2/sftp_handle.pyx":266 * return rc, buf, attrs * - * def write(self, bytes buf): # <<<<<<<<<<<<<< + * def write(self, bytes buf) -> Tuple[int, bytes]: # <<<<<<<<<<<<<< * """Write buffer to file handle. * */ @@ -8084,7 +8158,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_26write, "SFTPHandle.write(self, bytes buf)\nWrite buffer to file handle.\n\n Returns tuple of (``error code``, ``bytes written``).\n\n In blocking mode ``bytes_written`` will always equal ``len(buf)`` if no\n errors have occurred which would raise exception.\n\n In non-blocking mode ``error_code`` can be LIBSSH2_ERROR_EAGAIN and\n ``bytes_written`` *can be less than* ``len(buf)``.\n\n Clients should resume from that point on next call to ``write``, ie\n ``buf[bytes_written_in_last_call:]``.\n\n :param buf: Buffer to write.\n :type buf: bytes\n\n :rtype: tuple(int, int)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_26write, "write(self, buf: bytes) -> Tuple[int, bytes]\nWrite buffer to file handle.\n\n Returns tuple of (``error code``, ``bytes written``).\n\n In blocking mode ``bytes_written`` will always equal ``len(buf)`` if no\n errors have occurred which would raise exception.\n\n In non-blocking mode ``error_code`` can be LIBSSH2_ERROR_EAGAIN and\n ``bytes_written`` *can be less than* ``len(buf)``.\n\n Clients should resume from that point on next call to ``write``, ie\n ``buf[bytes_written_in_last_call:]``.\n\n :param buf: Buffer to write.\n :type buf: bytes\n\n :rtype: tuple(int, int)"); static PyMethodDef __pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_27write = {"write", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_27write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_26write}; static PyObject *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_27write(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -8130,12 +8204,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 263, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 266, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "write") < 0)) __PYX_ERR(0, 263, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "write") < 0)) __PYX_ERR(0, 266, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; @@ -8146,7 +8220,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("write", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 263, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("write", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 266, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -8160,7 +8234,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buf), (&PyBytes_Type), 1, "buf", 1))) __PYX_ERR(0, 263, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buf), (&PyBytes_Type), 1, "buf", 1))) __PYX_ERR(0, 266, __pyx_L1_error) __pyx_r = __pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_26write(((struct __pyx_obj_4ssh2_11sftp_handle_SFTPHandle *)__pyx_v_self), __pyx_v_buf); /* function exit code */ @@ -8199,7 +8273,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_26write(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write", 1); - /* "ssh2/sftp_handle.pyx":281 + /* "ssh2/sftp_handle.pyx":284 * * :rtype: tuple(int, int)""" * cdef size_t _size = len(buf) # <<<<<<<<<<<<<< @@ -8208,12 +8282,12 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_26write(struct __pyx_ */ if (unlikely(__pyx_v_buf == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 281, __pyx_L1_error) + __PYX_ERR(0, 284, __pyx_L1_error) } - __pyx_t_1 = __Pyx_PyBytes_GET_SIZE(__pyx_v_buf); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 281, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBytes_GET_SIZE(__pyx_v_buf); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 284, __pyx_L1_error) __pyx_v__size = __pyx_t_1; - /* "ssh2/sftp_handle.pyx":282 + /* "ssh2/sftp_handle.pyx":285 * :rtype: tuple(int, int)""" * cdef size_t _size = len(buf) * cdef size_t tot_size = _size # <<<<<<<<<<<<<< @@ -8222,7 +8296,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_26write(struct __pyx_ */ __pyx_v_tot_size = __pyx_v__size; - /* "ssh2/sftp_handle.pyx":283 + /* "ssh2/sftp_handle.pyx":286 * cdef size_t _size = len(buf) * cdef size_t tot_size = _size * cdef size_t bytes_written = 0 # <<<<<<<<<<<<<< @@ -8231,7 +8305,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_26write(struct __pyx_ */ __pyx_v_bytes_written = 0; - /* "ssh2/sftp_handle.pyx":284 + /* "ssh2/sftp_handle.pyx":287 * cdef size_t tot_size = _size * cdef size_t bytes_written = 0 * cdef char *cbuf = buf # <<<<<<<<<<<<<< @@ -8240,12 +8314,12 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_26write(struct __pyx_ */ if (unlikely(__pyx_v_buf == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 284, __pyx_L1_error) + __PYX_ERR(0, 287, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_buf); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 284, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_buf); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 287, __pyx_L1_error) __pyx_v_cbuf = __pyx_t_2; - /* "ssh2/sftp_handle.pyx":285 + /* "ssh2/sftp_handle.pyx":288 * cdef size_t bytes_written = 0 * cdef char *cbuf = buf * cdef ssize_t rc = 0 # <<<<<<<<<<<<<< @@ -8254,7 +8328,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_26write(struct __pyx_ */ __pyx_v_rc = 0; - /* "ssh2/sftp_handle.pyx":286 + /* "ssh2/sftp_handle.pyx":289 * cdef char *cbuf = buf * cdef ssize_t rc = 0 * with nogil: # <<<<<<<<<<<<<< @@ -8270,7 +8344,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_26write(struct __pyx_ #endif /*try:*/ { - /* "ssh2/sftp_handle.pyx":287 + /* "ssh2/sftp_handle.pyx":290 * cdef ssize_t rc = 0 * with nogil: * while _size > 0: # <<<<<<<<<<<<<< @@ -8281,7 +8355,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_26write(struct __pyx_ __pyx_t_3 = (__pyx_v__size > 0); if (!__pyx_t_3) break; - /* "ssh2/sftp_handle.pyx":288 + /* "ssh2/sftp_handle.pyx":291 * with nogil: * while _size > 0: * rc = c_sftp.libssh2_sftp_write(self._handle, cbuf, _size) # <<<<<<<<<<<<<< @@ -8290,7 +8364,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_26write(struct __pyx_ */ __pyx_v_rc = libssh2_sftp_write(__pyx_v_self->_handle, __pyx_v_cbuf, __pyx_v__size); - /* "ssh2/sftp_handle.pyx":289 + /* "ssh2/sftp_handle.pyx":292 * while _size > 0: * rc = c_sftp.libssh2_sftp_write(self._handle, cbuf, _size) * if rc < 0 and rc != c_ssh2.LIBSSH2_ERROR_EAGAIN: # <<<<<<<<<<<<<< @@ -8308,7 +8382,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_26write(struct __pyx_ __pyx_L9_bool_binop_done:; if (__pyx_t_3) { - /* "ssh2/sftp_handle.pyx":291 + /* "ssh2/sftp_handle.pyx":294 * if rc < 0 and rc != c_ssh2.LIBSSH2_ERROR_EAGAIN: * # Error we cannot resume from, exception will be raised * with gil: # <<<<<<<<<<<<<< @@ -8321,7 +8395,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_26write(struct __pyx_ #endif /*try:*/ { - /* "ssh2/sftp_handle.pyx":292 + /* "ssh2/sftp_handle.pyx":295 * # Error we cannot resume from, exception will be raised * with gil: * return handle_error_codes(rc) # <<<<<<<<<<<<<< @@ -8329,15 +8403,16 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_26write(struct __pyx_ * break */ __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, 292, __pyx_L14_error) - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 292, __pyx_L14_error) + __pyx_t_5 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 295, __pyx_L14_error) + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 295, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_r = __pyx_t_6; + if (!(likely(PyTuple_CheckExact(__pyx_t_6)) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_6))) __PYX_ERR(0, 295, __pyx_L14_error) + __pyx_r = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L13_return; } - /* "ssh2/sftp_handle.pyx":291 + /* "ssh2/sftp_handle.pyx":294 * if rc < 0 and rc != c_ssh2.LIBSSH2_ERROR_EAGAIN: * # Error we cannot resume from, exception will be raised * with gil: # <<<<<<<<<<<<<< @@ -8360,7 +8435,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_26write(struct __pyx_ } } - /* "ssh2/sftp_handle.pyx":289 + /* "ssh2/sftp_handle.pyx":292 * while _size > 0: * rc = c_sftp.libssh2_sftp_write(self._handle, cbuf, _size) * if rc < 0 and rc != c_ssh2.LIBSSH2_ERROR_EAGAIN: # <<<<<<<<<<<<<< @@ -8369,7 +8444,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_26write(struct __pyx_ */ } - /* "ssh2/sftp_handle.pyx":293 + /* "ssh2/sftp_handle.pyx":296 * with gil: * return handle_error_codes(rc) * elif rc == c_ssh2.LIBSSH2_ERROR_EAGAIN: # <<<<<<<<<<<<<< @@ -8379,7 +8454,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_26write(struct __pyx_ __pyx_t_3 = (__pyx_v_rc == LIBSSH2_ERROR_EAGAIN); if (__pyx_t_3) { - /* "ssh2/sftp_handle.pyx":294 + /* "ssh2/sftp_handle.pyx":297 * return handle_error_codes(rc) * elif rc == c_ssh2.LIBSSH2_ERROR_EAGAIN: * break # <<<<<<<<<<<<<< @@ -8388,7 +8463,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_26write(struct __pyx_ */ goto __pyx_L7_break; - /* "ssh2/sftp_handle.pyx":293 + /* "ssh2/sftp_handle.pyx":296 * with gil: * return handle_error_codes(rc) * elif rc == c_ssh2.LIBSSH2_ERROR_EAGAIN: # <<<<<<<<<<<<<< @@ -8397,7 +8472,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_26write(struct __pyx_ */ } - /* "ssh2/sftp_handle.pyx":295 + /* "ssh2/sftp_handle.pyx":298 * elif rc == c_ssh2.LIBSSH2_ERROR_EAGAIN: * break * cbuf += rc # <<<<<<<<<<<<<< @@ -8406,7 +8481,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_26write(struct __pyx_ */ __pyx_v_cbuf = (__pyx_v_cbuf + __pyx_v_rc); - /* "ssh2/sftp_handle.pyx":296 + /* "ssh2/sftp_handle.pyx":299 * break * cbuf += rc * _size -= rc # <<<<<<<<<<<<<< @@ -8417,7 +8492,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_26write(struct __pyx_ } __pyx_L7_break:; - /* "ssh2/sftp_handle.pyx":297 + /* "ssh2/sftp_handle.pyx":300 * cbuf += rc * _size -= rc * bytes_written = tot_size - _size # <<<<<<<<<<<<<< @@ -8427,7 +8502,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_26write(struct __pyx_ __pyx_v_bytes_written = (__pyx_v_tot_size - __pyx_v__size); } - /* "ssh2/sftp_handle.pyx":286 + /* "ssh2/sftp_handle.pyx":289 * cdef char *cbuf = buf * cdef ssize_t rc = 0 * with nogil: # <<<<<<<<<<<<<< @@ -8460,34 +8535,34 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_26write(struct __pyx_ } } - /* "ssh2/sftp_handle.pyx":298 + /* "ssh2/sftp_handle.pyx":301 * _size -= rc * bytes_written = tot_size - _size * return rc, bytes_written # <<<<<<<<<<<<<< * - * def fsync(self): + * def fsync(self) -> int: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_rc); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 298, __pyx_L1_error) + __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_rc); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_v_bytes_written); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 298, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_v_bytes_written); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 298, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_6); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6)) __PYX_ERR(0, 298, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6)) __PYX_ERR(0, 301, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_7); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7)) __PYX_ERR(0, 298, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7)) __PYX_ERR(0, 301, __pyx_L1_error); __pyx_t_6 = 0; __pyx_t_7 = 0; - __pyx_r = __pyx_t_8; + __pyx_r = ((PyObject*)__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":263 + /* "ssh2/sftp_handle.pyx":266 * return rc, buf, attrs * - * def write(self, bytes buf): # <<<<<<<<<<<<<< + * def write(self, bytes buf) -> Tuple[int, bytes]: # <<<<<<<<<<<<<< * """Write buffer to file handle. * */ @@ -8505,10 +8580,10 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_26write(struct __pyx_ return __pyx_r; } -/* "ssh2/sftp_handle.pyx":300 +/* "ssh2/sftp_handle.pyx":303 * return rc, bytes_written * - * def fsync(self): # <<<<<<<<<<<<<< + * def fsync(self) -> int: # <<<<<<<<<<<<<< * """Sync file handle data. * */ @@ -8521,7 +8596,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_28fsync, "SFTPHandle.fsync(self)\nSync file handle data.\n\n :rtype: int"); +PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_28fsync, "fsync(self) -> int\nSync file handle data.\n\n :rtype: int"); static PyMethodDef __pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_29fsync = {"fsync", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_29fsync, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_28fsync}; static PyObject *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_29fsync(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -8566,7 +8641,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_28fsync(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("fsync", 1); - /* "ssh2/sftp_handle.pyx":305 + /* "ssh2/sftp_handle.pyx":308 * :rtype: int""" * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -8582,7 +8657,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_28fsync(struct __pyx_ #endif /*try:*/ { - /* "ssh2/sftp_handle.pyx":306 + /* "ssh2/sftp_handle.pyx":309 * cdef int rc * with nogil: * rc = c_sftp.libssh2_sftp_fsync(self._handle) # <<<<<<<<<<<<<< @@ -8592,7 +8667,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_28fsync(struct __pyx_ __pyx_v_rc = libssh2_sftp_fsync(__pyx_v_self->_handle); } - /* "ssh2/sftp_handle.pyx":305 + /* "ssh2/sftp_handle.pyx":308 * :rtype: int""" * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -8611,25 +8686,26 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_28fsync(struct __pyx_ } } - /* "ssh2/sftp_handle.pyx":307 + /* "ssh2/sftp_handle.pyx":310 * with nogil: * rc = c_sftp.libssh2_sftp_fsync(self._handle) * return handle_error_codes(rc) # <<<<<<<<<<<<<< * - * def seek(self, size_t offset): + * def seek(self, size_t offset) -> 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, 307, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 310, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 310, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; + if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_t_2)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_t_2))) __PYX_ERR(0, 310, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":300 + /* "ssh2/sftp_handle.pyx":303 * return rc, bytes_written * - * def fsync(self): # <<<<<<<<<<<<<< + * def fsync(self) -> int: # <<<<<<<<<<<<<< * """Sync file handle data. * */ @@ -8645,10 +8721,10 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_28fsync(struct __pyx_ return __pyx_r; } -/* "ssh2/sftp_handle.pyx":309 +/* "ssh2/sftp_handle.pyx":312 * return handle_error_codes(rc) * - * def seek(self, size_t offset): # <<<<<<<<<<<<<< + * def seek(self, size_t offset) -> None: # <<<<<<<<<<<<<< * """Deprecated, use seek64. * */ @@ -8661,7 +8737,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_30seek, "SFTPHandle.seek(self, size_t offset)\nDeprecated, use seek64.\n\n Seek file to given offset.\n\n :param offset: Offset to seek to.\n :type offset: int\n\n :rtype: None"); +PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_30seek, "seek(self, offset: int) -> None\nDeprecated, use seek64.\n\n Seek file to given offset.\n\n :param offset: Offset to seek to.\n :type offset: int\n\n :rtype: None"); static PyMethodDef __pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_31seek = {"seek", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_31seek, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_30seek}; static PyObject *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_31seek(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -8707,23 +8783,23 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 309, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 312, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "seek") < 0)) __PYX_ERR(0, 309, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "seek") < 0)) __PYX_ERR(0, 312, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - __pyx_v_offset = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_offset == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 309, __pyx_L3_error) + __pyx_v_offset = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_offset == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 312, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("seek", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 309, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("seek", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 312, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -8755,7 +8831,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_30seek(struct __pyx_o __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("seek", 1); - /* "ssh2/sftp_handle.pyx":318 + /* "ssh2/sftp_handle.pyx":321 * * :rtype: None""" * with nogil: # <<<<<<<<<<<<<< @@ -8771,17 +8847,17 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_30seek(struct __pyx_o #endif /*try:*/ { - /* "ssh2/sftp_handle.pyx":319 + /* "ssh2/sftp_handle.pyx":322 * :rtype: None""" * with nogil: * c_sftp.libssh2_sftp_seek(self._handle, offset) # <<<<<<<<<<<<<< * - * def seek64(self, c_ssh2.libssh2_uint64_t offset): + * def seek64(self, c_ssh2.libssh2_uint64_t offset) -> None: */ libssh2_sftp_seek(__pyx_v_self->_handle, __pyx_v_offset); } - /* "ssh2/sftp_handle.pyx":318 + /* "ssh2/sftp_handle.pyx":321 * * :rtype: None""" * with nogil: # <<<<<<<<<<<<<< @@ -8800,10 +8876,10 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_30seek(struct __pyx_o } } - /* "ssh2/sftp_handle.pyx":309 + /* "ssh2/sftp_handle.pyx":312 * return handle_error_codes(rc) * - * def seek(self, size_t offset): # <<<<<<<<<<<<<< + * def seek(self, size_t offset) -> None: # <<<<<<<<<<<<<< * """Deprecated, use seek64. * */ @@ -8815,10 +8891,10 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_30seek(struct __pyx_o return __pyx_r; } -/* "ssh2/sftp_handle.pyx":321 +/* "ssh2/sftp_handle.pyx":324 * c_sftp.libssh2_sftp_seek(self._handle, offset) * - * def seek64(self, c_ssh2.libssh2_uint64_t offset): # <<<<<<<<<<<<<< + * def seek64(self, c_ssh2.libssh2_uint64_t offset) -> None: # <<<<<<<<<<<<<< * """Seek file to given 64-bit offset. * */ @@ -8831,7 +8907,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_32seek64, "SFTPHandle.seek64(self, libssh2_uint64_t offset)\nSeek file to given 64-bit offset.\n\n :param offset: Offset to seek to.\n :type offset: int\n\n :rtype: None"); +PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_32seek64, "seek64(self, offset: int) -> None\nSeek file to given 64-bit offset.\n\n :param offset: Offset to seek to.\n :type offset: int\n\n :rtype: None"); static PyMethodDef __pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_33seek64 = {"seek64", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_33seek64, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_32seek64}; static PyObject *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_33seek64(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -8877,23 +8953,23 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 321, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 324, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "seek64") < 0)) __PYX_ERR(0, 321, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "seek64") < 0)) __PYX_ERR(0, 324, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - __pyx_v_offset = __Pyx_PyInt_As_libssh2_uint64_t(values[0]); if (unlikely((__pyx_v_offset == ((libssh2_uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 321, __pyx_L3_error) + __pyx_v_offset = __Pyx_PyInt_As_libssh2_uint64_t(values[0]); if (unlikely((__pyx_v_offset == ((libssh2_uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 324, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("seek64", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 321, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("seek64", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 324, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -8925,7 +9001,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_32seek64(struct __pyx __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("seek64", 1); - /* "ssh2/sftp_handle.pyx":328 + /* "ssh2/sftp_handle.pyx":331 * * :rtype: None""" * with nogil: # <<<<<<<<<<<<<< @@ -8941,17 +9017,17 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_32seek64(struct __pyx #endif /*try:*/ { - /* "ssh2/sftp_handle.pyx":329 + /* "ssh2/sftp_handle.pyx":332 * :rtype: None""" * with nogil: * c_sftp.libssh2_sftp_seek64(self._handle, offset) # <<<<<<<<<<<<<< * - * def rewind(self): + * def rewind(self) -> None: */ libssh2_sftp_seek64(__pyx_v_self->_handle, __pyx_v_offset); } - /* "ssh2/sftp_handle.pyx":328 + /* "ssh2/sftp_handle.pyx":331 * * :rtype: None""" * with nogil: # <<<<<<<<<<<<<< @@ -8970,10 +9046,10 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_32seek64(struct __pyx } } - /* "ssh2/sftp_handle.pyx":321 + /* "ssh2/sftp_handle.pyx":324 * c_sftp.libssh2_sftp_seek(self._handle, offset) * - * def seek64(self, c_ssh2.libssh2_uint64_t offset): # <<<<<<<<<<<<<< + * def seek64(self, c_ssh2.libssh2_uint64_t offset) -> None: # <<<<<<<<<<<<<< * """Seek file to given 64-bit offset. * */ @@ -8985,10 +9061,10 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_32seek64(struct __pyx return __pyx_r; } -/* "ssh2/sftp_handle.pyx":331 +/* "ssh2/sftp_handle.pyx":334 * c_sftp.libssh2_sftp_seek64(self._handle, offset) * - * def rewind(self): # <<<<<<<<<<<<<< + * def rewind(self) -> None: # <<<<<<<<<<<<<< * """Rewind file handle to beginning of file. * */ @@ -9001,7 +9077,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_34rewind, "SFTPHandle.rewind(self)\nRewind file handle to beginning of file.\n\n :rtype: None"); +PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_34rewind, "rewind(self) -> None\nRewind file handle to beginning of file.\n\n :rtype: None"); static PyMethodDef __pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_35rewind = {"rewind", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_35rewind, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_34rewind}; static PyObject *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_35rewind(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -9040,7 +9116,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_34rewind(struct __pyx __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rewind", 1); - /* "ssh2/sftp_handle.pyx":335 + /* "ssh2/sftp_handle.pyx":338 * * :rtype: None""" * with nogil: # <<<<<<<<<<<<<< @@ -9056,7 +9132,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_34rewind(struct __pyx #endif /*try:*/ { - /* "ssh2/sftp_handle.pyx":336 + /* "ssh2/sftp_handle.pyx":339 * :rtype: None""" * with nogil: * c_sftp.libssh2_sftp_rewind(self._handle) # <<<<<<<<<<<<<< @@ -9066,7 +9142,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_34rewind(struct __pyx libssh2_sftp_rewind(__pyx_v_self->_handle); } - /* "ssh2/sftp_handle.pyx":335 + /* "ssh2/sftp_handle.pyx":338 * * :rtype: None""" * with nogil: # <<<<<<<<<<<<<< @@ -9085,10 +9161,10 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_34rewind(struct __pyx } } - /* "ssh2/sftp_handle.pyx":331 + /* "ssh2/sftp_handle.pyx":334 * c_sftp.libssh2_sftp_seek64(self._handle, offset) * - * def rewind(self): # <<<<<<<<<<<<<< + * def rewind(self) -> None: # <<<<<<<<<<<<<< * """Rewind file handle to beginning of file. * */ @@ -9100,7 +9176,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_34rewind(struct __pyx return __pyx_r; } -/* "ssh2/sftp_handle.pyx":338 +/* "ssh2/sftp_handle.pyx":341 * c_sftp.libssh2_sftp_rewind(self._handle) * * def tell(self): # <<<<<<<<<<<<<< @@ -9116,7 +9192,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_36tell, "SFTPHandle.tell(self)\nDeprecated, use tell64.\n\n Get current file handle offset.\n\n :rtype: int"); +PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_36tell, "tell(self)\nDeprecated, use tell64.\n\n Get current file handle offset.\n\n :rtype: int"); static PyMethodDef __pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_37tell = {"tell", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_37tell, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_36tell}; static PyObject *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_37tell(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -9161,7 +9237,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_36tell(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("tell", 1); - /* "ssh2/sftp_handle.pyx":345 + /* "ssh2/sftp_handle.pyx":348 * :rtype: int""" * cdef size_t rc * with nogil: # <<<<<<<<<<<<<< @@ -9177,7 +9253,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_36tell(struct __pyx_o #endif /*try:*/ { - /* "ssh2/sftp_handle.pyx":346 + /* "ssh2/sftp_handle.pyx":349 * cdef size_t rc * with nogil: * rc = c_sftp.libssh2_sftp_tell(self._handle) # <<<<<<<<<<<<<< @@ -9187,7 +9263,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_36tell(struct __pyx_o __pyx_v_rc = libssh2_sftp_tell(__pyx_v_self->_handle); } - /* "ssh2/sftp_handle.pyx":345 + /* "ssh2/sftp_handle.pyx":348 * :rtype: int""" * cdef size_t rc * with nogil: # <<<<<<<<<<<<<< @@ -9206,22 +9282,22 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_36tell(struct __pyx_o } } - /* "ssh2/sftp_handle.pyx":347 + /* "ssh2/sftp_handle.pyx":350 * with nogil: * rc = c_sftp.libssh2_sftp_tell(self._handle) * return handle_error_codes(rc) # <<<<<<<<<<<<<< * - * def tell64(self): + * def tell64(self) -> int: */ __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, 347, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 347, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 350, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 350, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":338 + /* "ssh2/sftp_handle.pyx":341 * c_sftp.libssh2_sftp_rewind(self._handle) * * def tell(self): # <<<<<<<<<<<<<< @@ -9240,10 +9316,10 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_36tell(struct __pyx_o return __pyx_r; } -/* "ssh2/sftp_handle.pyx":349 +/* "ssh2/sftp_handle.pyx":352 * return handle_error_codes(rc) * - * def tell64(self): # <<<<<<<<<<<<<< + * def tell64(self) -> int: # <<<<<<<<<<<<<< * """Get current file handle 64-bit offset. * */ @@ -9256,7 +9332,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_38tell64, "SFTPHandle.tell64(self)\nGet current file handle 64-bit offset.\n\n :rtype: int"); +PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_38tell64, "tell64(self) -> int\nGet current file handle 64-bit offset.\n\n :rtype: int"); static PyMethodDef __pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_39tell64 = {"tell64", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_39tell64, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_38tell64}; static PyObject *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_39tell64(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -9301,7 +9377,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_38tell64(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("tell64", 1); - /* "ssh2/sftp_handle.pyx":354 + /* "ssh2/sftp_handle.pyx":357 * :rtype: int""" * cdef c_ssh2.libssh2_uint64_t rc * with nogil: # <<<<<<<<<<<<<< @@ -9317,7 +9393,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_38tell64(struct __pyx #endif /*try:*/ { - /* "ssh2/sftp_handle.pyx":355 + /* "ssh2/sftp_handle.pyx":358 * cdef c_ssh2.libssh2_uint64_t rc * with nogil: * rc = c_sftp.libssh2_sftp_tell(self._handle) # <<<<<<<<<<<<<< @@ -9327,7 +9403,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_38tell64(struct __pyx __pyx_v_rc = libssh2_sftp_tell(__pyx_v_self->_handle); } - /* "ssh2/sftp_handle.pyx":354 + /* "ssh2/sftp_handle.pyx":357 * :rtype: int""" * cdef c_ssh2.libssh2_uint64_t rc * with nogil: # <<<<<<<<<<<<<< @@ -9346,25 +9422,26 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_38tell64(struct __pyx } } - /* "ssh2/sftp_handle.pyx":356 + /* "ssh2/sftp_handle.pyx":359 * with nogil: * rc = c_sftp.libssh2_sftp_tell(self._handle) * return handle_error_codes(rc) # <<<<<<<<<<<<<< * - * def fstat_ex(self, SFTPAttributes attrs, int setstat): + * def fstat_ex(self, SFTPAttributes attrs, int setstat) -> int: */ __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, 356, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 359, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 359, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; + if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_t_2)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_t_2))) __PYX_ERR(0, 359, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":349 + /* "ssh2/sftp_handle.pyx":352 * return handle_error_codes(rc) * - * def tell64(self): # <<<<<<<<<<<<<< + * def tell64(self) -> int: # <<<<<<<<<<<<<< * """Get current file handle 64-bit offset. * */ @@ -9380,10 +9457,10 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_38tell64(struct __pyx return __pyx_r; } -/* "ssh2/sftp_handle.pyx":358 +/* "ssh2/sftp_handle.pyx":361 * return handle_error_codes(rc) * - * def fstat_ex(self, SFTPAttributes attrs, int setstat): # <<<<<<<<<<<<<< + * def fstat_ex(self, SFTPAttributes attrs, int setstat) -> int: # <<<<<<<<<<<<<< * """Get or set file attributes. Clients would typically use one of the * fstat or fsetstat functions instead""" */ @@ -9396,7 +9473,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_40fstat_ex, "SFTPHandle.fstat_ex(self, SFTPAttributes attrs, int setstat)\nGet or set file attributes. Clients would typically use one of the\n fstat or fsetstat functions instead"); +PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_40fstat_ex, "fstat_ex(self, attrs: SFTPAttributes, setstat: int) -> int\nGet or set file attributes. Clients would typically use one of the\n fstat or fsetstat functions instead"); static PyMethodDef __pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_41fstat_ex = {"fstat_ex", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_41fstat_ex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_40fstat_ex}; static PyObject *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_41fstat_ex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -9445,7 +9522,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 358, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 361, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: @@ -9453,14 +9530,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 358, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 361, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("fstat_ex", 1, 2, 2, 1); __PYX_ERR(0, 358, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fstat_ex", 1, 2, 2, 1); __PYX_ERR(0, 361, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "fstat_ex") < 0)) __PYX_ERR(0, 358, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "fstat_ex") < 0)) __PYX_ERR(0, 361, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; @@ -9469,11 +9546,11 @@ PyObject *__pyx_args, PyObject *__pyx_kwds values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); } __pyx_v_attrs = ((struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes *)values[0]); - __pyx_v_setstat = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_setstat == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 358, __pyx_L3_error) + __pyx_v_setstat = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_setstat == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 361, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fstat_ex", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 358, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fstat_ex", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 361, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -9487,7 +9564,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_attrs), __pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes, 1, "attrs", 0))) __PYX_ERR(0, 358, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_attrs), __pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes, 1, "attrs", 0))) __PYX_ERR(0, 361, __pyx_L1_error) __pyx_r = __pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_40fstat_ex(((struct __pyx_obj_4ssh2_11sftp_handle_SFTPHandle *)__pyx_v_self), __pyx_v_attrs, __pyx_v_setstat); /* function exit code */ @@ -9516,7 +9593,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_40fstat_ex(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("fstat_ex", 1); - /* "ssh2/sftp_handle.pyx":362 + /* "ssh2/sftp_handle.pyx":365 * fstat or fsetstat functions instead""" * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -9532,7 +9609,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_40fstat_ex(struct __p #endif /*try:*/ { - /* "ssh2/sftp_handle.pyx":363 + /* "ssh2/sftp_handle.pyx":366 * cdef int rc * with nogil: * rc = c_sftp.libssh2_sftp_fstat_ex( # <<<<<<<<<<<<<< @@ -9542,7 +9619,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_40fstat_ex(struct __p __pyx_v_rc = libssh2_sftp_fstat_ex(__pyx_v_self->_handle, __pyx_v_attrs->_attrs, __pyx_v_setstat); } - /* "ssh2/sftp_handle.pyx":362 + /* "ssh2/sftp_handle.pyx":365 * fstat or fsetstat functions instead""" * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -9561,25 +9638,26 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_40fstat_ex(struct __p } } - /* "ssh2/sftp_handle.pyx":365 + /* "ssh2/sftp_handle.pyx":368 * rc = c_sftp.libssh2_sftp_fstat_ex( * self._handle, attrs._attrs, setstat) * return handle_error_codes(rc) # <<<<<<<<<<<<<< * - * def fstat(self): + * def fstat(self) -> SFTPAttributes: */ __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, 365, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 365, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 368, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 368, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; + if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_t_2)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_t_2))) __PYX_ERR(0, 368, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":358 + /* "ssh2/sftp_handle.pyx":361 * return handle_error_codes(rc) * - * def fstat_ex(self, SFTPAttributes attrs, int setstat): # <<<<<<<<<<<<<< + * def fstat_ex(self, SFTPAttributes attrs, int setstat) -> int: # <<<<<<<<<<<<<< * """Get or set file attributes. Clients would typically use one of the * fstat or fsetstat functions instead""" */ @@ -9595,25 +9673,25 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_40fstat_ex(struct __p return __pyx_r; } -/* "ssh2/sftp_handle.pyx":367 +/* "ssh2/sftp_handle.pyx":370 * return handle_error_codes(rc) * - * def fstat(self): # <<<<<<<<<<<<<< + * def fstat(self) -> SFTPAttributes: # <<<<<<<<<<<<<< * """Get file stat attributes from handle. * */ /* Python wrapper */ -static PyObject *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_43fstat(PyObject *__pyx_v_self, +static struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_43fstat(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_42fstat, "SFTPHandle.fstat(self)\nGet file stat attributes from handle.\n\n :rtype: :py:class:`ssh2.sftp.SFTPAttributes` or LIBSSH2_ERROR_EAGAIN"); +PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_42fstat, "fstat(self) -> SFTPAttributes\nGet file stat attributes from handle.\n\n :rtype: :py:class:`ssh2.sftp.SFTPAttributes` or LIBSSH2_ERROR_EAGAIN"); static PyMethodDef __pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_43fstat = {"fstat", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_43fstat, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_42fstat}; -static PyObject *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_43fstat(PyObject *__pyx_v_self, +static struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_43fstat(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -9624,7 +9702,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject *__pyx_r = 0; + struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fstat (wrapper)", 0); #if !CYTHON_METH_FASTCALL @@ -9645,10 +9723,10 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_42fstat(struct __pyx_obj_4ssh2_11sftp_handle_SFTPHandle *__pyx_v_self) { +static struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_42fstat(struct __pyx_obj_4ssh2_11sftp_handle_SFTPHandle *__pyx_v_self) { int __pyx_v_rc; struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes *__pyx_v_attrs = 0; - PyObject *__pyx_r = NULL; + struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; @@ -9658,19 +9736,19 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_42fstat(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("fstat", 1); - /* "ssh2/sftp_handle.pyx":372 + /* "ssh2/sftp_handle.pyx":375 * :rtype: :py:class:`ssh2.sftp.SFTPAttributes` or LIBSSH2_ERROR_EAGAIN""" * cdef int rc * cdef SFTPAttributes attrs = SFTPAttributes() # <<<<<<<<<<<<<< * with nogil: * rc = c_sftp.libssh2_sftp_fstat(self._handle, attrs._attrs) */ - __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 372, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 375, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_attrs = ((struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes *)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/sftp_handle.pyx":373 + /* "ssh2/sftp_handle.pyx":376 * cdef int rc * cdef SFTPAttributes attrs = SFTPAttributes() * with nogil: # <<<<<<<<<<<<<< @@ -9686,7 +9764,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_42fstat(struct __pyx_ #endif /*try:*/ { - /* "ssh2/sftp_handle.pyx":374 + /* "ssh2/sftp_handle.pyx":377 * cdef SFTPAttributes attrs = SFTPAttributes() * with nogil: * rc = c_sftp.libssh2_sftp_fstat(self._handle, attrs._attrs) # <<<<<<<<<<<<<< @@ -9696,7 +9774,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_42fstat(struct __pyx_ __pyx_v_rc = libssh2_sftp_fstat(__pyx_v_self->_handle, __pyx_v_attrs->_attrs); } - /* "ssh2/sftp_handle.pyx":373 + /* "ssh2/sftp_handle.pyx":376 * cdef int rc * cdef SFTPAttributes attrs = SFTPAttributes() * with nogil: # <<<<<<<<<<<<<< @@ -9715,7 +9793,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_42fstat(struct __pyx_ } } - /* "ssh2/sftp_handle.pyx":375 + /* "ssh2/sftp_handle.pyx":378 * with nogil: * rc = c_sftp.libssh2_sftp_fstat(self._handle, attrs._attrs) * if rc != 0: # <<<<<<<<<<<<<< @@ -9725,22 +9803,23 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_42fstat(struct __pyx_ __pyx_t_2 = (__pyx_v_rc != 0); if (__pyx_t_2) { - /* "ssh2/sftp_handle.pyx":376 + /* "ssh2/sftp_handle.pyx":379 * rc = c_sftp.libssh2_sftp_fstat(self._handle, attrs._attrs) * if rc != 0: * return handle_error_codes(rc) # <<<<<<<<<<<<<< * return attrs * */ - __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, 376, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 376, __pyx_L1_error) + __Pyx_XDECREF((PyObject *)__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, 379, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 379, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes)))) __PYX_ERR(0, 379, __pyx_L1_error) + __pyx_r = ((struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":375 + /* "ssh2/sftp_handle.pyx":378 * with nogil: * rc = c_sftp.libssh2_sftp_fstat(self._handle, attrs._attrs) * if rc != 0: # <<<<<<<<<<<<<< @@ -9749,22 +9828,22 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_42fstat(struct __pyx_ */ } - /* "ssh2/sftp_handle.pyx":377 + /* "ssh2/sftp_handle.pyx":380 * if rc != 0: * return handle_error_codes(rc) * return attrs # <<<<<<<<<<<<<< * - * def fsetstat(self, SFTPAttributes attrs): + * def fsetstat(self, SFTPAttributes attrs) -> int: */ - __Pyx_XDECREF(__pyx_r); + __Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_attrs); - __pyx_r = ((PyObject *)__pyx_v_attrs); + __pyx_r = __pyx_v_attrs; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":367 + /* "ssh2/sftp_handle.pyx":370 * return handle_error_codes(rc) * - * def fstat(self): # <<<<<<<<<<<<<< + * def fstat(self) -> SFTPAttributes: # <<<<<<<<<<<<<< * """Get file stat attributes from handle. * */ @@ -9776,15 +9855,15 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_42fstat(struct __pyx_ __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_attrs); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "ssh2/sftp_handle.pyx":379 +/* "ssh2/sftp_handle.pyx":382 * return attrs * - * def fsetstat(self, SFTPAttributes attrs): # <<<<<<<<<<<<<< + * def fsetstat(self, SFTPAttributes attrs) -> int: # <<<<<<<<<<<<<< * """Set file handle attributes. * */ @@ -9797,7 +9876,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_44fsetstat, "SFTPHandle.fsetstat(self, SFTPAttributes attrs)\nSet file handle attributes.\n\n :param attrs: Attributes to set.\n :type attrs: :py:class:`ssh2.sftp.SFTPAttributes`"); +PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_44fsetstat, "fsetstat(self, attrs: SFTPAttributes) -> int\nSet file handle attributes.\n\n :param attrs: Attributes to set.\n :type attrs: :py:class:`ssh2.sftp.SFTPAttributes`"); static PyMethodDef __pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_45fsetstat = {"fsetstat", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_45fsetstat, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_44fsetstat}; static PyObject *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_45fsetstat(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -9843,12 +9922,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 379, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 382, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "fsetstat") < 0)) __PYX_ERR(0, 379, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "fsetstat") < 0)) __PYX_ERR(0, 382, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; @@ -9859,7 +9938,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fsetstat", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 379, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fsetstat", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 382, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -9873,7 +9952,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_attrs), __pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes, 1, "attrs", 0))) __PYX_ERR(0, 379, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_attrs), __pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes, 1, "attrs", 0))) __PYX_ERR(0, 382, __pyx_L1_error) __pyx_r = __pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_44fsetstat(((struct __pyx_obj_4ssh2_11sftp_handle_SFTPHandle *)__pyx_v_self), __pyx_v_attrs); /* function exit code */ @@ -9902,7 +9981,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_44fsetstat(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("fsetstat", 1); - /* "ssh2/sftp_handle.pyx":385 + /* "ssh2/sftp_handle.pyx":388 * :type attrs: :py:class:`ssh2.sftp.SFTPAttributes`""" * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -9918,7 +9997,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_44fsetstat(struct __p #endif /*try:*/ { - /* "ssh2/sftp_handle.pyx":386 + /* "ssh2/sftp_handle.pyx":389 * cdef int rc * with nogil: * rc = c_sftp.libssh2_sftp_fsetstat(self._handle, attrs._attrs) # <<<<<<<<<<<<<< @@ -9928,7 +10007,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_44fsetstat(struct __p __pyx_v_rc = libssh2_sftp_fsetstat(__pyx_v_self->_handle, __pyx_v_attrs->_attrs); } - /* "ssh2/sftp_handle.pyx":385 + /* "ssh2/sftp_handle.pyx":388 * :type attrs: :py:class:`ssh2.sftp.SFTPAttributes`""" * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -9947,25 +10026,26 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_44fsetstat(struct __p } } - /* "ssh2/sftp_handle.pyx":387 + /* "ssh2/sftp_handle.pyx":390 * with nogil: * rc = c_sftp.libssh2_sftp_fsetstat(self._handle, attrs._attrs) * return handle_error_codes(rc) # <<<<<<<<<<<<<< * - * def fstatvfs(self): + * def fstatvfs(self) -> SFTPStatVFS: */ __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, 387, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 387, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_rc, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 390, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 390, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; + if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_t_2)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_t_2))) __PYX_ERR(0, 390, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":379 + /* "ssh2/sftp_handle.pyx":382 * return attrs * - * def fsetstat(self, SFTPAttributes attrs): # <<<<<<<<<<<<<< + * def fsetstat(self, SFTPAttributes attrs) -> int: # <<<<<<<<<<<<<< * """Set file handle attributes. * */ @@ -9981,25 +10061,25 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_44fsetstat(struct __p return __pyx_r; } -/* "ssh2/sftp_handle.pyx":389 +/* "ssh2/sftp_handle.pyx":392 * return handle_error_codes(rc) * - * def fstatvfs(self): # <<<<<<<<<<<<<< + * def fstatvfs(self) -> SFTPStatVFS: # <<<<<<<<<<<<<< * """Get file system statistics for handle * */ /* Python wrapper */ -static PyObject *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_47fstatvfs(PyObject *__pyx_v_self, +static struct __pyx_obj_4ssh2_11sftp_handle_SFTPStatVFS *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_47fstatvfs(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_46fstatvfs, "SFTPHandle.fstatvfs(self)\nGet file system statistics for handle\n\n :rtype: `ssh2.sftp.SFTPStatVFS`"); +PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_46fstatvfs, "fstatvfs(self) -> SFTPStatVFS\nGet file system statistics for handle\n\n :rtype: `ssh2.sftp.SFTPStatVFS`"); static PyMethodDef __pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_47fstatvfs = {"fstatvfs", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_47fstatvfs, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_46fstatvfs}; -static PyObject *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_47fstatvfs(PyObject *__pyx_v_self, +static struct __pyx_obj_4ssh2_11sftp_handle_SFTPStatVFS *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_47fstatvfs(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -10010,7 +10090,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject *__pyx_r = 0; + struct __pyx_obj_4ssh2_11sftp_handle_SFTPStatVFS *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fstatvfs (wrapper)", 0); #if !CYTHON_METH_FASTCALL @@ -10031,10 +10111,10 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_46fstatvfs(struct __pyx_obj_4ssh2_11sftp_handle_SFTPHandle *__pyx_v_self) { +static struct __pyx_obj_4ssh2_11sftp_handle_SFTPStatVFS *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_46fstatvfs(struct __pyx_obj_4ssh2_11sftp_handle_SFTPHandle *__pyx_v_self) { struct __pyx_obj_4ssh2_11sftp_handle_SFTPStatVFS *__pyx_v_vfs = 0; int __pyx_v_rc; - PyObject *__pyx_r = NULL; + struct __pyx_obj_4ssh2_11sftp_handle_SFTPStatVFS *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; @@ -10044,19 +10124,19 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_46fstatvfs(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("fstatvfs", 1); - /* "ssh2/sftp_handle.pyx":393 + /* "ssh2/sftp_handle.pyx":396 * * :rtype: `ssh2.sftp.SFTPStatVFS`""" * cdef SFTPStatVFS vfs = SFTPStatVFS(self) # <<<<<<<<<<<<<< * cdef int rc * with nogil: */ - __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPStatVFS), ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 393, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPStatVFS), ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 396, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_vfs = ((struct __pyx_obj_4ssh2_11sftp_handle_SFTPStatVFS *)__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/sftp_handle.pyx":395 + /* "ssh2/sftp_handle.pyx":398 * cdef SFTPStatVFS vfs = SFTPStatVFS(self) * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -10072,7 +10152,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_46fstatvfs(struct __p #endif /*try:*/ { - /* "ssh2/sftp_handle.pyx":396 + /* "ssh2/sftp_handle.pyx":399 * cdef int rc * with nogil: * rc = c_sftp.libssh2_sftp_fstatvfs(self._handle, vfs._ptr) # <<<<<<<<<<<<<< @@ -10082,7 +10162,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_46fstatvfs(struct __p __pyx_v_rc = libssh2_sftp_fstatvfs(__pyx_v_self->_handle, __pyx_v_vfs->_ptr); } - /* "ssh2/sftp_handle.pyx":395 + /* "ssh2/sftp_handle.pyx":398 * cdef SFTPStatVFS vfs = SFTPStatVFS(self) * cdef int rc * with nogil: # <<<<<<<<<<<<<< @@ -10101,7 +10181,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_46fstatvfs(struct __p } } - /* "ssh2/sftp_handle.pyx":397 + /* "ssh2/sftp_handle.pyx":400 * with nogil: * rc = c_sftp.libssh2_sftp_fstatvfs(self._handle, vfs._ptr) * if rc != 0: # <<<<<<<<<<<<<< @@ -10111,22 +10191,23 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_46fstatvfs(struct __p __pyx_t_2 = (__pyx_v_rc != 0); if (__pyx_t_2) { - /* "ssh2/sftp_handle.pyx":398 + /* "ssh2/sftp_handle.pyx":401 * rc = c_sftp.libssh2_sftp_fstatvfs(self._handle, vfs._ptr) * if rc != 0: * return handle_error_codes(rc) # <<<<<<<<<<<<<< * return vfs * */ - __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, 398, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 398, __pyx_L1_error) + __Pyx_XDECREF((PyObject *)__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, 401, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 401, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4ssh2_11sftp_handle_SFTPStatVFS)))) __PYX_ERR(0, 401, __pyx_L1_error) + __pyx_r = ((struct __pyx_obj_4ssh2_11sftp_handle_SFTPStatVFS *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":397 + /* "ssh2/sftp_handle.pyx":400 * with nogil: * rc = c_sftp.libssh2_sftp_fstatvfs(self._handle, vfs._ptr) * if rc != 0: # <<<<<<<<<<<<<< @@ -10135,22 +10216,22 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_46fstatvfs(struct __p */ } - /* "ssh2/sftp_handle.pyx":399 + /* "ssh2/sftp_handle.pyx":402 * if rc != 0: * return handle_error_codes(rc) * return vfs # <<<<<<<<<<<<<< * * */ - __Pyx_XDECREF(__pyx_r); + __Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_vfs); - __pyx_r = ((PyObject *)__pyx_v_vfs); + __pyx_r = __pyx_v_vfs; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":389 + /* "ssh2/sftp_handle.pyx":392 * return handle_error_codes(rc) * - * def fstatvfs(self): # <<<<<<<<<<<<<< + * def fstatvfs(self) -> SFTPStatVFS: # <<<<<<<<<<<<<< * """Get file system statistics for handle * */ @@ -10162,7 +10243,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_46fstatvfs(struct __p __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_vfs); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -10181,7 +10262,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_48__reduce_cython__, "SFTPHandle.__reduce_cython__(self)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_48__reduce_cython__, "__reduce_cython__(self)"); static PyMethodDef __pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_49__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_49__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_48__reduce_cython__}; static PyObject *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_49__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -10262,7 +10343,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_50__setstate_cython__, "SFTPHandle.__setstate_cython__(self, __pyx_state)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_50__setstate_cython__, "__setstate_cython__(self, __pyx_state)"); static PyMethodDef __pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_51__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_51__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_11sftp_handle_10SFTPHandle_50__setstate_cython__}; static PyObject *__pyx_pw_4ssh2_11sftp_handle_10SFTPHandle_51__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -10383,7 +10464,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_10SFTPHandle_50__setstate_cython__ return __pyx_r; } -/* "ssh2/sftp_handle.pyx":405 +/* "ssh2/sftp_handle.pyx":408 * """File system statistics""" * * def __cinit__(self, _sftp_ref): # <<<<<<<<<<<<<< @@ -10427,12 +10508,12 @@ static int __pyx_pw_4ssh2_11sftp_handle_11SFTPStatVFS_1__cinit__(PyObject *__pyx (void)__Pyx_Arg_NewRef_VARARGS(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 405, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 408, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(0, 405, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(0, 408, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; @@ -10443,7 +10524,7 @@ static int __pyx_pw_4ssh2_11sftp_handle_11SFTPStatVFS_1__cinit__(PyObject *__pyx } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 405, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 408, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -10479,7 +10560,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS___cinit__(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 1); - /* "ssh2/sftp_handle.pyx":406 + /* "ssh2/sftp_handle.pyx":409 * * def __cinit__(self, _sftp_ref): * self._sftp_ref = _sftp_ref # <<<<<<<<<<<<<< @@ -10492,7 +10573,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS___cinit__(struct __pyx_obj __Pyx_DECREF(__pyx_v_self->_sftp_ref); __pyx_v_self->_sftp_ref = __pyx_v__sftp_ref; - /* "ssh2/sftp_handle.pyx":407 + /* "ssh2/sftp_handle.pyx":410 * def __cinit__(self, _sftp_ref): * self._sftp_ref = _sftp_ref * with nogil: # <<<<<<<<<<<<<< @@ -10508,7 +10589,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS___cinit__(struct __pyx_obj #endif /*try:*/ { - /* "ssh2/sftp_handle.pyx":408 + /* "ssh2/sftp_handle.pyx":411 * self._sftp_ref = _sftp_ref * with nogil: * self._ptr = malloc( # <<<<<<<<<<<<<< @@ -10517,7 +10598,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS___cinit__(struct __pyx_obj */ __pyx_v_self->_ptr = ((LIBSSH2_SFTP_STATVFS *)malloc((sizeof(LIBSSH2_SFTP_STATVFS)))); - /* "ssh2/sftp_handle.pyx":410 + /* "ssh2/sftp_handle.pyx":413 * self._ptr = malloc( * sizeof(c_sftp.LIBSSH2_SFTP_STATVFS)) * if self._ptr is NULL: # <<<<<<<<<<<<<< @@ -10527,7 +10608,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS___cinit__(struct __pyx_obj __pyx_t_1 = (__pyx_v_self->_ptr == NULL); if (unlikely(__pyx_t_1)) { - /* "ssh2/sftp_handle.pyx":411 + /* "ssh2/sftp_handle.pyx":414 * sizeof(c_sftp.LIBSSH2_SFTP_STATVFS)) * if self._ptr is NULL: * with gil: # <<<<<<<<<<<<<< @@ -10540,17 +10621,17 @@ static int __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS___cinit__(struct __pyx_obj #endif /*try:*/ { - /* "ssh2/sftp_handle.pyx":412 + /* "ssh2/sftp_handle.pyx":415 * if self._ptr is NULL: * with gil: * raise MemoryError # <<<<<<<<<<<<<< * self._ptr.f_bsize = 0 * self._ptr.f_frsize = 0 */ - PyErr_NoMemory(); __PYX_ERR(0, 412, __pyx_L8_error) + PyErr_NoMemory(); __PYX_ERR(0, 415, __pyx_L8_error) } - /* "ssh2/sftp_handle.pyx":411 + /* "ssh2/sftp_handle.pyx":414 * sizeof(c_sftp.LIBSSH2_SFTP_STATVFS)) * if self._ptr is NULL: * with gil: # <<<<<<<<<<<<<< @@ -10567,7 +10648,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS___cinit__(struct __pyx_obj } } - /* "ssh2/sftp_handle.pyx":410 + /* "ssh2/sftp_handle.pyx":413 * self._ptr = malloc( * sizeof(c_sftp.LIBSSH2_SFTP_STATVFS)) * if self._ptr is NULL: # <<<<<<<<<<<<<< @@ -10576,7 +10657,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS___cinit__(struct __pyx_obj */ } - /* "ssh2/sftp_handle.pyx":413 + /* "ssh2/sftp_handle.pyx":416 * with gil: * raise MemoryError * self._ptr.f_bsize = 0 # <<<<<<<<<<<<<< @@ -10585,7 +10666,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS___cinit__(struct __pyx_obj */ __pyx_v_self->_ptr->f_bsize = 0; - /* "ssh2/sftp_handle.pyx":414 + /* "ssh2/sftp_handle.pyx":417 * raise MemoryError * self._ptr.f_bsize = 0 * self._ptr.f_frsize = 0 # <<<<<<<<<<<<<< @@ -10594,7 +10675,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS___cinit__(struct __pyx_obj */ __pyx_v_self->_ptr->f_frsize = 0; - /* "ssh2/sftp_handle.pyx":415 + /* "ssh2/sftp_handle.pyx":418 * self._ptr.f_bsize = 0 * self._ptr.f_frsize = 0 * self._ptr.f_blocks = 0 # <<<<<<<<<<<<<< @@ -10603,7 +10684,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS___cinit__(struct __pyx_obj */ __pyx_v_self->_ptr->f_blocks = 0; - /* "ssh2/sftp_handle.pyx":416 + /* "ssh2/sftp_handle.pyx":419 * self._ptr.f_frsize = 0 * self._ptr.f_blocks = 0 * self._ptr.f_bfree = 0 # <<<<<<<<<<<<<< @@ -10612,7 +10693,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS___cinit__(struct __pyx_obj */ __pyx_v_self->_ptr->f_bfree = 0; - /* "ssh2/sftp_handle.pyx":417 + /* "ssh2/sftp_handle.pyx":420 * self._ptr.f_blocks = 0 * self._ptr.f_bfree = 0 * self._ptr.f_bavail = 0 # <<<<<<<<<<<<<< @@ -10621,7 +10702,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS___cinit__(struct __pyx_obj */ __pyx_v_self->_ptr->f_bavail = 0; - /* "ssh2/sftp_handle.pyx":418 + /* "ssh2/sftp_handle.pyx":421 * self._ptr.f_bfree = 0 * self._ptr.f_bavail = 0 * self._ptr.f_files = 0 # <<<<<<<<<<<<<< @@ -10630,7 +10711,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS___cinit__(struct __pyx_obj */ __pyx_v_self->_ptr->f_files = 0; - /* "ssh2/sftp_handle.pyx":419 + /* "ssh2/sftp_handle.pyx":422 * self._ptr.f_bavail = 0 * self._ptr.f_files = 0 * self._ptr.f_ffree = 0 # <<<<<<<<<<<<<< @@ -10639,7 +10720,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS___cinit__(struct __pyx_obj */ __pyx_v_self->_ptr->f_ffree = 0; - /* "ssh2/sftp_handle.pyx":420 + /* "ssh2/sftp_handle.pyx":423 * self._ptr.f_files = 0 * self._ptr.f_ffree = 0 * self._ptr.f_favail = 0 # <<<<<<<<<<<<<< @@ -10648,7 +10729,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS___cinit__(struct __pyx_obj */ __pyx_v_self->_ptr->f_favail = 0; - /* "ssh2/sftp_handle.pyx":421 + /* "ssh2/sftp_handle.pyx":424 * self._ptr.f_ffree = 0 * self._ptr.f_favail = 0 * self._ptr.f_fsid = 0 # <<<<<<<<<<<<<< @@ -10657,7 +10738,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS___cinit__(struct __pyx_obj */ __pyx_v_self->_ptr->f_fsid = 0; - /* "ssh2/sftp_handle.pyx":422 + /* "ssh2/sftp_handle.pyx":425 * self._ptr.f_favail = 0 * self._ptr.f_fsid = 0 * self._ptr.f_flag = 0 # <<<<<<<<<<<<<< @@ -10666,7 +10747,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS___cinit__(struct __pyx_obj */ __pyx_v_self->_ptr->f_flag = 0; - /* "ssh2/sftp_handle.pyx":423 + /* "ssh2/sftp_handle.pyx":426 * self._ptr.f_fsid = 0 * self._ptr.f_flag = 0 * self._ptr.f_namemax = 0 # <<<<<<<<<<<<<< @@ -10676,7 +10757,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS___cinit__(struct __pyx_obj __pyx_v_self->_ptr->f_namemax = 0; } - /* "ssh2/sftp_handle.pyx":407 + /* "ssh2/sftp_handle.pyx":410 * def __cinit__(self, _sftp_ref): * self._sftp_ref = _sftp_ref * with nogil: # <<<<<<<<<<<<<< @@ -10702,7 +10783,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS___cinit__(struct __pyx_obj } } - /* "ssh2/sftp_handle.pyx":405 + /* "ssh2/sftp_handle.pyx":408 * """File system statistics""" * * def __cinit__(self, _sftp_ref): # <<<<<<<<<<<<<< @@ -10721,7 +10802,7 @@ static int __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS___cinit__(struct __pyx_obj return __pyx_r; } -/* "ssh2/sftp_handle.pyx":425 +/* "ssh2/sftp_handle.pyx":428 * self._ptr.f_namemax = 0 * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -10745,7 +10826,7 @@ static void __pyx_pw_4ssh2_11sftp_handle_11SFTPStatVFS_3__dealloc__(PyObject *__ static void __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_2__dealloc__(struct __pyx_obj_4ssh2_11sftp_handle_SFTPStatVFS *__pyx_v_self) { int __pyx_t_1; - /* "ssh2/sftp_handle.pyx":426 + /* "ssh2/sftp_handle.pyx":429 * * def __dealloc__(self): * with nogil: # <<<<<<<<<<<<<< @@ -10761,7 +10842,7 @@ static void __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_2__dealloc__(struct __pyx #endif /*try:*/ { - /* "ssh2/sftp_handle.pyx":427 + /* "ssh2/sftp_handle.pyx":430 * def __dealloc__(self): * with nogil: * if self._ptr is not NULL: # <<<<<<<<<<<<<< @@ -10771,7 +10852,7 @@ static void __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_2__dealloc__(struct __pyx __pyx_t_1 = (__pyx_v_self->_ptr != NULL); if (__pyx_t_1) { - /* "ssh2/sftp_handle.pyx":428 + /* "ssh2/sftp_handle.pyx":431 * with nogil: * if self._ptr is not NULL: * free(self._ptr) # <<<<<<<<<<<<<< @@ -10780,7 +10861,7 @@ static void __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_2__dealloc__(struct __pyx */ free(__pyx_v_self->_ptr); - /* "ssh2/sftp_handle.pyx":427 + /* "ssh2/sftp_handle.pyx":430 * def __dealloc__(self): * with nogil: * if self._ptr is not NULL: # <<<<<<<<<<<<<< @@ -10790,7 +10871,7 @@ static void __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_2__dealloc__(struct __pyx } } - /* "ssh2/sftp_handle.pyx":426 + /* "ssh2/sftp_handle.pyx":429 * * def __dealloc__(self): * with nogil: # <<<<<<<<<<<<<< @@ -10809,7 +10890,7 @@ static void __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_2__dealloc__(struct __pyx } } - /* "ssh2/sftp_handle.pyx":425 + /* "ssh2/sftp_handle.pyx":428 * self._ptr.f_namemax = 0 * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -10820,11 +10901,11 @@ static void __pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_2__dealloc__(struct __pyx /* function exit code */ } -/* "ssh2/sftp_handle.pyx":430 +/* "ssh2/sftp_handle.pyx":433 * free(self._ptr) * * @property # <<<<<<<<<<<<<< - * def f_bsize(self): + * def f_bsize(self) -> int: * """File system block size""" */ @@ -10852,25 +10933,25 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_7f_bsize___get__(str int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 1); - /* "ssh2/sftp_handle.pyx":433 - * def f_bsize(self): + /* "ssh2/sftp_handle.pyx":436 + * def f_bsize(self) -> int: * """File system block size""" * return self._ptr.f_bsize # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_libssh2_uint64_t(__pyx_v_self->_ptr->f_bsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 433, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_libssh2_uint64_t(__pyx_v_self->_ptr->f_bsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 436, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":430 + /* "ssh2/sftp_handle.pyx":433 * free(self._ptr) * * @property # <<<<<<<<<<<<<< - * def f_bsize(self): + * def f_bsize(self) -> int: * """File system block size""" */ @@ -10885,11 +10966,11 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_7f_bsize___get__(str return __pyx_r; } -/* "ssh2/sftp_handle.pyx":435 +/* "ssh2/sftp_handle.pyx":438 * return self._ptr.f_bsize * * @property # <<<<<<<<<<<<<< - * def f_frsize(self): + * def f_frsize(self) -> int: * """Fragment size""" */ @@ -10917,25 +10998,25 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_8f_frsize___get__(st int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 1); - /* "ssh2/sftp_handle.pyx":438 - * def f_frsize(self): + /* "ssh2/sftp_handle.pyx":441 + * def f_frsize(self) -> int: * """Fragment size""" * return self._ptr.f_frsize # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_libssh2_uint64_t(__pyx_v_self->_ptr->f_frsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 438, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_libssh2_uint64_t(__pyx_v_self->_ptr->f_frsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":435 + /* "ssh2/sftp_handle.pyx":438 * return self._ptr.f_bsize * * @property # <<<<<<<<<<<<<< - * def f_frsize(self): + * def f_frsize(self) -> int: * """Fragment size""" */ @@ -10950,11 +11031,11 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_8f_frsize___get__(st return __pyx_r; } -/* "ssh2/sftp_handle.pyx":440 +/* "ssh2/sftp_handle.pyx":443 * return self._ptr.f_frsize * * @property # <<<<<<<<<<<<<< - * def f_blocks(self): + * def f_blocks(self) -> int: * """Size of fs in f_frsize units""" */ @@ -10982,25 +11063,25 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_8f_blocks___get__(st int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 1); - /* "ssh2/sftp_handle.pyx":443 - * def f_blocks(self): + /* "ssh2/sftp_handle.pyx":446 + * def f_blocks(self) -> int: * """Size of fs in f_frsize units""" * return self._ptr.f_blocks # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_libssh2_uint64_t(__pyx_v_self->_ptr->f_blocks); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 443, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_libssh2_uint64_t(__pyx_v_self->_ptr->f_blocks); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":440 + /* "ssh2/sftp_handle.pyx":443 * return self._ptr.f_frsize * * @property # <<<<<<<<<<<<<< - * def f_blocks(self): + * def f_blocks(self) -> int: * """Size of fs in f_frsize units""" */ @@ -11015,11 +11096,11 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_8f_blocks___get__(st return __pyx_r; } -/* "ssh2/sftp_handle.pyx":445 +/* "ssh2/sftp_handle.pyx":448 * return self._ptr.f_blocks * * @property # <<<<<<<<<<<<<< - * def f_bfree(self): + * def f_bfree(self) -> int: * """Free blocks""" */ @@ -11047,25 +11128,25 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_7f_bfree___get__(str int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 1); - /* "ssh2/sftp_handle.pyx":448 - * def f_bfree(self): + /* "ssh2/sftp_handle.pyx":451 + * def f_bfree(self) -> int: * """Free blocks""" * return self._ptr.f_bfree # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_libssh2_uint64_t(__pyx_v_self->_ptr->f_bfree); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 448, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_libssh2_uint64_t(__pyx_v_self->_ptr->f_bfree); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 451, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":445 + /* "ssh2/sftp_handle.pyx":448 * return self._ptr.f_blocks * * @property # <<<<<<<<<<<<<< - * def f_bfree(self): + * def f_bfree(self) -> int: * """Free blocks""" */ @@ -11080,11 +11161,11 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_7f_bfree___get__(str return __pyx_r; } -/* "ssh2/sftp_handle.pyx":450 +/* "ssh2/sftp_handle.pyx":453 * return self._ptr.f_bfree * * @property # <<<<<<<<<<<<<< - * def f_bavail(self): + * def f_bavail(self) -> int: * """Free blocks for non-root""" */ @@ -11112,25 +11193,25 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_8f_bavail___get__(st int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 1); - /* "ssh2/sftp_handle.pyx":453 - * def f_bavail(self): + /* "ssh2/sftp_handle.pyx":456 + * def f_bavail(self) -> int: * """Free blocks for non-root""" * return self._ptr.f_bavail # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_libssh2_uint64_t(__pyx_v_self->_ptr->f_bavail); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_libssh2_uint64_t(__pyx_v_self->_ptr->f_bavail); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":450 + /* "ssh2/sftp_handle.pyx":453 * return self._ptr.f_bfree * * @property # <<<<<<<<<<<<<< - * def f_bavail(self): + * def f_bavail(self) -> int: * """Free blocks for non-root""" */ @@ -11145,11 +11226,11 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_8f_bavail___get__(st return __pyx_r; } -/* "ssh2/sftp_handle.pyx":455 +/* "ssh2/sftp_handle.pyx":458 * return self._ptr.f_bavail * * @property # <<<<<<<<<<<<<< - * def f_files(self): + * def f_files(self) -> int: * """Inodes""" */ @@ -11177,25 +11258,25 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_7f_files___get__(str int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 1); - /* "ssh2/sftp_handle.pyx":458 - * def f_files(self): + /* "ssh2/sftp_handle.pyx":461 + * def f_files(self) -> int: * """Inodes""" * return self._ptr.f_files # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_libssh2_uint64_t(__pyx_v_self->_ptr->f_files); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 458, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_libssh2_uint64_t(__pyx_v_self->_ptr->f_files); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 461, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":455 + /* "ssh2/sftp_handle.pyx":458 * return self._ptr.f_bavail * * @property # <<<<<<<<<<<<<< - * def f_files(self): + * def f_files(self) -> int: * """Inodes""" */ @@ -11210,11 +11291,11 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_7f_files___get__(str return __pyx_r; } -/* "ssh2/sftp_handle.pyx":460 +/* "ssh2/sftp_handle.pyx":463 * return self._ptr.f_files * * @property # <<<<<<<<<<<<<< - * def f_ffree(self): + * def f_ffree(self) -> int: * """Free inodes""" */ @@ -11242,25 +11323,25 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_7f_ffree___get__(str int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 1); - /* "ssh2/sftp_handle.pyx":463 - * def f_ffree(self): + /* "ssh2/sftp_handle.pyx":466 + * def f_ffree(self) -> int: * """Free inodes""" * return self._ptr.f_ffree # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_libssh2_uint64_t(__pyx_v_self->_ptr->f_ffree); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_libssh2_uint64_t(__pyx_v_self->_ptr->f_ffree); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 466, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":460 + /* "ssh2/sftp_handle.pyx":463 * return self._ptr.f_files * * @property # <<<<<<<<<<<<<< - * def f_ffree(self): + * def f_ffree(self) -> int: * """Free inodes""" */ @@ -11275,11 +11356,11 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_7f_ffree___get__(str return __pyx_r; } -/* "ssh2/sftp_handle.pyx":465 +/* "ssh2/sftp_handle.pyx":468 * return self._ptr.f_ffree * * @property # <<<<<<<<<<<<<< - * def f_favail(self): + * def f_favail(self) -> int: * """Free inodes for non-root""" */ @@ -11307,25 +11388,25 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_8f_favail___get__(st int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 1); - /* "ssh2/sftp_handle.pyx":468 - * def f_favail(self): + /* "ssh2/sftp_handle.pyx":471 + * def f_favail(self) -> int: * """Free inodes for non-root""" * return self._ptr.f_favail # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_libssh2_uint64_t(__pyx_v_self->_ptr->f_favail); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 468, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_libssh2_uint64_t(__pyx_v_self->_ptr->f_favail); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":465 + /* "ssh2/sftp_handle.pyx":468 * return self._ptr.f_ffree * * @property # <<<<<<<<<<<<<< - * def f_favail(self): + * def f_favail(self) -> int: * """Free inodes for non-root""" */ @@ -11340,11 +11421,11 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_8f_favail___get__(st return __pyx_r; } -/* "ssh2/sftp_handle.pyx":470 +/* "ssh2/sftp_handle.pyx":473 * return self._ptr.f_favail * * @property # <<<<<<<<<<<<<< - * def f_fsid(self): + * def f_fsid(self) -> int: * """File system ID""" */ @@ -11372,25 +11453,25 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_6f_fsid___get__(stru int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 1); - /* "ssh2/sftp_handle.pyx":473 - * def f_fsid(self): + /* "ssh2/sftp_handle.pyx":476 + * def f_fsid(self) -> int: * """File system ID""" * return self._ptr.f_fsid # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_libssh2_uint64_t(__pyx_v_self->_ptr->f_fsid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 473, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_libssh2_uint64_t(__pyx_v_self->_ptr->f_fsid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 476, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":470 + /* "ssh2/sftp_handle.pyx":473 * return self._ptr.f_favail * * @property # <<<<<<<<<<<<<< - * def f_fsid(self): + * def f_fsid(self) -> int: * """File system ID""" */ @@ -11405,11 +11486,11 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_6f_fsid___get__(stru return __pyx_r; } -/* "ssh2/sftp_handle.pyx":475 +/* "ssh2/sftp_handle.pyx":478 * return self._ptr.f_fsid * * @property # <<<<<<<<<<<<<< - * def f_flag(self): + * def f_flag(self) -> int: * """File system mount flags. */ @@ -11437,7 +11518,7 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_6f_flag___get__(stru int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 1); - /* "ssh2/sftp_handle.pyx":481 + /* "ssh2/sftp_handle.pyx":484 * This property is a bit mask with defined bits * ``LIBSSH2_SFTP_ST_RDONLY`` and ``LIBSSH2_SFTP_ST_NOSUID``""" * return self._ptr.f_flag # <<<<<<<<<<<<<< @@ -11445,17 +11526,17 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_6f_flag___get__(stru * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_libssh2_uint64_t(__pyx_v_self->_ptr->f_flag); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_libssh2_uint64_t(__pyx_v_self->_ptr->f_flag); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 484, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":475 + /* "ssh2/sftp_handle.pyx":478 * return self._ptr.f_fsid * * @property # <<<<<<<<<<<<<< - * def f_flag(self): + * def f_flag(self) -> int: * """File system mount flags. */ @@ -11470,11 +11551,11 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_6f_flag___get__(stru return __pyx_r; } -/* "ssh2/sftp_handle.pyx":483 +/* "ssh2/sftp_handle.pyx":486 * return self._ptr.f_flag * * @property # <<<<<<<<<<<<<< - * def f_namemax(self): + * def f_namemax(self) -> int: * """Maximum filename length""" */ @@ -11502,23 +11583,23 @@ static PyObject *__pyx_pf_4ssh2_11sftp_handle_11SFTPStatVFS_9f_namemax___get__(s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 1); - /* "ssh2/sftp_handle.pyx":486 - * def f_namemax(self): + /* "ssh2/sftp_handle.pyx":489 + * def f_namemax(self) -> int: * """Maximum filename length""" * return self._ptr.f_namemax # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_libssh2_uint64_t(__pyx_v_self->_ptr->f_namemax); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_libssh2_uint64_t(__pyx_v_self->_ptr->f_namemax); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 489, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/sftp_handle.pyx":483 + /* "ssh2/sftp_handle.pyx":486 * return self._ptr.f_flag * * @property # <<<<<<<<<<<<<< - * def f_namemax(self): + * def f_namemax(self) -> int: * """Maximum filename length""" */ @@ -11547,7 +11628,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_11SFTPStatVFS_4__reduce_cython__, "SFTPStatVFS.__reduce_cython__(self)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_11SFTPStatVFS_4__reduce_cython__, "__reduce_cython__(self)"); static PyMethodDef __pyx_mdef_4ssh2_11sftp_handle_11SFTPStatVFS_5__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_11sftp_handle_11SFTPStatVFS_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_11sftp_handle_11SFTPStatVFS_4__reduce_cython__}; static PyObject *__pyx_pw_4ssh2_11sftp_handle_11SFTPStatVFS_5__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -11628,7 +11709,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_11SFTPStatVFS_6__setstate_cython__, "SFTPStatVFS.__setstate_cython__(self, __pyx_state)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_11sftp_handle_11SFTPStatVFS_6__setstate_cython__, "__setstate_cython__(self, __pyx_state)"); static PyMethodDef __pyx_mdef_4ssh2_11sftp_handle_11SFTPStatVFS_7__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_11sftp_handle_11SFTPStatVFS_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_11sftp_handle_11SFTPStatVFS_6__setstate_cython__}; static PyObject *__pyx_pw_4ssh2_11sftp_handle_11SFTPStatVFS_7__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -12106,13 +12187,13 @@ static PyMethodDef __pyx_methods_4ssh2_11sftp_handle_SFTPAttributes[] = { }; static struct PyGetSetDef __pyx_getsets_4ssh2_11sftp_handle_SFTPAttributes[] = { - {(char *)"flags", __pyx_getprop_4ssh2_11sftp_handle_14SFTPAttributes_flags, __pyx_setprop_4ssh2_11sftp_handle_14SFTPAttributes_flags, (char *)0, 0}, - {(char *)"filesize", __pyx_getprop_4ssh2_11sftp_handle_14SFTPAttributes_filesize, __pyx_setprop_4ssh2_11sftp_handle_14SFTPAttributes_filesize, (char *)0, 0}, - {(char *)"uid", __pyx_getprop_4ssh2_11sftp_handle_14SFTPAttributes_uid, __pyx_setprop_4ssh2_11sftp_handle_14SFTPAttributes_uid, (char *)0, 0}, - {(char *)"gid", __pyx_getprop_4ssh2_11sftp_handle_14SFTPAttributes_gid, __pyx_setprop_4ssh2_11sftp_handle_14SFTPAttributes_gid, (char *)0, 0}, - {(char *)"permissions", __pyx_getprop_4ssh2_11sftp_handle_14SFTPAttributes_permissions, __pyx_setprop_4ssh2_11sftp_handle_14SFTPAttributes_permissions, (char *)0, 0}, - {(char *)"atime", __pyx_getprop_4ssh2_11sftp_handle_14SFTPAttributes_atime, __pyx_setprop_4ssh2_11sftp_handle_14SFTPAttributes_atime, (char *)0, 0}, - {(char *)"mtime", __pyx_getprop_4ssh2_11sftp_handle_14SFTPAttributes_mtime, __pyx_setprop_4ssh2_11sftp_handle_14SFTPAttributes_mtime, (char *)0, 0}, + {(char *)"flags", __pyx_getprop_4ssh2_11sftp_handle_14SFTPAttributes_flags, __pyx_setprop_4ssh2_11sftp_handle_14SFTPAttributes_flags, (char *)PyDoc_STR("flags: int"), 0}, + {(char *)"filesize", __pyx_getprop_4ssh2_11sftp_handle_14SFTPAttributes_filesize, __pyx_setprop_4ssh2_11sftp_handle_14SFTPAttributes_filesize, (char *)PyDoc_STR("filesize: int"), 0}, + {(char *)"uid", __pyx_getprop_4ssh2_11sftp_handle_14SFTPAttributes_uid, __pyx_setprop_4ssh2_11sftp_handle_14SFTPAttributes_uid, (char *)PyDoc_STR("uid: int"), 0}, + {(char *)"gid", __pyx_getprop_4ssh2_11sftp_handle_14SFTPAttributes_gid, __pyx_setprop_4ssh2_11sftp_handle_14SFTPAttributes_gid, (char *)PyDoc_STR("gid: int"), 0}, + {(char *)"permissions", __pyx_getprop_4ssh2_11sftp_handle_14SFTPAttributes_permissions, __pyx_setprop_4ssh2_11sftp_handle_14SFTPAttributes_permissions, (char *)PyDoc_STR("permissions: int"), 0}, + {(char *)"atime", __pyx_getprop_4ssh2_11sftp_handle_14SFTPAttributes_atime, __pyx_setprop_4ssh2_11sftp_handle_14SFTPAttributes_atime, (char *)PyDoc_STR("atime: int"), 0}, + {(char *)"mtime", __pyx_getprop_4ssh2_11sftp_handle_14SFTPAttributes_mtime, __pyx_setprop_4ssh2_11sftp_handle_14SFTPAttributes_mtime, (char *)PyDoc_STR("mtime: int"), 0}, {0, 0, 0, 0, 0} }; #if CYTHON_USE_TYPE_SPECS @@ -12338,17 +12419,17 @@ static PyMethodDef __pyx_methods_4ssh2_11sftp_handle_SFTPStatVFS[] = { }; static struct PyGetSetDef __pyx_getsets_4ssh2_11sftp_handle_SFTPStatVFS[] = { - {(char *)"f_bsize", __pyx_getprop_4ssh2_11sftp_handle_11SFTPStatVFS_f_bsize, 0, (char *)PyDoc_STR("File system block size"), 0}, - {(char *)"f_frsize", __pyx_getprop_4ssh2_11sftp_handle_11SFTPStatVFS_f_frsize, 0, (char *)PyDoc_STR("Fragment size"), 0}, - {(char *)"f_blocks", __pyx_getprop_4ssh2_11sftp_handle_11SFTPStatVFS_f_blocks, 0, (char *)PyDoc_STR("Size of fs in f_frsize units"), 0}, - {(char *)"f_bfree", __pyx_getprop_4ssh2_11sftp_handle_11SFTPStatVFS_f_bfree, 0, (char *)PyDoc_STR("Free blocks"), 0}, - {(char *)"f_bavail", __pyx_getprop_4ssh2_11sftp_handle_11SFTPStatVFS_f_bavail, 0, (char *)PyDoc_STR("Free blocks for non-root"), 0}, - {(char *)"f_files", __pyx_getprop_4ssh2_11sftp_handle_11SFTPStatVFS_f_files, 0, (char *)PyDoc_STR("Inodes"), 0}, - {(char *)"f_ffree", __pyx_getprop_4ssh2_11sftp_handle_11SFTPStatVFS_f_ffree, 0, (char *)PyDoc_STR("Free inodes"), 0}, - {(char *)"f_favail", __pyx_getprop_4ssh2_11sftp_handle_11SFTPStatVFS_f_favail, 0, (char *)PyDoc_STR("Free inodes for non-root"), 0}, - {(char *)"f_fsid", __pyx_getprop_4ssh2_11sftp_handle_11SFTPStatVFS_f_fsid, 0, (char *)PyDoc_STR("File system ID"), 0}, - {(char *)"f_flag", __pyx_getprop_4ssh2_11sftp_handle_11SFTPStatVFS_f_flag, 0, (char *)PyDoc_STR("File system mount flags.\n\n This property is a bit mask with defined bits\n ``LIBSSH2_SFTP_ST_RDONLY`` and ``LIBSSH2_SFTP_ST_NOSUID``"), 0}, - {(char *)"f_namemax", __pyx_getprop_4ssh2_11sftp_handle_11SFTPStatVFS_f_namemax, 0, (char *)PyDoc_STR("Maximum filename length"), 0}, + {(char *)"f_bsize", __pyx_getprop_4ssh2_11sftp_handle_11SFTPStatVFS_f_bsize, 0, (char *)PyDoc_STR("f_bsize: int\nFile system block size"), 0}, + {(char *)"f_frsize", __pyx_getprop_4ssh2_11sftp_handle_11SFTPStatVFS_f_frsize, 0, (char *)PyDoc_STR("f_frsize: int\nFragment size"), 0}, + {(char *)"f_blocks", __pyx_getprop_4ssh2_11sftp_handle_11SFTPStatVFS_f_blocks, 0, (char *)PyDoc_STR("f_blocks: int\nSize of fs in f_frsize units"), 0}, + {(char *)"f_bfree", __pyx_getprop_4ssh2_11sftp_handle_11SFTPStatVFS_f_bfree, 0, (char *)PyDoc_STR("f_bfree: int\nFree blocks"), 0}, + {(char *)"f_bavail", __pyx_getprop_4ssh2_11sftp_handle_11SFTPStatVFS_f_bavail, 0, (char *)PyDoc_STR("f_bavail: int\nFree blocks for non-root"), 0}, + {(char *)"f_files", __pyx_getprop_4ssh2_11sftp_handle_11SFTPStatVFS_f_files, 0, (char *)PyDoc_STR("f_files: int\nInodes"), 0}, + {(char *)"f_ffree", __pyx_getprop_4ssh2_11sftp_handle_11SFTPStatVFS_f_ffree, 0, (char *)PyDoc_STR("f_ffree: int\nFree inodes"), 0}, + {(char *)"f_favail", __pyx_getprop_4ssh2_11sftp_handle_11SFTPStatVFS_f_favail, 0, (char *)PyDoc_STR("f_favail: int\nFree inodes for non-root"), 0}, + {(char *)"f_fsid", __pyx_getprop_4ssh2_11sftp_handle_11SFTPStatVFS_f_fsid, 0, (char *)PyDoc_STR("f_fsid: int\nFile system ID"), 0}, + {(char *)"f_flag", __pyx_getprop_4ssh2_11sftp_handle_11SFTPStatVFS_f_flag, 0, (char *)PyDoc_STR("f_flag: int\nFile system mount flags.\n\n This property is a bit mask with defined bits\n ``LIBSSH2_SFTP_ST_RDONLY`` and ``LIBSSH2_SFTP_ST_NOSUID``"), 0}, + {(char *)"f_namemax", __pyx_getprop_4ssh2_11sftp_handle_11SFTPStatVFS_f_namemax, 0, (char *)PyDoc_STR("f_namemax: int\nMaximum filename length"), 0}, {0, 0, 0, 0, 0} }; #if CYTHON_USE_TYPE_SPECS @@ -12832,7 +12913,11 @@ static PyMethodDef __pyx_methods[] = { static int __Pyx_CreateStringTabAndInitStrings(void) { __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_n_s_Generator, __pyx_k_Generator, sizeof(__pyx_k_Generator), 0, 0, 1, 1}, + {&__pyx_kp_s_Generator_Tuple_int_bytes_SFTPAt, __pyx_k_Generator_Tuple_int_bytes_SFTPAt, sizeof(__pyx_k_Generator_Tuple_int_bytes_SFTPAt), 0, 0, 1, 0}, + {&__pyx_kp_s_Generator_Tuple_int_bytes_bytes, __pyx_k_Generator_Tuple_int_bytes_bytes, sizeof(__pyx_k_Generator_Tuple_int_bytes_bytes), 0, 0, 1, 0}, {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, + {&__pyx_n_s_None, __pyx_k_None, sizeof(__pyx_k_None), 0, 0, 1, 1}, {&__pyx_n_s_SFTPAttributes, __pyx_k_SFTPAttributes, sizeof(__pyx_k_SFTPAttributes), 0, 0, 1, 1}, {&__pyx_n_s_SFTPAttributes___reduce_cython, __pyx_k_SFTPAttributes___reduce_cython, sizeof(__pyx_k_SFTPAttributes___reduce_cython), 0, 0, 1, 1}, {&__pyx_n_s_SFTPAttributes___setstate_cython, __pyx_k_SFTPAttributes___setstate_cython, sizeof(__pyx_k_SFTPAttributes___setstate_cython), 0, 0, 1, 1}, @@ -12862,9 +12947,12 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_SFTPStatVFS___reduce_cython, __pyx_k_SFTPStatVFS___reduce_cython, sizeof(__pyx_k_SFTPStatVFS___reduce_cython), 0, 0, 1, 1}, {&__pyx_n_s_SFTPStatVFS___setstate_cython, __pyx_k_SFTPStatVFS___setstate_cython, sizeof(__pyx_k_SFTPStatVFS___setstate_cython), 0, 0, 1, 1}, {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1}, + {&__pyx_n_s_Tuple, __pyx_k_Tuple, sizeof(__pyx_k_Tuple), 0, 0, 1, 1}, + {&__pyx_kp_s_Tuple_int_bytes, __pyx_k_Tuple_int_bytes, sizeof(__pyx_k_Tuple_int_bytes), 0, 0, 1, 0}, {&__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_n_s__45, __pyx_k__45, sizeof(__pyx_k__45), 0, 0, 1, 1}, + {&__pyx_n_s__46, __pyx_k__46, sizeof(__pyx_k__46), 0, 0, 1, 1}, + {&__pyx_kp_u__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 1, 0, 0}, {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1}, {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, {&__pyx_n_s_attrs, __pyx_k_attrs, sizeof(__pyx_k_attrs), 0, 0, 1, 1}, @@ -12888,6 +12976,8 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_fsync, __pyx_k_fsync, sizeof(__pyx_k_fsync), 0, 0, 1, 1}, {&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0}, {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_int, __pyx_k_int, sizeof(__pyx_k_int), 0, 0, 1, 1}, {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0}, {&__pyx_n_s_longentry, __pyx_k_longentry, sizeof(__pyx_k_longentry), 0, 0, 1, 1}, @@ -12906,6 +12996,7 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, + {&__pyx_n_s_return, __pyx_k_return, sizeof(__pyx_k_return), 0, 0, 1, 1}, {&__pyx_n_s_rewind, __pyx_k_rewind, sizeof(__pyx_k_rewind), 0, 0, 1, 1}, {&__pyx_n_s_seek, __pyx_k_seek, sizeof(__pyx_k_seek), 0, 0, 1, 1}, {&__pyx_n_s_seek64, __pyx_k_seek64, sizeof(__pyx_k_seek64), 0, 0, 1, 1}, @@ -12925,6 +13016,7 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1}, {&__pyx_n_s_tot_size, __pyx_k_tot_size, sizeof(__pyx_k_tot_size), 0, 0, 1, 1}, + {&__pyx_n_s_typing, __pyx_k_typing, sizeof(__pyx_k_typing), 0, 0, 1, 1}, {&__pyx_n_s_vfs, __pyx_k_vfs, sizeof(__pyx_k_vfs), 0, 0, 1, 1}, {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} @@ -12933,9 +13025,9 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { } /* #### Code section: cached_builtins ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 43, __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_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(0, 132, __pyx_L1_error) + __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(0, 134, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -12951,10 +13043,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); - __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__6); + __Pyx_GIVEREF(__pyx_tuple__6); + __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(1, 1, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): @@ -12962,233 +13054,233 @@ 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__7 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 3, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); - __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(1, 3, __pyx_L1_error) + __pyx_tuple__8 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); + __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(1, 3, __pyx_L1_error) - /* "ssh2/sftp_handle.pyx":135 + /* "ssh2/sftp_handle.pyx":137 * return rc, data * * def __enter__(self): # <<<<<<<<<<<<<< * return self * */ - __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_enter, 135, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 135, __pyx_L1_error) + __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_enter, 137, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 137, __pyx_L1_error) - /* "ssh2/sftp_handle.pyx":138 + /* "ssh2/sftp_handle.pyx":140 * return self * * def __exit__(self, *args): # <<<<<<<<<<<<<< * self.close() * */ - __pyx_tuple__10 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_args); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); - __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_exit, 138, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 138, __pyx_L1_error) + __pyx_tuple__11 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_args); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 140, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); + __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_exit, 140, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 140, __pyx_L1_error) - /* "ssh2/sftp_handle.pyx":141 + /* "ssh2/sftp_handle.pyx":143 * self.close() * - * def close(self): # <<<<<<<<<<<<<< - * """Close handle. Called automatically when object is deleted - * and/or garbage collected. + * def close(self) -> int: # <<<<<<<<<<<<<< + * """Close handle. + * */ - __pyx_tuple__12 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 141, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); - __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_close, 141, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 141, __pyx_L1_error) + __pyx_tuple__13 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__13); + __Pyx_GIVEREF(__pyx_tuple__13); + __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_close, 143, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 143, __pyx_L1_error) - /* "ssh2/sftp_handle.pyx":155 + /* "ssh2/sftp_handle.pyx":158 * return rc * - * def read(self, size_t buffer_maxlen=c_ssh2.LIBSSH2_CHANNEL_WINDOW_DEFAULT): # <<<<<<<<<<<<<< + * def read(self, size_t buffer_maxlen=c_ssh2.LIBSSH2_CHANNEL_WINDOW_DEFAULT) -> Tuple[int, bytes]: # <<<<<<<<<<<<<< * """Read buffer from file handle. * */ - __pyx_tuple__14 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_buffer_maxlen, __pyx_n_s_rc, __pyx_n_s_buf, __pyx_n_s_cbuf); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 155, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); - __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_read, 155, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_tuple__15 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_buffer_maxlen, __pyx_n_s_rc, __pyx_n_s_buf, __pyx_n_s_cbuf); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__15); + __Pyx_GIVEREF(__pyx_tuple__15); + __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_read, 158, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 158, __pyx_L1_error) - /* "ssh2/sftp_handle.pyx":180 + /* "ssh2/sftp_handle.pyx":183 * return rc, buf * * def readdir_ex(self, # <<<<<<<<<<<<<< * size_t longentry_maxlen=1024, - * size_t buffer_maxlen=1024): + * size_t buffer_maxlen=1024) -> Generator[Tuple[int, bytes, bytes, SFTPAttributes]]: */ - __pyx_tuple__16 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_longentry_maxlen, __pyx_n_s_buffer_maxlen, __pyx_n_s_rc, __pyx_n_s_buf, __pyx_n_s_entry, __pyx_n_s_attrs, __pyx_n_s_entryb); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 180, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_GIVEREF(__pyx_tuple__16); - __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_readdir_ex, 180, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 180, __pyx_L1_error) - __pyx_tuple__17 = PyTuple_Pack(2, __pyx_int_1024, __pyx_int_1024); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 180, __pyx_L1_error) + __pyx_tuple__17 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_longentry_maxlen, __pyx_n_s_buffer_maxlen, __pyx_n_s_rc, __pyx_n_s_buf, __pyx_n_s_entry, __pyx_n_s_attrs, __pyx_n_s_entryb); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__17); __Pyx_GIVEREF(__pyx_tuple__17); + __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_readdir_ex, 183, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 183, __pyx_L1_error) + __pyx_tuple__18 = PyTuple_Pack(2, __pyx_int_1024, __pyx_int_1024); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__18); + __Pyx_GIVEREF(__pyx_tuple__18); - /* "ssh2/sftp_handle.pyx":203 + /* "ssh2/sftp_handle.pyx":206 * buffer_maxlen=buffer_maxlen) * * def _readdir_ex(self, # <<<<<<<<<<<<<< * size_t longentry_maxlen=1024, * size_t buffer_maxlen=1024): */ - __pyx_tuple__18 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_longentry_maxlen, __pyx_n_s_buffer_maxlen, __pyx_n_s_buf, __pyx_n_s_b_longentry, __pyx_n_s_cbuf, __pyx_n_s_longentry, __pyx_n_s_attrs, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 203, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__18); - __Pyx_GIVEREF(__pyx_tuple__18); - __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_readdir_ex_2, 203, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 203, __pyx_L1_error) + __pyx_tuple__19 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_longentry_maxlen, __pyx_n_s_buffer_maxlen, __pyx_n_s_buf, __pyx_n_s_b_longentry, __pyx_n_s_cbuf, __pyx_n_s_longentry, __pyx_n_s_attrs, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__19); + __Pyx_GIVEREF(__pyx_tuple__19); + __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_readdir_ex_2, 206, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 206, __pyx_L1_error) - /* "ssh2/sftp_handle.pyx":229 + /* "ssh2/sftp_handle.pyx":232 * return rc, buf, b_longentry, attrs * - * def readdir(self, size_t buffer_maxlen=1024): # <<<<<<<<<<<<<< + * def readdir(self, size_t buffer_maxlen=1024) -> Generator[Tuple[int, bytes, SFTPAttributes]]: # <<<<<<<<<<<<<< * """Get directory listing from file handle, if any. * */ - __pyx_tuple__20 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_buffer_maxlen, __pyx_n_s_rc, __pyx_n_s_buf, __pyx_n_s_attrs); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__20); - __Pyx_GIVEREF(__pyx_tuple__20); - __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_readdir, 229, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 229, __pyx_L1_error) - __pyx_tuple__21 = PyTuple_Pack(1, __pyx_int_1024); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 229, __pyx_L1_error) + __pyx_tuple__21 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_buffer_maxlen, __pyx_n_s_rc, __pyx_n_s_buf, __pyx_n_s_attrs); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__21); __Pyx_GIVEREF(__pyx_tuple__21); + __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_readdir, 232, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 232, __pyx_L1_error) + __pyx_tuple__22 = PyTuple_Pack(1, __pyx_int_1024); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__22); + __Pyx_GIVEREF(__pyx_tuple__22); - /* "ssh2/sftp_handle.pyx":244 + /* "ssh2/sftp_handle.pyx":247 * rc, buf, attrs = self._readdir(buffer_maxlen) * * def _readdir(self, # <<<<<<<<<<<<<< * size_t buffer_maxlen=1024): * cdef bytes buf = b'' */ - __pyx_tuple__22 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_buffer_maxlen, __pyx_n_s_buf, __pyx_n_s_cbuf, __pyx_n_s_attrs, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 244, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__22); - __Pyx_GIVEREF(__pyx_tuple__22); - __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_readdir_2, 244, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 244, __pyx_L1_error) + __pyx_tuple__23 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_buffer_maxlen, __pyx_n_s_buf, __pyx_n_s_cbuf, __pyx_n_s_attrs, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 247, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__23); + __Pyx_GIVEREF(__pyx_tuple__23); + __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_readdir_2, 247, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 247, __pyx_L1_error) - /* "ssh2/sftp_handle.pyx":263 + /* "ssh2/sftp_handle.pyx":266 * return rc, buf, attrs * - * def write(self, bytes buf): # <<<<<<<<<<<<<< + * def write(self, bytes buf) -> Tuple[int, bytes]: # <<<<<<<<<<<<<< * """Write buffer to file handle. * */ - __pyx_tuple__24 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_size, __pyx_n_s_tot_size, __pyx_n_s_bytes_written, __pyx_n_s_cbuf, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 263, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__24); - __Pyx_GIVEREF(__pyx_tuple__24); - __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_write, 263, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 263, __pyx_L1_error) + __pyx_tuple__25 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_size, __pyx_n_s_tot_size, __pyx_n_s_bytes_written, __pyx_n_s_cbuf, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 266, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__25); + __Pyx_GIVEREF(__pyx_tuple__25); + __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_write, 266, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 266, __pyx_L1_error) - /* "ssh2/sftp_handle.pyx":300 + /* "ssh2/sftp_handle.pyx":303 * return rc, bytes_written * - * def fsync(self): # <<<<<<<<<<<<<< + * def fsync(self) -> int: # <<<<<<<<<<<<<< * """Sync file handle data. * */ - __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_fsync, 300, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 300, __pyx_L1_error) + __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_fsync, 303, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 303, __pyx_L1_error) - /* "ssh2/sftp_handle.pyx":309 + /* "ssh2/sftp_handle.pyx":312 * return handle_error_codes(rc) * - * def seek(self, size_t offset): # <<<<<<<<<<<<<< + * def seek(self, size_t offset) -> None: # <<<<<<<<<<<<<< * """Deprecated, use seek64. * */ - __pyx_tuple__27 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_offset); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 309, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__27); - __Pyx_GIVEREF(__pyx_tuple__27); - __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_seek, 309, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 309, __pyx_L1_error) + __pyx_tuple__28 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_offset); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 312, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__28); + __Pyx_GIVEREF(__pyx_tuple__28); + __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_seek, 312, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 312, __pyx_L1_error) - /* "ssh2/sftp_handle.pyx":321 + /* "ssh2/sftp_handle.pyx":324 * c_sftp.libssh2_sftp_seek(self._handle, offset) * - * def seek64(self, c_ssh2.libssh2_uint64_t offset): # <<<<<<<<<<<<<< + * def seek64(self, c_ssh2.libssh2_uint64_t offset) -> None: # <<<<<<<<<<<<<< * """Seek file to given 64-bit offset. * */ - __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_seek64, 321, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 321, __pyx_L1_error) + __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_seek64, 324, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 324, __pyx_L1_error) - /* "ssh2/sftp_handle.pyx":331 + /* "ssh2/sftp_handle.pyx":334 * c_sftp.libssh2_sftp_seek64(self._handle, offset) * - * def rewind(self): # <<<<<<<<<<<<<< + * def rewind(self) -> None: # <<<<<<<<<<<<<< * """Rewind file handle to beginning of file. * */ - __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_rewind, 331, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 331, __pyx_L1_error) + __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_rewind, 334, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 334, __pyx_L1_error) - /* "ssh2/sftp_handle.pyx":338 + /* "ssh2/sftp_handle.pyx":341 * c_sftp.libssh2_sftp_rewind(self._handle) * * def tell(self): # <<<<<<<<<<<<<< * """Deprecated, use tell64. * */ - __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_tell, 338, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 338, __pyx_L1_error) + __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_tell, 341, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 341, __pyx_L1_error) - /* "ssh2/sftp_handle.pyx":349 + /* "ssh2/sftp_handle.pyx":352 * return handle_error_codes(rc) * - * def tell64(self): # <<<<<<<<<<<<<< + * def tell64(self) -> int: # <<<<<<<<<<<<<< * """Get current file handle 64-bit offset. * */ - __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_tell64, 349, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 349, __pyx_L1_error) + __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_tell64, 352, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 352, __pyx_L1_error) - /* "ssh2/sftp_handle.pyx":358 + /* "ssh2/sftp_handle.pyx":361 * return handle_error_codes(rc) * - * def fstat_ex(self, SFTPAttributes attrs, int setstat): # <<<<<<<<<<<<<< + * def fstat_ex(self, SFTPAttributes attrs, int setstat) -> int: # <<<<<<<<<<<<<< * """Get or set file attributes. Clients would typically use one of the * fstat or fsetstat functions instead""" */ - __pyx_tuple__33 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_attrs, __pyx_n_s_setstat, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 358, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__33); - __Pyx_GIVEREF(__pyx_tuple__33); - __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_fstat_ex, 358, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 358, __pyx_L1_error) + __pyx_tuple__34 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_attrs, __pyx_n_s_setstat, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 361, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__34); + __Pyx_GIVEREF(__pyx_tuple__34); + __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_fstat_ex, 361, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 361, __pyx_L1_error) - /* "ssh2/sftp_handle.pyx":367 + /* "ssh2/sftp_handle.pyx":370 * return handle_error_codes(rc) * - * def fstat(self): # <<<<<<<<<<<<<< + * def fstat(self) -> SFTPAttributes: # <<<<<<<<<<<<<< * """Get file stat attributes from handle. * */ - __pyx_tuple__35 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_rc, __pyx_n_s_attrs); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__35); - __Pyx_GIVEREF(__pyx_tuple__35); - __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_fstat, 367, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 367, __pyx_L1_error) + __pyx_tuple__36 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_rc, __pyx_n_s_attrs); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 370, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__36); + __Pyx_GIVEREF(__pyx_tuple__36); + __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_fstat, 370, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 370, __pyx_L1_error) - /* "ssh2/sftp_handle.pyx":379 + /* "ssh2/sftp_handle.pyx":382 * return attrs * - * def fsetstat(self, SFTPAttributes attrs): # <<<<<<<<<<<<<< + * def fsetstat(self, SFTPAttributes attrs) -> int: # <<<<<<<<<<<<<< * """Set file handle attributes. * */ - __pyx_tuple__37 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_attrs, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 379, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__37); - __Pyx_GIVEREF(__pyx_tuple__37); - __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_fsetstat, 379, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 379, __pyx_L1_error) + __pyx_tuple__38 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_attrs, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 382, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__38); + __Pyx_GIVEREF(__pyx_tuple__38); + __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_fsetstat, 382, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 382, __pyx_L1_error) - /* "ssh2/sftp_handle.pyx":389 + /* "ssh2/sftp_handle.pyx":392 * return handle_error_codes(rc) * - * def fstatvfs(self): # <<<<<<<<<<<<<< + * def fstatvfs(self) -> SFTPStatVFS: # <<<<<<<<<<<<<< * """Get file system statistics for handle * */ - __pyx_tuple__39 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_vfs, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 389, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__39); - __Pyx_GIVEREF(__pyx_tuple__39); - __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_fstatvfs, 389, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 389, __pyx_L1_error) + __pyx_tuple__40 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_vfs, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 392, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__40); + __Pyx_GIVEREF(__pyx_tuple__40); + __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_sftp_handle_pyx, __pyx_n_s_fstatvfs, 392, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 392, __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): */ - __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(1, 1, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): @@ -13196,14 +13288,14 @@ 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_codeobj__42 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(1, 3, __pyx_L1_error) + __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(1, 3, __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): */ - __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(1, 1, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): @@ -13211,7 +13303,7 @@ 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_codeobj__44 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(1, 3, __pyx_L1_error) + __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(1, 3, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -13282,15 +13374,15 @@ static int __Pyx_modinit_type_init_code(void) { __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); /*--- Type init code ---*/ #if CYTHON_USE_TYPE_SPECS - __pyx_ptype_4ssh2_11sftp_handle_SFTPHandle = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4ssh2_11sftp_handle_SFTPHandle_spec, NULL); if (unlikely(!__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle)) __PYX_ERR(0, 111, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4ssh2_11sftp_handle_SFTPHandle_spec, __pyx_ptype_4ssh2_11sftp_handle_SFTPHandle) < 0) __PYX_ERR(0, 111, __pyx_L1_error) + __pyx_ptype_4ssh2_11sftp_handle_SFTPHandle = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4ssh2_11sftp_handle_SFTPHandle_spec, NULL); if (unlikely(!__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle)) __PYX_ERR(0, 113, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4ssh2_11sftp_handle_SFTPHandle_spec, __pyx_ptype_4ssh2_11sftp_handle_SFTPHandle) < 0) __PYX_ERR(0, 113, __pyx_L1_error) #else __pyx_ptype_4ssh2_11sftp_handle_SFTPHandle = &__pyx_type_4ssh2_11sftp_handle_SFTPHandle; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle) < 0) __PYX_ERR(0, 111, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle) < 0) __PYX_ERR(0, 113, __pyx_L1_error) #endif #if PY_MAJOR_VERSION < 3 __pyx_ptype_4ssh2_11sftp_handle_SFTPHandle->tp_print = 0; @@ -13300,20 +13392,20 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_ptype_4ssh2_11sftp_handle_SFTPHandle->tp_getattro = __Pyx_PyObject_GenericGetAttr; } #endif - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SFTPHandle, (PyObject *) __pyx_ptype_4ssh2_11sftp_handle_SFTPHandle) < 0) __PYX_ERR(0, 111, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SFTPHandle, (PyObject *) __pyx_ptype_4ssh2_11sftp_handle_SFTPHandle) < 0) __PYX_ERR(0, 113, __pyx_L1_error) #if !CYTHON_COMPILING_IN_LIMITED_API - if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_4ssh2_11sftp_handle_SFTPHandle) < 0) __PYX_ERR(0, 111, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_4ssh2_11sftp_handle_SFTPHandle) < 0) __PYX_ERR(0, 113, __pyx_L1_error) #endif #if CYTHON_USE_TYPE_SPECS - __pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4ssh2_11sftp_handle_SFTPAttributes_spec, NULL); if (unlikely(!__pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes)) __PYX_ERR(0, 33, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4ssh2_11sftp_handle_SFTPAttributes_spec, __pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes) < 0) __PYX_ERR(0, 33, __pyx_L1_error) + __pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4ssh2_11sftp_handle_SFTPAttributes_spec, NULL); if (unlikely(!__pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes)) __PYX_ERR(0, 35, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4ssh2_11sftp_handle_SFTPAttributes_spec, __pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes) < 0) __PYX_ERR(0, 35, __pyx_L1_error) #else __pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes = &__pyx_type_4ssh2_11sftp_handle_SFTPAttributes; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes) < 0) __PYX_ERR(0, 33, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes) < 0) __PYX_ERR(0, 35, __pyx_L1_error) #endif #if PY_MAJOR_VERSION < 3 __pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes->tp_print = 0; @@ -13323,20 +13415,20 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes->tp_getattro = __Pyx_PyObject_GenericGetAttr; } #endif - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SFTPAttributes, (PyObject *) __pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes) < 0) __PYX_ERR(0, 33, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SFTPAttributes, (PyObject *) __pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes) < 0) __PYX_ERR(0, 35, __pyx_L1_error) #if !CYTHON_COMPILING_IN_LIMITED_API - if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes) < 0) __PYX_ERR(0, 33, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_4ssh2_11sftp_handle_SFTPAttributes) < 0) __PYX_ERR(0, 35, __pyx_L1_error) #endif #if CYTHON_USE_TYPE_SPECS - __pyx_ptype_4ssh2_11sftp_handle_SFTPStatVFS = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4ssh2_11sftp_handle_SFTPStatVFS_spec, NULL); if (unlikely(!__pyx_ptype_4ssh2_11sftp_handle_SFTPStatVFS)) __PYX_ERR(0, 402, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4ssh2_11sftp_handle_SFTPStatVFS_spec, __pyx_ptype_4ssh2_11sftp_handle_SFTPStatVFS) < 0) __PYX_ERR(0, 402, __pyx_L1_error) + __pyx_ptype_4ssh2_11sftp_handle_SFTPStatVFS = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4ssh2_11sftp_handle_SFTPStatVFS_spec, NULL); if (unlikely(!__pyx_ptype_4ssh2_11sftp_handle_SFTPStatVFS)) __PYX_ERR(0, 405, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4ssh2_11sftp_handle_SFTPStatVFS_spec, __pyx_ptype_4ssh2_11sftp_handle_SFTPStatVFS) < 0) __PYX_ERR(0, 405, __pyx_L1_error) #else __pyx_ptype_4ssh2_11sftp_handle_SFTPStatVFS = &__pyx_type_4ssh2_11sftp_handle_SFTPStatVFS; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_ptype_4ssh2_11sftp_handle_SFTPStatVFS) < 0) __PYX_ERR(0, 402, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_ptype_4ssh2_11sftp_handle_SFTPStatVFS) < 0) __PYX_ERR(0, 405, __pyx_L1_error) #endif #if PY_MAJOR_VERSION < 3 __pyx_ptype_4ssh2_11sftp_handle_SFTPStatVFS->tp_print = 0; @@ -13346,20 +13438,20 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_ptype_4ssh2_11sftp_handle_SFTPStatVFS->tp_getattro = __Pyx_PyObject_GenericGetAttr; } #endif - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SFTPStatVFS, (PyObject *) __pyx_ptype_4ssh2_11sftp_handle_SFTPStatVFS) < 0) __PYX_ERR(0, 402, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SFTPStatVFS, (PyObject *) __pyx_ptype_4ssh2_11sftp_handle_SFTPStatVFS) < 0) __PYX_ERR(0, 405, __pyx_L1_error) #if !CYTHON_COMPILING_IN_LIMITED_API - if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_4ssh2_11sftp_handle_SFTPStatVFS) < 0) __PYX_ERR(0, 402, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_4ssh2_11sftp_handle_SFTPStatVFS) < 0) __PYX_ERR(0, 405, __pyx_L1_error) #endif #if CYTHON_USE_TYPE_SPECS - __pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct__readdir_ex = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4ssh2_11sftp_handle___pyx_scope_struct__readdir_ex_spec, NULL); if (unlikely(!__pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct__readdir_ex)) __PYX_ERR(0, 180, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4ssh2_11sftp_handle___pyx_scope_struct__readdir_ex_spec, __pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct__readdir_ex) < 0) __PYX_ERR(0, 180, __pyx_L1_error) + __pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct__readdir_ex = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4ssh2_11sftp_handle___pyx_scope_struct__readdir_ex_spec, NULL); if (unlikely(!__pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct__readdir_ex)) __PYX_ERR(0, 183, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4ssh2_11sftp_handle___pyx_scope_struct__readdir_ex_spec, __pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct__readdir_ex) < 0) __PYX_ERR(0, 183, __pyx_L1_error) #else __pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct__readdir_ex = &__pyx_type_4ssh2_11sftp_handle___pyx_scope_struct__readdir_ex; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct__readdir_ex) < 0) __PYX_ERR(0, 180, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct__readdir_ex) < 0) __PYX_ERR(0, 183, __pyx_L1_error) #endif #if PY_MAJOR_VERSION < 3 __pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct__readdir_ex->tp_print = 0; @@ -13370,15 +13462,15 @@ static int __Pyx_modinit_type_init_code(void) { } #endif #if CYTHON_USE_TYPE_SPECS - __pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct_1_readdir = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4ssh2_11sftp_handle___pyx_scope_struct_1_readdir_spec, NULL); if (unlikely(!__pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct_1_readdir)) __PYX_ERR(0, 229, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4ssh2_11sftp_handle___pyx_scope_struct_1_readdir_spec, __pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct_1_readdir) < 0) __PYX_ERR(0, 229, __pyx_L1_error) + __pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct_1_readdir = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4ssh2_11sftp_handle___pyx_scope_struct_1_readdir_spec, NULL); if (unlikely(!__pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct_1_readdir)) __PYX_ERR(0, 232, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4ssh2_11sftp_handle___pyx_scope_struct_1_readdir_spec, __pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct_1_readdir) < 0) __PYX_ERR(0, 232, __pyx_L1_error) #else __pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct_1_readdir = &__pyx_type_4ssh2_11sftp_handle___pyx_scope_struct_1_readdir; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct_1_readdir) < 0) __PYX_ERR(0, 229, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct_1_readdir) < 0) __PYX_ERR(0, 232, __pyx_L1_error) #endif #if PY_MAJOR_VERSION < 3 __pyx_ptype_4ssh2_11sftp_handle___pyx_scope_struct_1_readdir->tp_print = 0; @@ -13405,12 +13497,12 @@ static int __Pyx_modinit_type_import_code(void) { /*--- Type import code ---*/ __pyx_t_1 = PyImport_ImportModule("ssh2.session"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_4ssh2_7session_Session = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.session", "Session", sizeof(struct __pyx_obj_4ssh2_7session_Session), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_7session_Session),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_7session_Session) __PYX_ERR(2, 19, __pyx_L1_error) - __pyx_ptype_4ssh2_7session_MethodType = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.session", "MethodType", sizeof(struct __pyx_obj_4ssh2_7session_MethodType), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_7session_MethodType),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_7session_MethodType) __PYX_ERR(2, 26, __pyx_L1_error) + __pyx_ptype_4ssh2_7session_Session = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.session", "Session", sizeof(struct __pyx_obj_4ssh2_7session_Session), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_7session_Session),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_7session_Session) __PYX_ERR(2, 19, __pyx_L1_error) + __pyx_ptype_4ssh2_7session_MethodType = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.session", "MethodType", sizeof(struct __pyx_obj_4ssh2_7session_MethodType), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_7session_MethodType),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_7session_MethodType) __PYX_ERR(2, 26, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyImport_ImportModule("ssh2.sftp"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_4ssh2_4sftp_SFTP = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.sftp", "SFTP", sizeof(struct __pyx_obj_4ssh2_4sftp_SFTP), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_4sftp_SFTP),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_4sftp_SFTP) __PYX_ERR(3, 26, __pyx_L1_error) + __pyx_ptype_4ssh2_4sftp_SFTP = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.sftp", "SFTP", sizeof(struct __pyx_obj_4ssh2_4sftp_SFTP), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_4sftp_SFTP),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_4sftp_SFTP) __PYX_ERR(3, 26, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -13438,7 +13530,7 @@ static int __Pyx_modinit_function_import_code(void) { /*--- Function import code ---*/ __pyx_t_1 = PyImport_ImportModule("ssh2.utils"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction_3_0_11(__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_3_0_12(__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) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -13612,6 +13704,7 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_sftp_handle(PyObject *__pyx_pyinit PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -13727,15 +13820,43 @@ if (!__Pyx_RefNanny) { if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif + /* "ssh2/sftp_handle.pyx":19 + * """SFTP handle, attributes and stat VFS classes.""" + * + * from typing import Generator, Tuple # <<<<<<<<<<<<<< + * + * from libc.stdlib cimport malloc, free + */ + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_n_s_Generator); + __Pyx_GIVEREF(__pyx_n_s_Generator); + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Generator)) __PYX_ERR(0, 19, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_Tuple); + __Pyx_GIVEREF(__pyx_n_s_Tuple); + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_Tuple)) __PYX_ERR(0, 19, __pyx_L1_error); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_typing, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Generator); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Generator, __pyx_t_2) < 0) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Tuple); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Tuple, __pyx_t_2) < 0) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_14SFTPAttributes_5__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPAttributes___reduce_cython, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__6)); 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_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_14SFTPAttributes_5__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPAttributes___reduce_cython, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "(tree fragment)":3 * def __reduce_cython__(self): @@ -13743,270 +13864,340 @@ if (!__Pyx_RefNanny) { * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_14SFTPAttributes_7__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPAttributes___setstate_cython, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__8)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(1, 3, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_14SFTPAttributes_7__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPAttributes___setstate_cython, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_3) < 0) __PYX_ERR(1, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ssh2/sftp_handle.pyx":135 + /* "ssh2/sftp_handle.pyx":137 * return rc, data * * def __enter__(self): # <<<<<<<<<<<<<< * return self * */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_9__enter__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle___enter, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 135, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_enter, __pyx_t_2) < 0) __PYX_ERR(0, 135, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_9__enter__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle___enter, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__10)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_enter, __pyx_t_3) < 0) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle); - /* "ssh2/sftp_handle.pyx":138 + /* "ssh2/sftp_handle.pyx":140 * return self * * def __exit__(self, *args): # <<<<<<<<<<<<<< * self.close() * */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_11__exit__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle___exit, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_exit, __pyx_t_2) < 0) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_11__exit__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle___exit, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 140, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_exit, __pyx_t_3) < 0) __PYX_ERR(0, 140, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle); - /* "ssh2/sftp_handle.pyx":141 + /* "ssh2/sftp_handle.pyx":143 * self.close() * - * def close(self): # <<<<<<<<<<<<<< - * """Close handle. Called automatically when object is deleted - * and/or garbage collected. + * def close(self) -> int: # <<<<<<<<<<<<<< + * """Close handle. + * */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_13close, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_close, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 141, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_s_int) < 0) __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_13close, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_close, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__14)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_close, __pyx_t_2) < 0) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_close, __pyx_t_2) < 0) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle); - /* "ssh2/sftp_handle.pyx":155 + /* "ssh2/sftp_handle.pyx":158 * return rc * - * def read(self, size_t buffer_maxlen=c_ssh2.LIBSSH2_CHANNEL_WINDOW_DEFAULT): # <<<<<<<<<<<<<< + * def read(self, size_t buffer_maxlen=c_ssh2.LIBSSH2_CHANNEL_WINDOW_DEFAULT) -> Tuple[int, bytes]: # <<<<<<<<<<<<<< * """Read buffer from file handle. * */ __pyx_k_ = LIBSSH2_CHANNEL_WINDOW_DEFAULT; - __pyx_t_2 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_CHANNEL_WINDOW_DEFAULT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From___pyx_anon_enum(LIBSSH2_CHANNEL_WINDOW_DEFAULT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 158, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 158, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 158, __pyx_L1_error); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_15read, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_read, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__15)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 158, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_kp_s_Tuple_int_bytes) < 0) __PYX_ERR(0, 158, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_15read, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_read, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_3); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_read, __pyx_t_2) < 0) __PYX_ERR(0, 155, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_read, __pyx_t_4) < 0) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; PyType_Modified(__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle); - /* "ssh2/sftp_handle.pyx":180 + /* "ssh2/sftp_handle.pyx":183 * return rc, buf * * def readdir_ex(self, # <<<<<<<<<<<<<< * size_t longentry_maxlen=1024, - * size_t buffer_maxlen=1024): + * size_t buffer_maxlen=1024) -> Generator[Tuple[int, bytes, bytes, SFTPAttributes]]: */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_17readdir_ex, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_readdir_ex, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_kp_s_Generator_Tuple_int_bytes_bytes) < 0) __PYX_ERR(0, 183, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_17readdir_ex, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_readdir_ex, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__17); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_readdir_ex, __pyx_t_2) < 0) __PYX_ERR(0, 180, __pyx_L1_error) + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__18); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_readdir_ex, __pyx_t_2) < 0) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle); - /* "ssh2/sftp_handle.pyx":203 + /* "ssh2/sftp_handle.pyx":206 * buffer_maxlen=buffer_maxlen) * * def _readdir_ex(self, # <<<<<<<<<<<<<< * size_t longentry_maxlen=1024, * size_t buffer_maxlen=1024): */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_20_readdir_ex, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle__readdir_ex, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_20_readdir_ex, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle__readdir_ex, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__17); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_readdir_ex_2, __pyx_t_2) < 0) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__18); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_readdir_ex_2, __pyx_t_2) < 0) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle); - /* "ssh2/sftp_handle.pyx":229 + /* "ssh2/sftp_handle.pyx":232 * return rc, buf, b_longentry, attrs * - * def readdir(self, size_t buffer_maxlen=1024): # <<<<<<<<<<<<<< + * def readdir(self, size_t buffer_maxlen=1024) -> Generator[Tuple[int, bytes, SFTPAttributes]]: # <<<<<<<<<<<<<< * """Get directory listing from file handle, if any. * */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_22readdir, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_readdir, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__4)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 229, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__21); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_readdir, __pyx_t_2) < 0) __PYX_ERR(0, 229, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_kp_s_Generator_Tuple_int_bytes_SFTPAt) < 0) __PYX_ERR(0, 232, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_22readdir, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_readdir, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__4)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__22); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_readdir, __pyx_t_4) < 0) __PYX_ERR(0, 232, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; PyType_Modified(__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle); - /* "ssh2/sftp_handle.pyx":244 + /* "ssh2/sftp_handle.pyx":247 * rc, buf, attrs = self._readdir(buffer_maxlen) * * def _readdir(self, # <<<<<<<<<<<<<< * size_t buffer_maxlen=1024): * cdef bytes buf = b'' */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_25_readdir, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle__readdir, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 244, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__21); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_readdir_2, __pyx_t_2) < 0) __PYX_ERR(0, 244, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_25_readdir, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle__readdir, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 247, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__22); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_readdir_2, __pyx_t_4) < 0) __PYX_ERR(0, 247, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; PyType_Modified(__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle); - /* "ssh2/sftp_handle.pyx":263 + /* "ssh2/sftp_handle.pyx":266 * return rc, buf, attrs * - * def write(self, bytes buf): # <<<<<<<<<<<<<< + * def write(self, bytes buf) -> Tuple[int, bytes]: # <<<<<<<<<<<<<< * """Write buffer to file handle. * */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_27write, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_write, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__25)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 263, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 266, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_kp_s_Tuple_int_bytes) < 0) __PYX_ERR(0, 266, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_27write, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_write, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 266, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_write, __pyx_t_2) < 0) __PYX_ERR(0, 263, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_write, __pyx_t_2) < 0) __PYX_ERR(0, 266, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle); - /* "ssh2/sftp_handle.pyx":300 + /* "ssh2/sftp_handle.pyx":303 * return rc, bytes_written * - * def fsync(self): # <<<<<<<<<<<<<< + * def fsync(self) -> int: # <<<<<<<<<<<<<< * """Sync file handle data. * */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_29fsync, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_fsync, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 300, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 303, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_fsync, __pyx_t_2) < 0) __PYX_ERR(0, 300, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_s_int) < 0) __PYX_ERR(0, 303, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_29fsync, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_fsync, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 303, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_fsync, __pyx_t_4) < 0) __PYX_ERR(0, 303, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; PyType_Modified(__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle); - /* "ssh2/sftp_handle.pyx":309 + /* "ssh2/sftp_handle.pyx":312 * return handle_error_codes(rc) * - * def seek(self, size_t offset): # <<<<<<<<<<<<<< + * def seek(self, size_t offset) -> None: # <<<<<<<<<<<<<< * """Deprecated, use seek64. * */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_31seek, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_seek, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 309, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 312, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_n_s_None) < 0) __PYX_ERR(0, 312, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_31seek, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_seek, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 312, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_seek, __pyx_t_2) < 0) __PYX_ERR(0, 309, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_seek, __pyx_t_2) < 0) __PYX_ERR(0, 312, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle); - /* "ssh2/sftp_handle.pyx":321 + /* "ssh2/sftp_handle.pyx":324 * c_sftp.libssh2_sftp_seek(self._handle, offset) * - * def seek64(self, c_ssh2.libssh2_uint64_t offset): # <<<<<<<<<<<<<< + * def seek64(self, c_ssh2.libssh2_uint64_t offset) -> None: # <<<<<<<<<<<<<< * """Seek file to given 64-bit offset. * */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_33seek64, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_seek64, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 321, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 324, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_seek64, __pyx_t_2) < 0) __PYX_ERR(0, 321, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_s_None) < 0) __PYX_ERR(0, 324, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_33seek64, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_seek64, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 324, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_seek64, __pyx_t_4) < 0) __PYX_ERR(0, 324, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; PyType_Modified(__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle); - /* "ssh2/sftp_handle.pyx":331 + /* "ssh2/sftp_handle.pyx":334 * c_sftp.libssh2_sftp_seek64(self._handle, offset) * - * def rewind(self): # <<<<<<<<<<<<<< + * def rewind(self) -> None: # <<<<<<<<<<<<<< * """Rewind file handle to beginning of file. * */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_35rewind, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_rewind, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 331, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 334, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_n_s_None) < 0) __PYX_ERR(0, 334, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_35rewind, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_rewind, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 334, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_rewind, __pyx_t_2) < 0) __PYX_ERR(0, 331, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_rewind, __pyx_t_2) < 0) __PYX_ERR(0, 334, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle); - /* "ssh2/sftp_handle.pyx":338 + /* "ssh2/sftp_handle.pyx":341 * c_sftp.libssh2_sftp_rewind(self._handle) * * def tell(self): # <<<<<<<<<<<<<< * """Deprecated, use tell64. * */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_37tell, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_tell, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 338, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_37tell, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_tell, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 341, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_tell, __pyx_t_2) < 0) __PYX_ERR(0, 338, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_tell, __pyx_t_2) < 0) __PYX_ERR(0, 341, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle); - /* "ssh2/sftp_handle.pyx":349 + /* "ssh2/sftp_handle.pyx":352 * return handle_error_codes(rc) * - * def tell64(self): # <<<<<<<<<<<<<< + * def tell64(self) -> int: # <<<<<<<<<<<<<< * """Get current file handle 64-bit offset. * */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_39tell64, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_tell64, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 349, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_tell64, __pyx_t_2) < 0) __PYX_ERR(0, 349, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_s_int) < 0) __PYX_ERR(0, 352, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_39tell64, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_tell64, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_tell64, __pyx_t_4) < 0) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; PyType_Modified(__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle); - /* "ssh2/sftp_handle.pyx":358 + /* "ssh2/sftp_handle.pyx":361 * return handle_error_codes(rc) * - * def fstat_ex(self, SFTPAttributes attrs, int setstat): # <<<<<<<<<<<<<< + * def fstat_ex(self, SFTPAttributes attrs, int setstat) -> int: # <<<<<<<<<<<<<< * """Get or set file attributes. Clients would typically use one of the * fstat or fsetstat functions instead""" */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_41fstat_ex, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_fstat_ex, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 358, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 361, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_n_s_int) < 0) __PYX_ERR(0, 361, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_41fstat_ex, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_fstat_ex, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__35)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 361, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_fstat_ex, __pyx_t_2) < 0) __PYX_ERR(0, 358, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_fstat_ex, __pyx_t_2) < 0) __PYX_ERR(0, 361, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle); - /* "ssh2/sftp_handle.pyx":367 + /* "ssh2/sftp_handle.pyx":370 * return handle_error_codes(rc) * - * def fstat(self): # <<<<<<<<<<<<<< + * def fstat(self) -> SFTPAttributes: # <<<<<<<<<<<<<< * """Get file stat attributes from handle. * */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_43fstat, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_fstat, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 370, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_fstat, __pyx_t_2) < 0) __PYX_ERR(0, 367, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_s_SFTPAttributes) < 0) __PYX_ERR(0, 370, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_43fstat, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_fstat, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__37)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 370, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_fstat, __pyx_t_4) < 0) __PYX_ERR(0, 370, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; PyType_Modified(__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle); - /* "ssh2/sftp_handle.pyx":379 + /* "ssh2/sftp_handle.pyx":382 * return attrs * - * def fsetstat(self, SFTPAttributes attrs): # <<<<<<<<<<<<<< + * def fsetstat(self, SFTPAttributes attrs) -> int: # <<<<<<<<<<<<<< * """Set file handle attributes. * */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_45fsetstat, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_fsetstat, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 379, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 382, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_n_s_int) < 0) __PYX_ERR(0, 382, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_45fsetstat, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_fsetstat, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__39)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 382, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_fsetstat, __pyx_t_2) < 0) __PYX_ERR(0, 379, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_fsetstat, __pyx_t_2) < 0) __PYX_ERR(0, 382, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle); - /* "ssh2/sftp_handle.pyx":389 + /* "ssh2/sftp_handle.pyx":392 * return handle_error_codes(rc) * - * def fstatvfs(self): # <<<<<<<<<<<<<< + * def fstatvfs(self) -> SFTPStatVFS: # <<<<<<<<<<<<<< * """Get file system statistics for handle * */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_47fstatvfs, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_fstatvfs, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__40)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 389, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 392, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_fstatvfs, __pyx_t_2) < 0) __PYX_ERR(0, 389, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_s_SFTPStatVFS) < 0) __PYX_ERR(0, 392, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_47fstatvfs, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle_fstatvfs, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__41)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 392, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle, __pyx_n_s_fstatvfs, __pyx_t_4) < 0) __PYX_ERR(0, 392, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; PyType_Modified(__pyx_ptype_4ssh2_11sftp_handle_SFTPHandle); /* "(tree fragment)":1 @@ -14014,10 +14205,10 @@ if (!__Pyx_RefNanny) { * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_49__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle___reduce_cython, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__41)); 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_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_49__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle___reduce_cython, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__42)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "(tree fragment)":3 * def __reduce_cython__(self): @@ -14025,20 +14216,20 @@ if (!__Pyx_RefNanny) { * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_51__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle___setstate_cython, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__42)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(1, 3, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_10SFTPHandle_51__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPHandle___setstate_cython, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__43)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(1, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_11SFTPStatVFS_5__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPStatVFS___reduce_cython, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__43)); 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_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_11SFTPStatVFS_5__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPStatVFS___reduce_cython, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__44)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "(tree fragment)":3 * def __reduce_cython__(self): @@ -14046,20 +14237,20 @@ if (!__Pyx_RefNanny) { * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_11SFTPStatVFS_7__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPStatVFS___setstate_cython, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__44)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(1, 3, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_11sftp_handle_11SFTPStatVFS_7__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SFTPStatVFS___setstate_cython, NULL, __pyx_n_s_ssh2_sftp_handle, __pyx_d, ((PyObject *)__pyx_codeobj__45)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(1, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "ssh2/sftp_handle.pyx":1 * # This file is part of ssh2-python. # <<<<<<<<<<<<<< * # 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_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_4) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /*--- Wrapped vars code ---*/ @@ -14067,6 +14258,7 @@ if (!__Pyx_RefNanny) { __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); if (__pyx_m) { if (__pyx_d && stringtab_initialized) { __Pyx_AddTraceback("init ssh2.sftp_handle", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -16086,10 +16278,10 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { #endif /* TypeImport */ -#ifndef __PYX_HAVE_RT_ImportType_3_0_11 -#define __PYX_HAVE_RT_ImportType_3_0_11 -static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *module_name, const char *class_name, - size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size) +#ifndef __PYX_HAVE_RT_ImportType_3_0_12 +#define __PYX_HAVE_RT_ImportType_3_0_12 +static PyTypeObject *__Pyx_ImportType_3_0_12(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_12 check_size) { PyObject *result = 0; char warning[200]; @@ -16143,7 +16335,7 @@ static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *modul module_name, class_name, size, basicsize+itemsize); goto bad; } - if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_11 && + if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_12 && ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " @@ -16151,7 +16343,7 @@ static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *modul module_name, class_name, size, basicsize, basicsize+itemsize); goto bad; } - else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_11 && (size_t)basicsize > size) { + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_12 && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", @@ -16165,6 +16357,107 @@ static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *modul } #endif +/* Import */ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *module = 0; + PyObject *empty_dict = 0; + PyObject *empty_list = 0; + #if PY_MAJOR_VERSION < 3 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); + if (unlikely(!py_import)) + goto bad; + if (!from_list) { + empty_list = PyList_New(0); + if (unlikely(!empty_list)) + goto bad; + from_list = empty_list; + } + #endif + empty_dict = PyDict_New(); + if (unlikely(!empty_dict)) + goto bad; + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.') != NULL) { + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, 1); + if (unlikely(!module)) { + if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) + goto bad; + PyErr_Clear(); + } + } + level = 0; + } + #endif + if (!module) { + #if PY_MAJOR_VERSION < 3 + PyObject *py_level = PyInt_FromLong(level); + if (unlikely(!py_level)) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, level); + #endif + } + } +bad: + Py_XDECREF(empty_dict); + Py_XDECREF(empty_list); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_import); + #endif + return module; +} + +/* ImportFrom */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + const char* module_name_str = 0; + PyObject* module_name = 0; + PyObject* module_dot = 0; + PyObject* full_name = 0; + PyErr_Clear(); + module_name_str = PyModule_GetName(module); + if (unlikely(!module_name_str)) { goto modbad; } + module_name = PyUnicode_FromString(module_name_str); + if (unlikely(!module_name)) { goto modbad; } + module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__5); + if (unlikely(!module_dot)) { goto modbad; } + full_name = PyUnicode_Concat(module_dot, name); + if (unlikely(!full_name)) { goto modbad; } + #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + { + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + goto modbad; + value = PyObject_GetItem(modules, full_name); + } + #else + value = PyImport_GetModule(full_name); + #endif + modbad: + Py_XDECREF(full_name); + Py_XDECREF(module_dot); + Py_XDECREF(module_name); + } + if (unlikely(!value)) { + PyErr_Format(PyExc_ImportError, + #if PY_MAJOR_VERSION < 3 + "cannot import name %.230s", PyString_AS_STRING(name)); + #else + "cannot import name %S", name); + #endif + } + return value; +} + /* FetchSharedCythonModule */ static PyObject *__Pyx_FetchSharedCythonABIModule(void) { return __Pyx_PyImport_AddModuleRef((char*) __PYX_ABI_MODULE_NAME); @@ -17500,7 +17793,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { #include "compile.h" #include "frameobject.h" #include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif @@ -19072,7 +19365,7 @@ __Pyx_PyType_GetName(PyTypeObject* tp) if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { PyErr_Clear(); Py_XDECREF(name); - name = __Pyx_NewRef(__pyx_n_s__45); + name = __Pyx_NewRef(__pyx_n_s__46); } return name; } @@ -19568,7 +19861,7 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name /* CoroutineBase */ #include -#if PY_VERSION_HEX >= 0x030b00a6 +#if PY_VERSION_HEX >= 0x030b00a6 && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif @@ -20730,9 +21023,9 @@ static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *s } /* FunctionImport */ -#ifndef __PYX_HAVE_RT_ImportFunction_3_0_11 -#define __PYX_HAVE_RT_ImportFunction_3_0_11 -static int __Pyx_ImportFunction_3_0_11(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { +#ifndef __PYX_HAVE_RT_ImportFunction_3_0_12 +#define __PYX_HAVE_RT_ImportFunction_3_0_12 +static int __Pyx_ImportFunction_3_0_12(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { PyObject *d = 0; PyObject *cobj = 0; union { diff --git a/ssh2/sftp_handle.pyi b/ssh2/sftp_handle.pyi new file mode 100644 index 00000000..b875dc3f --- /dev/null +++ b/ssh2/sftp_handle.pyi @@ -0,0 +1,90 @@ +# This file is part of ssh2-python. +# Copyright (C) 2017-2025 Panos Kittenis +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation, version 2.1. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +from typing import Tuple, Generator + +class SFTPAttributes: + @property + def flags(self) -> int: ... + @flags.setter + def flags(self, flags: int): ... + @property + def filesize(self) -> int: ... + @filesize.setter + def filesize(self, filesize: int): ... + @property + def uid(self) -> int: ... + @uid.setter + def uid(self, uid: int): ... + @property + def gid(self) -> int: ... + @gid.setter + def gid(self, gid: int): ... + @property + def permissions(self) -> int: ... + @permissions.setter + def permissions(self, permissions: int): ... + @property + def atime(self) -> int: ... + @atime.setter + def atime(self, atime: int): ... + @property + def mtime(self) -> int: ... + @mtime.setter + def mtime(self, mtime: int): ... + +class SFTPHandle: + def __next__(self) -> Tuple[int, bytes]: ... + def close(self) -> int: ... + def read(self, buffer_maxlen: int) -> Tuple[int, bytes]: ... + def readdir_ex(self, longentry_maxlen: int=1024, + buffer_maxlen: int=1024) -> Generator[Tuple[int, bytes, bytes, SFTPAttributes]]: ... + def readdir(self, buffer_maxlen:int =1024) -> Generator[Tuple[int, bytes, SFTPAttributes]]: ... + def write(self, buf: bytes) -> Tuple[int, bytes]: ... + def fsync(self) -> int: ... + def seek(self, offset: int) -> None: ... + def seek64(self, offset: int) -> None: ... + def rewind(self) -> None: ... + def tell64(self) -> int: ... + def fstat_ex(self, attrs: SFTPAttributes, setstat: int) -> int: ... + def fstat(self) -> SFTPAttributes:... + def fsetstat(self, attrs: SFTPAttributes) -> int: ... + def fstatvfs(self) -> SFTPStatVFS: ... + + +class SFTPStatVFS: + @property + def f_bsize(self) -> int: ... + @property + def f_frsize(self) -> int: ... + @property + def f_blocks(self) -> int: ... + @property + def f_bfree(self) -> int: ... + @property + def f_bavail(self) -> int: ... + @property + def f_files(self) -> int: ... + @property + def f_ffree(self) -> int: ... + @property + def f_favail(self) -> int: ... + @property + def f_fsid(self) -> int: ... + @property + def f_flag(self) -> int: ... + @property + def f_namemax(self) -> int: ... diff --git a/ssh2/sftp_handle.pyx b/ssh2/sftp_handle.pyx index f88e7d61..7e4bdfbe 100644 --- a/ssh2/sftp_handle.pyx +++ b/ssh2/sftp_handle.pyx @@ -16,6 +16,8 @@ """SFTP handle, attributes and stat VFS classes.""" +from typing import Generator, Tuple + from libc.stdlib cimport malloc, free from .utils cimport handle_error_codes @@ -52,7 +54,7 @@ cdef class SFTPAttributes: free(self._attrs) @property - def flags(self): + def flags(self) -> int: return self._attrs.flags @flags.setter @@ -60,7 +62,7 @@ cdef class SFTPAttributes: self._attrs.flags = flags @property - def filesize(self): + def filesize(self) -> int: return self._attrs.filesize @filesize.setter @@ -68,7 +70,7 @@ cdef class SFTPAttributes: self._attrs.filesize = filesize @property - def uid(self): + def uid(self) -> int: return self._attrs.uid @uid.setter @@ -76,7 +78,7 @@ cdef class SFTPAttributes: self._attrs.uid = uid @property - def gid(self): + def gid(self) -> int: return self._attrs.gid @gid.setter @@ -84,7 +86,7 @@ cdef class SFTPAttributes: self._attrs.gid = gid @property - def permissions(self): + def permissions(self) -> int: return self._attrs.permissions @permissions.setter @@ -92,7 +94,7 @@ cdef class SFTPAttributes: self._attrs.permissions = permissions @property - def atime(self): + def atime(self) -> int: return self._attrs.atime @atime.setter @@ -100,7 +102,7 @@ cdef class SFTPAttributes: self._attrs.atime = atime @property - def mtime(self): + def mtime(self) -> int: return self._attrs.mtime @mtime.setter @@ -124,7 +126,7 @@ cdef class SFTPHandle: def __iter__(self): return self - def __next__(self): + def __next__(self) -> Tuple[int, bytes]: cdef int rc cdef bytes data rc, data = self.read() @@ -138,9 +140,10 @@ cdef class SFTPHandle: def __exit__(self, *args): self.close() - def close(self): - """Close handle. Called automatically when object is deleted - and/or garbage collected. + def close(self) -> int: + """Close handle. + + Called automatically when object is de-allocated if not already closed. :rtype: int""" cdef int rc @@ -152,7 +155,7 @@ cdef class SFTPHandle: return return rc - def read(self, size_t buffer_maxlen=c_ssh2.LIBSSH2_CHANNEL_WINDOW_DEFAULT): + def read(self, size_t buffer_maxlen=c_ssh2.LIBSSH2_CHANNEL_WINDOW_DEFAULT) -> Tuple[int, bytes]: """Read buffer from file handle. :param buffer_maxlen: Max length of buffer to return. @@ -179,7 +182,7 @@ cdef class SFTPHandle: def readdir_ex(self, size_t longentry_maxlen=1024, - size_t buffer_maxlen=1024): + size_t buffer_maxlen=1024) -> Generator[Tuple[int, bytes, bytes, SFTPAttributes]]: """Get directory listing from file handle, if any. File handle *must* be opened with :py:func:`ssh2.sftp.SFTP.readdir()` @@ -226,7 +229,7 @@ cdef class SFTPHandle: free(longentry) return rc, buf, b_longentry, attrs - def readdir(self, size_t buffer_maxlen=1024): + def readdir(self, size_t buffer_maxlen=1024) -> Generator[Tuple[int, bytes, SFTPAttributes]]: """Get directory listing from file handle, if any. This function is a generator and should be iterated on. @@ -260,7 +263,7 @@ cdef class SFTPHandle: free(cbuf) return rc, buf, attrs - def write(self, bytes buf): + def write(self, bytes buf) -> Tuple[int, bytes]: """Write buffer to file handle. Returns tuple of (``error code``, ``bytes written``). @@ -297,7 +300,7 @@ cdef class SFTPHandle: bytes_written = tot_size - _size return rc, bytes_written - def fsync(self): + def fsync(self) -> int: """Sync file handle data. :rtype: int""" @@ -306,7 +309,7 @@ cdef class SFTPHandle: rc = c_sftp.libssh2_sftp_fsync(self._handle) return handle_error_codes(rc) - def seek(self, size_t offset): + def seek(self, size_t offset) -> None: """Deprecated, use seek64. Seek file to given offset. @@ -318,7 +321,7 @@ cdef class SFTPHandle: with nogil: c_sftp.libssh2_sftp_seek(self._handle, offset) - def seek64(self, c_ssh2.libssh2_uint64_t offset): + def seek64(self, c_ssh2.libssh2_uint64_t offset) -> None: """Seek file to given 64-bit offset. :param offset: Offset to seek to. @@ -328,7 +331,7 @@ cdef class SFTPHandle: with nogil: c_sftp.libssh2_sftp_seek64(self._handle, offset) - def rewind(self): + def rewind(self) -> None: """Rewind file handle to beginning of file. :rtype: None""" @@ -346,7 +349,7 @@ cdef class SFTPHandle: rc = c_sftp.libssh2_sftp_tell(self._handle) return handle_error_codes(rc) - def tell64(self): + def tell64(self) -> int: """Get current file handle 64-bit offset. :rtype: int""" @@ -355,7 +358,7 @@ cdef class SFTPHandle: rc = c_sftp.libssh2_sftp_tell(self._handle) return handle_error_codes(rc) - def fstat_ex(self, SFTPAttributes attrs, int setstat): + def fstat_ex(self, SFTPAttributes attrs, int setstat) -> int: """Get or set file attributes. Clients would typically use one of the fstat or fsetstat functions instead""" cdef int rc @@ -364,7 +367,7 @@ cdef class SFTPHandle: self._handle, attrs._attrs, setstat) return handle_error_codes(rc) - def fstat(self): + def fstat(self) -> SFTPAttributes: """Get file stat attributes from handle. :rtype: :py:class:`ssh2.sftp.SFTPAttributes` or LIBSSH2_ERROR_EAGAIN""" @@ -376,7 +379,7 @@ cdef class SFTPHandle: return handle_error_codes(rc) return attrs - def fsetstat(self, SFTPAttributes attrs): + def fsetstat(self, SFTPAttributes attrs) -> int: """Set file handle attributes. :param attrs: Attributes to set. @@ -386,7 +389,7 @@ cdef class SFTPHandle: rc = c_sftp.libssh2_sftp_fsetstat(self._handle, attrs._attrs) return handle_error_codes(rc) - def fstatvfs(self): + def fstatvfs(self) -> SFTPStatVFS: """Get file system statistics for handle :rtype: `ssh2.sftp.SFTPStatVFS`""" @@ -428,52 +431,52 @@ cdef class SFTPStatVFS: free(self._ptr) @property - def f_bsize(self): + def f_bsize(self) -> int: """File system block size""" return self._ptr.f_bsize @property - def f_frsize(self): + def f_frsize(self) -> int: """Fragment size""" return self._ptr.f_frsize @property - def f_blocks(self): + def f_blocks(self) -> int: """Size of fs in f_frsize units""" return self._ptr.f_blocks @property - def f_bfree(self): + def f_bfree(self) -> int: """Free blocks""" return self._ptr.f_bfree @property - def f_bavail(self): + def f_bavail(self) -> int: """Free blocks for non-root""" return self._ptr.f_bavail @property - def f_files(self): + def f_files(self) -> int: """Inodes""" return self._ptr.f_files @property - def f_ffree(self): + def f_ffree(self) -> int: """Free inodes""" return self._ptr.f_ffree @property - def f_favail(self): + def f_favail(self) -> int: """Free inodes for non-root""" return self._ptr.f_favail @property - def f_fsid(self): + def f_fsid(self) -> int: """File system ID""" return self._ptr.f_fsid @property - def f_flag(self): + def f_flag(self) -> int: """File system mount flags. This property is a bit mask with defined bits @@ -481,6 +484,6 @@ cdef class SFTPStatVFS: return self._ptr.f_flag @property - def f_namemax(self): + def f_namemax(self) -> int: """Maximum filename length""" return self._ptr.f_namemax diff --git a/ssh2/statinfo.c b/ssh2/statinfo.c index 47bcb1c8..3db6ce26 100644 --- a/ssh2/statinfo.c +++ b/ssh2/statinfo.c @@ -1,4 +1,4 @@ -/* Generated by Cython 3.0.11 */ +/* Generated by Cython 3.0.12 */ /* BEGIN: Cython Metadata { @@ -52,10 +52,10 @@ END: Cython Metadata */ #else #define __PYX_EXTRA_ABI_MODULE_NAME "" #endif -#define CYTHON_ABI "3_0_11" __PYX_EXTRA_ABI_MODULE_NAME +#define CYTHON_ABI "3_0_12" __PYX_EXTRA_ABI_MODULE_NAME #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." -#define CYTHON_HEX_VERSION 0x03000BF0 +#define CYTHON_HEX_VERSION 0x03000CF0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -1780,7 +1780,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #if !CYTHON_VECTORCALL #if PY_VERSION_HEX >= 0x03080000 #include "frameobject.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif @@ -3411,7 +3411,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_8statinfo_8StatInfo_4__reduce_cython__, "StatInfo.__reduce_cython__(self)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_8statinfo_8StatInfo_4__reduce_cython__, "__reduce_cython__(self)"); static PyMethodDef __pyx_mdef_4ssh2_8statinfo_8StatInfo_5__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_8statinfo_8StatInfo_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_8statinfo_8StatInfo_4__reduce_cython__}; static PyObject *__pyx_pw_4ssh2_8statinfo_8StatInfo_5__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -3492,7 +3492,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_8statinfo_8StatInfo_6__setstate_cython__, "StatInfo.__setstate_cython__(self, __pyx_state)"); +PyDoc_STRVAR(__pyx_doc_4ssh2_8statinfo_8StatInfo_6__setstate_cython__, "__setstate_cython__(self, __pyx_state)"); static PyMethodDef __pyx_mdef_4ssh2_8statinfo_8StatInfo_7__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_8statinfo_8StatInfo_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_8statinfo_8StatInfo_6__setstate_cython__}; static PyObject *__pyx_pw_4ssh2_8statinfo_8StatInfo_7__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -7336,7 +7336,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { #include "compile.h" #include "frameobject.h" #include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif diff --git a/ssh2/utils.c b/ssh2/utils.c index 06d287a8..d32d3d98 100644 --- a/ssh2/utils.c +++ b/ssh2/utils.c @@ -1,4 +1,4 @@ -/* Generated by Cython 3.0.11 */ +/* Generated by Cython 3.0.12 */ /* BEGIN: Cython Metadata { @@ -56,10 +56,10 @@ END: Cython Metadata */ #else #define __PYX_EXTRA_ABI_MODULE_NAME "" #endif -#define CYTHON_ABI "3_0_11" __PYX_EXTRA_ABI_MODULE_NAME +#define CYTHON_ABI "3_0_12" __PYX_EXTRA_ABI_MODULE_NAME #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." -#define CYTHON_HEX_VERSION 0x03000BF0 +#define CYTHON_HEX_VERSION 0x03000CF0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -1527,6 +1527,24 @@ static const char *__pyx_f[] = { /*--- Type declarations ---*/ struct __pyx_obj_4ssh2_7session_Session; struct __pyx_obj_4ssh2_7session_MethodType; +struct __pyx_obj_4ssh2_5utils___pyx_scope_struct__readline; +struct __pyx_ctuple_int__and_int; +typedef struct __pyx_ctuple_int__and_int __pyx_ctuple_int__and_int; +struct __pyx_defaults; +typedef struct __pyx_defaults __pyx_defaults; + +/* "ssh2/utils.pxd":24 + * cdef object to_str_len(char *c_str, int length) + * cpdef int handle_error_codes(int errcode) except -1 + * cpdef (int, int) find_eol(bytes buf: bytes, Py_ssize_t pos: Py_ssize_t) # <<<<<<<<<<<<<< + */ +struct __pyx_ctuple_int__and_int { + int f0; + int f1; +}; +struct __pyx_defaults { + PyObject *__pyx_arg_timeout; +}; /* "session.pxd":19 * from . cimport c_ssh2 @@ -1555,6 +1573,31 @@ struct __pyx_obj_4ssh2_7session_MethodType { int value; }; + +/* "ssh2/utils.pyx":79 + * + * + * def readline(buf: Iterable[bytes]) -> Generator[bytes]: # <<<<<<<<<<<<<< + * """Returns a generator of line by line output in given iterable buffer. + * + */ +struct __pyx_obj_4ssh2_5utils___pyx_scope_struct__readline { + PyObject_HEAD + PyObject *__pyx_v_buf; + PyObject *__pyx_v_data; + size_t __pyx_v_end_of_line; + PyObject *__pyx_v_line; + int __pyx_v_linesep; + int __pyx_v_new_line_pos; + size_t __pyx_v_pos; + PyObject *__pyx_v_remainder; + size_t __pyx_v_remainder_len; + Py_ssize_t __pyx_v_size; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; + PyObject *(*__pyx_t_2)(PyObject *); +}; + /* #### Code section: utility_code_proto ### */ /* --- Runtime support code (head) --- */ @@ -1766,7 +1809,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #if !CYTHON_VECTORCALL #if PY_VERSION_HEX >= 0x03080000 #include "frameobject.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif @@ -1885,26 +1928,78 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues __Pyx__ArgTypeTest(obj, type, name, exact)) static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); +/* SliceObject.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( + PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** py_start, PyObject** py_stop, PyObject** py_slice, + int has_cstart, int has_cstop, int wraparound); + +/* GetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); +#endif + +/* pep479.proto */ +static void __Pyx_Generator_Replace_StopIteration(int in_async_gen); + /* RaiseException.proto */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); +/* IncludeStructmemberH.proto */ +#include + +/* FixUpExtensionType.proto */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); +#endif + +/* PyObjectCallNoArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); + +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + +/* PyObjectGetMethod.proto */ +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); + +/* PyObjectCallMethod0.proto */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); + +/* ValidateBasesTuple.proto */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases); +#endif + +/* PyType_Ready.proto */ +CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); + +/* PyObject_GenericGetAttrNoDict.proto */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr +#endif + /* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_11 -#define __PYX_HAVE_RT_ImportType_proto_3_0_11 +#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_12 +#define __PYX_HAVE_RT_ImportType_proto_3_0_12 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #include #endif #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L -#define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) alignof(s) +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_12(s) alignof(s) #else -#define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) sizeof(void*) +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_12(s) sizeof(void*) #endif -enum __Pyx_ImportType_CheckSize_3_0_11 { - __Pyx_ImportType_CheckSize_Error_3_0_11 = 0, - __Pyx_ImportType_CheckSize_Warn_3_0_11 = 1, - __Pyx_ImportType_CheckSize_Ignore_3_0_11 = 2 +enum __Pyx_ImportType_CheckSize_3_0_12 { + __Pyx_ImportType_CheckSize_Error_3_0_12 = 0, + __Pyx_ImportType_CheckSize_Warn_3_0_12 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_0_12 = 2 }; -static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size); +static PyTypeObject *__Pyx_ImportType_3_0_12(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_12 check_size); #endif /* Import.proto */ @@ -1913,14 +2008,6 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /* ImportFrom.proto */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); -/* IncludeStructmemberH.proto */ -#include - -/* FixUpExtensionType.proto */ -#if CYTHON_USE_TYPE_SPECS -static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); -#endif - /* FetchSharedCythonModule.proto */ static PyObject *__Pyx_FetchSharedCythonABIModule(void); @@ -2094,6 +2181,9 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, #define __Pyx_HAS_GCC_DIAGNOSTIC #endif +/* ToPyCTupleUtility.proto */ +static PyObject* __pyx_convert__to_py___pyx_ctuple_int__and_int(__pyx_ctuple_int__and_int); + /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); @@ -2136,6 +2226,112 @@ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObj #define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) +/* GetTopmostException.proto */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); +#endif + +/* SaveResetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +#else +#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) +#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) +#endif + +/* SwapException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); +#endif + +/* PyObjectCall2Args.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + +/* PyObjectCallMethod1.proto */ +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); + +/* CoroutineBase.proto */ +struct __pyx_CoroutineObject; +typedef PyObject *(*__pyx_coroutine_body_t)(struct __pyx_CoroutineObject *, PyThreadState *, PyObject *); +#if CYTHON_USE_EXC_INFO_STACK +#define __Pyx_ExcInfoStruct _PyErr_StackItem +#else +typedef struct { + PyObject *exc_type; + PyObject *exc_value; + PyObject *exc_traceback; +} __Pyx_ExcInfoStruct; +#endif +typedef struct __pyx_CoroutineObject { + PyObject_HEAD + __pyx_coroutine_body_t body; + PyObject *closure; + __Pyx_ExcInfoStruct gi_exc_state; + PyObject *gi_weakreflist; + PyObject *classobj; + PyObject *yieldfrom; + PyObject *gi_name; + PyObject *gi_qualname; + PyObject *gi_modulename; + PyObject *gi_code; + PyObject *gi_frame; + int resume_label; + char is_running; +} __pyx_CoroutineObject; +static __pyx_CoroutineObject *__Pyx__Coroutine_New( + PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name); +static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( + __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name); +static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self); +static int __Pyx_Coroutine_clear(PyObject *self); +static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value); +static PyObject *__Pyx_Coroutine_Close(PyObject *self); +static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args); +#if CYTHON_USE_EXC_INFO_STACK +#define __Pyx_Coroutine_SwapException(self) +#define __Pyx_Coroutine_ResetAndClearException(self) __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state) +#else +#define __Pyx_Coroutine_SwapException(self) {\ + __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\ + __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\ + } +#define __Pyx_Coroutine_ResetAndClearException(self) {\ + __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\ + (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\ + } +#endif +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ + __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue) +#else +#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ + __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue) +#endif +static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue); +static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state); + +/* PatchModuleWithCoroutine.proto */ +static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code); + +/* PatchGeneratorABC.proto */ +static int __Pyx_patch_abc(void); + +/* Generator.proto */ +#define __Pyx_Generator_USED +#define __Pyx_Generator_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_GeneratorType) +#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\ + __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, closure, name, qualname, module_name) +static PyObject *__Pyx_Generator_Next(PyObject *self); +static int __pyx_Generator_init(PyObject *module); + /* CheckBinaryVersion.proto */ static unsigned long __Pyx_get_runtime_version(void); static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer); @@ -2165,7 +2361,9 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from "ssh2.error_codes" */ /* Module declarations from "ssh2.utils" */ +static PyObject *__pyx_f_4ssh2_5utils_to_str(char *); /*proto*/ static int __pyx_f_4ssh2_5utils_handle_error_codes(int, int __pyx_skip_dispatch); /*proto*/ +static __pyx_ctuple_int__and_int __pyx_f_4ssh2_5utils_find_eol(PyObject *, Py_ssize_t, int __pyx_skip_dispatch); /*proto*/ /* #### Code section: typeinfo ### */ /* #### Code section: before_global_var ### */ #define __Pyx_MODULE_NAME "ssh2.utils" @@ -2175,57 +2373,83 @@ int __pyx_module_is_main_ssh2__utils = 0; /* Implementation of "ssh2.utils" */ /* #### Code section: global_var ### */ /* #### Code section: string_decls ### */ -static const char __pyx_k_[] = "."; static const char __pyx_k__2[] = ""; -static const char __pyx_k__13[] = "?"; +static const char __pyx_k__3[] = "."; +static const char __pyx_k_gc[] = "gc"; +static const char __pyx_k_Any[] = "Any"; +static const char __pyx_k__14[] = "?"; static const char __pyx_k_buf[] = "buf"; +static const char __pyx_k_int[] = "int"; static const char __pyx_k_pos[] = "pos"; +static const char __pyx_k_str[] = "str"; +static const char __pyx_k_None[] = "None"; +static const char __pyx_k_args[] = "args"; +static const char __pyx_k_data[] = "data"; +static const char __pyx_k_line[] = "line"; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_name[] = "__name__"; +static const char __pyx_k_send[] = "send"; +static const char __pyx_k_size[] = "size"; static const char __pyx_k_test[] = "__test__"; -static const char __pyx_k_c_buf[] = "c_buf"; -static const char __pyx_k_index[] = "index"; +static const char __pyx_k_Tuple[] = "Tuple"; +static const char __pyx_k_bytes[] = "bytes"; +static const char __pyx_k_close[] = "close"; +static const char __pyx_k_throw[] = "throw"; static const char __pyx_k_utf_8[] = "utf-8"; static const char __pyx_k_decode[] = "decode"; +static const char __pyx_k_enable[] = "enable"; static const char __pyx_k_encode[] = "encode"; static const char __pyx_k_import[] = "__import__"; +static const char __pyx_k_return[] = "return"; static const char __pyx_k_select[] = "select"; static const char __pyx_k_socket[] = "_socket"; +static const char __pyx_k_typing[] = "typing"; static const char __pyx_k_Timeout[] = "Timeout"; -static const char __pyx_k_buf_len[] = "buf_len"; -static const char __pyx_k_cur_buf[] = "cur_buf"; +static const char __pyx_k_disable[] = "disable"; static const char __pyx_k_errcode[] = "errcode"; -static const char __pyx_k_new_pos[] = "new_pos"; +static const char __pyx_k_linesep[] = "linesep"; static const char __pyx_k_readfds[] = "readfds"; static const char __pyx_k_session[] = "session"; static const char __pyx_k_timeout[] = "timeout"; static const char __pyx_k_version[] = "version"; +static const char __pyx_k_BinaryIO[] = "BinaryIO"; static const char __pyx_k_ENCODING[] = "ENCODING"; +static const char __pyx_k_Iterable[] = "Iterable"; static const char __pyx_k_find_eol[] = "find_eol"; +static const char __pyx_k_readline[] = "readline"; static const char __pyx_k_writefds[] = "writefds"; static const char __pyx_k_FileError[] = "FileError"; +static const char __pyx_k_Generator[] = "Generator"; static const char __pyx_k_SSH2Error[] = "SSH2Error"; static const char __pyx_k_ZlibError[] = "ZlibError"; +static const char __pyx_k_isenabled[] = "isenabled"; +static const char __pyx_k_remainder[] = "remainder"; static const char __pyx_k_ssh2_exit[] = "ssh2_exit"; static const char __pyx_k_AllocError[] = "AllocError"; +static const char __pyx_k_Py_ssize_t[] = "Py_ssize_t"; static const char __pyx_k_directions[] = "directions"; static const char __pyx_k_exceptions[] = "exceptions"; static const char __pyx_k_ssh2_utils[] = "ssh2.utils"; static const char __pyx_k_BadUseError[] = "BadUseError"; +static const char __pyx_k_end_of_line[] = "end_of_line"; static const char __pyx_k_wait_socket[] = "wait_socket"; static const char __pyx_k_DecryptError[] = "DecryptError"; static const char __pyx_k_EncryptError[] = "EncryptError"; static const char __pyx_k_UnknownError[] = "UnknownError"; static const char __pyx_k_is_coroutine[] = "_is_coroutine"; +static const char __pyx_k_new_line_pos[] = "new_line_pos"; static const char __pyx_k_CompressError[] = "CompressError"; static const char __pyx_k_ProtocolError[] = "ProtocolError"; static const char __pyx_k_SocketTimeout[] = "SocketTimeout"; +static const char __pyx_k_remainder_len[] = "remainder_len"; static const char __pyx_k_BadSocketError[] = "BadSocketError"; static const char __pyx_k_ChannelFailure[] = "ChannelFailure"; +static const char __pyx_k_Iterable_bytes[] = "Iterable[bytes]"; 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_Generator_bytes[] = "Generator[bytes]"; static const char __pyx_k_InvalidMACError[] = "InvalidMACError"; static const char __pyx_k_KexFailureError[] = "KexFailureError"; static const char __pyx_k_MethodNoneError[] = "MethodNoneError"; @@ -2265,10 +2489,13 @@ static const char __pyx_k_PublicKeyProtocolError[] = "PublicKeyProtocolError"; static const char __pyx_k_PublickeyUnverifiedError[] = "PublickeyUnverifiedError"; /* #### Code section: decls ### */ static PyObject *__pyx_pf_4ssh2_5utils_find_eol(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buf, Py_ssize_t __pyx_v_pos); /* proto */ -static PyObject *__pyx_pf_4ssh2_5utils_2version(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_required_version); /* proto */ -static PyObject *__pyx_pf_4ssh2_5utils_4ssh2_exit(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_4ssh2_5utils_6wait_socket(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v__socket, struct __pyx_obj_4ssh2_7session_Session *__pyx_v_session, PyObject *__pyx_v_timeout); /* proto */ -static PyObject *__pyx_pf_4ssh2_5utils_8handle_error_codes(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_errcode); /* proto */ +static PyObject *__pyx_pf_4ssh2_5utils_2readline(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buf); /* proto */ +static PyObject *__pyx_pf_4ssh2_5utils_5version(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_required_version); /* proto */ +static PyObject *__pyx_pf_4ssh2_5utils_7ssh2_exit(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_4ssh2_5utils_13__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_4ssh2_5utils_9wait_socket(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v__socket, struct __pyx_obj_4ssh2_7session_Session *__pyx_v_session, PyObject *__pyx_v_timeout); /* proto */ +static PyObject *__pyx_pf_4ssh2_5utils_11handle_error_codes(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_errcode); /* proto */ +static PyObject *__pyx_tp_new_4ssh2_5utils___pyx_scope_struct__readline(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ /* #### Code section: late_includes ### */ /* #### Code section: module_state ### */ typedef struct { @@ -2315,15 +2542,18 @@ typedef struct { #if CYTHON_USE_MODULE_STATE #endif #if CYTHON_USE_MODULE_STATE + PyObject *__pyx_type_4ssh2_5utils___pyx_scope_struct__readline; #endif - PyObject *__pyx_kp_u_; + PyTypeObject *__pyx_ptype_4ssh2_5utils___pyx_scope_struct__readline; PyObject *__pyx_n_s_AgentProtocolError; PyObject *__pyx_n_s_AllocError; + PyObject *__pyx_n_s_Any; PyObject *__pyx_n_s_AuthenticationError; PyObject *__pyx_n_s_BadSocketError; PyObject *__pyx_n_s_BadUseError; PyObject *__pyx_n_s_BannerRecvError; PyObject *__pyx_n_s_BannerSendError; + PyObject *__pyx_n_s_BinaryIO; PyObject *__pyx_n_s_BufferTooSmallError; PyObject *__pyx_n_s_ChannelClosedError; PyObject *__pyx_n_s_ChannelEOFSentError; @@ -2340,22 +2570,28 @@ typedef struct { PyObject *__pyx_n_s_EncryptError; PyObject *__pyx_kp_u_Error_code_s_not_known; PyObject *__pyx_n_s_FileError; + PyObject *__pyx_n_s_Generator; + PyObject *__pyx_kp_s_Generator_bytes; PyObject *__pyx_n_s_HostkeyInitError; PyObject *__pyx_n_s_HostkeySignError; PyObject *__pyx_n_s_InvalidMACError; PyObject *__pyx_n_s_InvalidPollTypeError; PyObject *__pyx_n_s_InvalidRequestError; + PyObject *__pyx_n_s_Iterable; + PyObject *__pyx_kp_s_Iterable_bytes; PyObject *__pyx_n_s_KexFailureError; PyObject *__pyx_n_s_KeyExchangeError; PyObject *__pyx_n_s_KeyfileAuthFailedError; PyObject *__pyx_n_s_KnownHostError; PyObject *__pyx_n_s_MethodNoneError; PyObject *__pyx_n_s_MethodNotSupported; + PyObject *__pyx_n_s_None; PyObject *__pyx_n_s_OutOfBoundaryError; PyObject *__pyx_n_s_PasswordExpiredError; PyObject *__pyx_n_s_ProtocolError; PyObject *__pyx_n_s_PublicKeyProtocolError; PyObject *__pyx_n_s_PublickeyUnverifiedError; + PyObject *__pyx_n_s_Py_ssize_t; PyObject *__pyx_n_s_RequestDeniedError; PyObject *__pyx_n_s_SCPProtocolError; PyObject *__pyx_n_s_SFTPProtocolError; @@ -2365,58 +2601,78 @@ typedef struct { PyObject *__pyx_n_s_SocketSendError; PyObject *__pyx_n_s_SocketTimeout; PyObject *__pyx_n_s_Timeout; + PyObject *__pyx_n_s_Tuple; PyObject *__pyx_n_s_UnknownError; PyObject *__pyx_n_s_ZlibError; - PyObject *__pyx_n_s__13; + PyObject *__pyx_n_s__14; PyObject *__pyx_n_s__2; + PyObject *__pyx_kp_b__2; + PyObject *__pyx_kp_u__3; + PyObject *__pyx_n_s_args; PyObject *__pyx_n_s_asyncio_coroutines; PyObject *__pyx_n_s_block_directions; PyObject *__pyx_n_s_buf; - PyObject *__pyx_n_s_buf_len; - PyObject *__pyx_n_s_c_buf; + PyObject *__pyx_n_s_bytes; PyObject *__pyx_n_s_cline_in_traceback; - PyObject *__pyx_n_s_cur_buf; + PyObject *__pyx_n_s_close; + PyObject *__pyx_n_s_data; PyObject *__pyx_n_s_decode; PyObject *__pyx_n_s_directions; + PyObject *__pyx_kp_u_disable; + PyObject *__pyx_kp_u_enable; PyObject *__pyx_n_s_encode; + PyObject *__pyx_n_s_end_of_line; PyObject *__pyx_n_s_errcode; PyObject *__pyx_n_s_exceptions; PyObject *__pyx_n_s_find_eol; + PyObject *__pyx_kp_u_gc; PyObject *__pyx_n_s_handle_error_codes; PyObject *__pyx_n_s_import; - PyObject *__pyx_n_s_index; + PyObject *__pyx_n_s_int; PyObject *__pyx_n_s_is_coroutine; + PyObject *__pyx_kp_u_isenabled; + PyObject *__pyx_n_s_line; + PyObject *__pyx_n_s_linesep; PyObject *__pyx_n_s_main; PyObject *__pyx_n_s_name; - PyObject *__pyx_n_s_new_pos; + PyObject *__pyx_n_s_new_line_pos; PyObject *__pyx_n_s_pos; PyObject *__pyx_n_s_readfds; + PyObject *__pyx_n_s_readline; + PyObject *__pyx_n_s_remainder; + PyObject *__pyx_n_s_remainder_len; PyObject *__pyx_n_s_required_version; + PyObject *__pyx_n_s_return; PyObject *__pyx_n_s_select; + PyObject *__pyx_n_s_send; PyObject *__pyx_n_s_session; + PyObject *__pyx_n_s_size; PyObject *__pyx_n_s_socket; PyObject *__pyx_n_s_ssh2_exit; PyObject *__pyx_n_s_ssh2_utils; PyObject *__pyx_kp_s_ssh2_utils_pyx; + PyObject *__pyx_n_s_str; PyObject *__pyx_n_s_test; + PyObject *__pyx_n_s_throw; PyObject *__pyx_n_s_timeout; + PyObject *__pyx_n_s_typing; PyObject *__pyx_kp_u_utf_8; PyObject *__pyx_n_s_version; PyObject *__pyx_n_s_wait_socket; PyObject *__pyx_n_s_writefds; PyObject *__pyx_int_0; PyObject *__pyx_int_1; - PyObject *__pyx_int_neg_1; - PyObject *__pyx_tuple__3; - PyObject *__pyx_tuple__5; - PyObject *__pyx_tuple__8; + PyObject *__pyx_codeobj_; + PyObject *__pyx_tuple__4; + PyObject *__pyx_tuple__6; + PyObject *__pyx_tuple__7; PyObject *__pyx_tuple__10; - PyObject *__pyx_tuple__11; - PyObject *__pyx_codeobj__4; - PyObject *__pyx_codeobj__6; - PyObject *__pyx_codeobj__7; + PyObject *__pyx_tuple__12; + PyObject *__pyx_codeobj__5; + PyObject *__pyx_codeobj__8; PyObject *__pyx_codeobj__9; - PyObject *__pyx_codeobj__12; + PyObject *__pyx_codeobj__11; + PyObject *__pyx_codeobj__13; } __pyx_mstate; #if CYTHON_USE_MODULE_STATE @@ -2461,14 +2717,17 @@ static int __pyx_m_clear(PyObject *m) { #endif Py_CLEAR(clear_module_state->__pyx_ptype_4ssh2_7session_Session); Py_CLEAR(clear_module_state->__pyx_ptype_4ssh2_7session_MethodType); - Py_CLEAR(clear_module_state->__pyx_kp_u_); + Py_CLEAR(clear_module_state->__pyx_ptype_4ssh2_5utils___pyx_scope_struct__readline); + Py_CLEAR(clear_module_state->__pyx_type_4ssh2_5utils___pyx_scope_struct__readline); Py_CLEAR(clear_module_state->__pyx_n_s_AgentProtocolError); Py_CLEAR(clear_module_state->__pyx_n_s_AllocError); + Py_CLEAR(clear_module_state->__pyx_n_s_Any); Py_CLEAR(clear_module_state->__pyx_n_s_AuthenticationError); Py_CLEAR(clear_module_state->__pyx_n_s_BadSocketError); Py_CLEAR(clear_module_state->__pyx_n_s_BadUseError); Py_CLEAR(clear_module_state->__pyx_n_s_BannerRecvError); Py_CLEAR(clear_module_state->__pyx_n_s_BannerSendError); + Py_CLEAR(clear_module_state->__pyx_n_s_BinaryIO); Py_CLEAR(clear_module_state->__pyx_n_s_BufferTooSmallError); Py_CLEAR(clear_module_state->__pyx_n_s_ChannelClosedError); Py_CLEAR(clear_module_state->__pyx_n_s_ChannelEOFSentError); @@ -2485,22 +2744,28 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_EncryptError); Py_CLEAR(clear_module_state->__pyx_kp_u_Error_code_s_not_known); Py_CLEAR(clear_module_state->__pyx_n_s_FileError); + Py_CLEAR(clear_module_state->__pyx_n_s_Generator); + Py_CLEAR(clear_module_state->__pyx_kp_s_Generator_bytes); Py_CLEAR(clear_module_state->__pyx_n_s_HostkeyInitError); Py_CLEAR(clear_module_state->__pyx_n_s_HostkeySignError); Py_CLEAR(clear_module_state->__pyx_n_s_InvalidMACError); Py_CLEAR(clear_module_state->__pyx_n_s_InvalidPollTypeError); Py_CLEAR(clear_module_state->__pyx_n_s_InvalidRequestError); + Py_CLEAR(clear_module_state->__pyx_n_s_Iterable); + Py_CLEAR(clear_module_state->__pyx_kp_s_Iterable_bytes); Py_CLEAR(clear_module_state->__pyx_n_s_KexFailureError); Py_CLEAR(clear_module_state->__pyx_n_s_KeyExchangeError); Py_CLEAR(clear_module_state->__pyx_n_s_KeyfileAuthFailedError); Py_CLEAR(clear_module_state->__pyx_n_s_KnownHostError); Py_CLEAR(clear_module_state->__pyx_n_s_MethodNoneError); Py_CLEAR(clear_module_state->__pyx_n_s_MethodNotSupported); + Py_CLEAR(clear_module_state->__pyx_n_s_None); Py_CLEAR(clear_module_state->__pyx_n_s_OutOfBoundaryError); Py_CLEAR(clear_module_state->__pyx_n_s_PasswordExpiredError); Py_CLEAR(clear_module_state->__pyx_n_s_ProtocolError); Py_CLEAR(clear_module_state->__pyx_n_s_PublicKeyProtocolError); Py_CLEAR(clear_module_state->__pyx_n_s_PublickeyUnverifiedError); + Py_CLEAR(clear_module_state->__pyx_n_s_Py_ssize_t); Py_CLEAR(clear_module_state->__pyx_n_s_RequestDeniedError); Py_CLEAR(clear_module_state->__pyx_n_s_SCPProtocolError); Py_CLEAR(clear_module_state->__pyx_n_s_SFTPProtocolError); @@ -2510,58 +2775,78 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_SocketSendError); Py_CLEAR(clear_module_state->__pyx_n_s_SocketTimeout); Py_CLEAR(clear_module_state->__pyx_n_s_Timeout); + Py_CLEAR(clear_module_state->__pyx_n_s_Tuple); Py_CLEAR(clear_module_state->__pyx_n_s_UnknownError); Py_CLEAR(clear_module_state->__pyx_n_s_ZlibError); - Py_CLEAR(clear_module_state->__pyx_n_s__13); + Py_CLEAR(clear_module_state->__pyx_n_s__14); Py_CLEAR(clear_module_state->__pyx_n_s__2); + Py_CLEAR(clear_module_state->__pyx_kp_b__2); + Py_CLEAR(clear_module_state->__pyx_kp_u__3); + Py_CLEAR(clear_module_state->__pyx_n_s_args); Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); Py_CLEAR(clear_module_state->__pyx_n_s_block_directions); Py_CLEAR(clear_module_state->__pyx_n_s_buf); - Py_CLEAR(clear_module_state->__pyx_n_s_buf_len); - Py_CLEAR(clear_module_state->__pyx_n_s_c_buf); + Py_CLEAR(clear_module_state->__pyx_n_s_bytes); Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); - Py_CLEAR(clear_module_state->__pyx_n_s_cur_buf); + Py_CLEAR(clear_module_state->__pyx_n_s_close); + Py_CLEAR(clear_module_state->__pyx_n_s_data); Py_CLEAR(clear_module_state->__pyx_n_s_decode); Py_CLEAR(clear_module_state->__pyx_n_s_directions); + Py_CLEAR(clear_module_state->__pyx_kp_u_disable); + Py_CLEAR(clear_module_state->__pyx_kp_u_enable); Py_CLEAR(clear_module_state->__pyx_n_s_encode); + Py_CLEAR(clear_module_state->__pyx_n_s_end_of_line); Py_CLEAR(clear_module_state->__pyx_n_s_errcode); Py_CLEAR(clear_module_state->__pyx_n_s_exceptions); Py_CLEAR(clear_module_state->__pyx_n_s_find_eol); + Py_CLEAR(clear_module_state->__pyx_kp_u_gc); Py_CLEAR(clear_module_state->__pyx_n_s_handle_error_codes); Py_CLEAR(clear_module_state->__pyx_n_s_import); - Py_CLEAR(clear_module_state->__pyx_n_s_index); + Py_CLEAR(clear_module_state->__pyx_n_s_int); Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); + Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled); + Py_CLEAR(clear_module_state->__pyx_n_s_line); + Py_CLEAR(clear_module_state->__pyx_n_s_linesep); Py_CLEAR(clear_module_state->__pyx_n_s_main); Py_CLEAR(clear_module_state->__pyx_n_s_name); - Py_CLEAR(clear_module_state->__pyx_n_s_new_pos); + Py_CLEAR(clear_module_state->__pyx_n_s_new_line_pos); Py_CLEAR(clear_module_state->__pyx_n_s_pos); Py_CLEAR(clear_module_state->__pyx_n_s_readfds); + Py_CLEAR(clear_module_state->__pyx_n_s_readline); + Py_CLEAR(clear_module_state->__pyx_n_s_remainder); + Py_CLEAR(clear_module_state->__pyx_n_s_remainder_len); Py_CLEAR(clear_module_state->__pyx_n_s_required_version); + Py_CLEAR(clear_module_state->__pyx_n_s_return); Py_CLEAR(clear_module_state->__pyx_n_s_select); + Py_CLEAR(clear_module_state->__pyx_n_s_send); Py_CLEAR(clear_module_state->__pyx_n_s_session); + Py_CLEAR(clear_module_state->__pyx_n_s_size); Py_CLEAR(clear_module_state->__pyx_n_s_socket); Py_CLEAR(clear_module_state->__pyx_n_s_ssh2_exit); Py_CLEAR(clear_module_state->__pyx_n_s_ssh2_utils); Py_CLEAR(clear_module_state->__pyx_kp_s_ssh2_utils_pyx); + Py_CLEAR(clear_module_state->__pyx_n_s_str); Py_CLEAR(clear_module_state->__pyx_n_s_test); + Py_CLEAR(clear_module_state->__pyx_n_s_throw); Py_CLEAR(clear_module_state->__pyx_n_s_timeout); + Py_CLEAR(clear_module_state->__pyx_n_s_typing); Py_CLEAR(clear_module_state->__pyx_kp_u_utf_8); Py_CLEAR(clear_module_state->__pyx_n_s_version); Py_CLEAR(clear_module_state->__pyx_n_s_wait_socket); Py_CLEAR(clear_module_state->__pyx_n_s_writefds); Py_CLEAR(clear_module_state->__pyx_int_0); Py_CLEAR(clear_module_state->__pyx_int_1); - Py_CLEAR(clear_module_state->__pyx_int_neg_1); - Py_CLEAR(clear_module_state->__pyx_tuple__3); - Py_CLEAR(clear_module_state->__pyx_tuple__5); - Py_CLEAR(clear_module_state->__pyx_tuple__8); + Py_CLEAR(clear_module_state->__pyx_codeobj_); + Py_CLEAR(clear_module_state->__pyx_tuple__4); + Py_CLEAR(clear_module_state->__pyx_tuple__6); + Py_CLEAR(clear_module_state->__pyx_tuple__7); Py_CLEAR(clear_module_state->__pyx_tuple__10); - Py_CLEAR(clear_module_state->__pyx_tuple__11); - Py_CLEAR(clear_module_state->__pyx_codeobj__4); - Py_CLEAR(clear_module_state->__pyx_codeobj__6); - Py_CLEAR(clear_module_state->__pyx_codeobj__7); + Py_CLEAR(clear_module_state->__pyx_tuple__12); + Py_CLEAR(clear_module_state->__pyx_codeobj__5); + Py_CLEAR(clear_module_state->__pyx_codeobj__8); Py_CLEAR(clear_module_state->__pyx_codeobj__9); - Py_CLEAR(clear_module_state->__pyx_codeobj__12); + Py_CLEAR(clear_module_state->__pyx_codeobj__11); + Py_CLEAR(clear_module_state->__pyx_codeobj__13); return 0; } #endif @@ -2584,14 +2869,17 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #endif Py_VISIT(traverse_module_state->__pyx_ptype_4ssh2_7session_Session); Py_VISIT(traverse_module_state->__pyx_ptype_4ssh2_7session_MethodType); - Py_VISIT(traverse_module_state->__pyx_kp_u_); + Py_VISIT(traverse_module_state->__pyx_ptype_4ssh2_5utils___pyx_scope_struct__readline); + Py_VISIT(traverse_module_state->__pyx_type_4ssh2_5utils___pyx_scope_struct__readline); Py_VISIT(traverse_module_state->__pyx_n_s_AgentProtocolError); Py_VISIT(traverse_module_state->__pyx_n_s_AllocError); + Py_VISIT(traverse_module_state->__pyx_n_s_Any); Py_VISIT(traverse_module_state->__pyx_n_s_AuthenticationError); Py_VISIT(traverse_module_state->__pyx_n_s_BadSocketError); Py_VISIT(traverse_module_state->__pyx_n_s_BadUseError); Py_VISIT(traverse_module_state->__pyx_n_s_BannerRecvError); Py_VISIT(traverse_module_state->__pyx_n_s_BannerSendError); + Py_VISIT(traverse_module_state->__pyx_n_s_BinaryIO); Py_VISIT(traverse_module_state->__pyx_n_s_BufferTooSmallError); Py_VISIT(traverse_module_state->__pyx_n_s_ChannelClosedError); Py_VISIT(traverse_module_state->__pyx_n_s_ChannelEOFSentError); @@ -2608,22 +2896,28 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_EncryptError); Py_VISIT(traverse_module_state->__pyx_kp_u_Error_code_s_not_known); Py_VISIT(traverse_module_state->__pyx_n_s_FileError); + Py_VISIT(traverse_module_state->__pyx_n_s_Generator); + Py_VISIT(traverse_module_state->__pyx_kp_s_Generator_bytes); Py_VISIT(traverse_module_state->__pyx_n_s_HostkeyInitError); Py_VISIT(traverse_module_state->__pyx_n_s_HostkeySignError); Py_VISIT(traverse_module_state->__pyx_n_s_InvalidMACError); Py_VISIT(traverse_module_state->__pyx_n_s_InvalidPollTypeError); Py_VISIT(traverse_module_state->__pyx_n_s_InvalidRequestError); + Py_VISIT(traverse_module_state->__pyx_n_s_Iterable); + Py_VISIT(traverse_module_state->__pyx_kp_s_Iterable_bytes); Py_VISIT(traverse_module_state->__pyx_n_s_KexFailureError); Py_VISIT(traverse_module_state->__pyx_n_s_KeyExchangeError); Py_VISIT(traverse_module_state->__pyx_n_s_KeyfileAuthFailedError); Py_VISIT(traverse_module_state->__pyx_n_s_KnownHostError); Py_VISIT(traverse_module_state->__pyx_n_s_MethodNoneError); Py_VISIT(traverse_module_state->__pyx_n_s_MethodNotSupported); + Py_VISIT(traverse_module_state->__pyx_n_s_None); Py_VISIT(traverse_module_state->__pyx_n_s_OutOfBoundaryError); Py_VISIT(traverse_module_state->__pyx_n_s_PasswordExpiredError); Py_VISIT(traverse_module_state->__pyx_n_s_ProtocolError); Py_VISIT(traverse_module_state->__pyx_n_s_PublicKeyProtocolError); Py_VISIT(traverse_module_state->__pyx_n_s_PublickeyUnverifiedError); + Py_VISIT(traverse_module_state->__pyx_n_s_Py_ssize_t); Py_VISIT(traverse_module_state->__pyx_n_s_RequestDeniedError); Py_VISIT(traverse_module_state->__pyx_n_s_SCPProtocolError); Py_VISIT(traverse_module_state->__pyx_n_s_SFTPProtocolError); @@ -2633,58 +2927,78 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_SocketSendError); Py_VISIT(traverse_module_state->__pyx_n_s_SocketTimeout); Py_VISIT(traverse_module_state->__pyx_n_s_Timeout); + Py_VISIT(traverse_module_state->__pyx_n_s_Tuple); Py_VISIT(traverse_module_state->__pyx_n_s_UnknownError); Py_VISIT(traverse_module_state->__pyx_n_s_ZlibError); - Py_VISIT(traverse_module_state->__pyx_n_s__13); + Py_VISIT(traverse_module_state->__pyx_n_s__14); Py_VISIT(traverse_module_state->__pyx_n_s__2); + Py_VISIT(traverse_module_state->__pyx_kp_b__2); + Py_VISIT(traverse_module_state->__pyx_kp_u__3); + Py_VISIT(traverse_module_state->__pyx_n_s_args); Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); Py_VISIT(traverse_module_state->__pyx_n_s_block_directions); Py_VISIT(traverse_module_state->__pyx_n_s_buf); - Py_VISIT(traverse_module_state->__pyx_n_s_buf_len); - Py_VISIT(traverse_module_state->__pyx_n_s_c_buf); + Py_VISIT(traverse_module_state->__pyx_n_s_bytes); Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); - Py_VISIT(traverse_module_state->__pyx_n_s_cur_buf); + Py_VISIT(traverse_module_state->__pyx_n_s_close); + Py_VISIT(traverse_module_state->__pyx_n_s_data); Py_VISIT(traverse_module_state->__pyx_n_s_decode); Py_VISIT(traverse_module_state->__pyx_n_s_directions); + Py_VISIT(traverse_module_state->__pyx_kp_u_disable); + Py_VISIT(traverse_module_state->__pyx_kp_u_enable); Py_VISIT(traverse_module_state->__pyx_n_s_encode); + Py_VISIT(traverse_module_state->__pyx_n_s_end_of_line); Py_VISIT(traverse_module_state->__pyx_n_s_errcode); Py_VISIT(traverse_module_state->__pyx_n_s_exceptions); Py_VISIT(traverse_module_state->__pyx_n_s_find_eol); + Py_VISIT(traverse_module_state->__pyx_kp_u_gc); Py_VISIT(traverse_module_state->__pyx_n_s_handle_error_codes); Py_VISIT(traverse_module_state->__pyx_n_s_import); - Py_VISIT(traverse_module_state->__pyx_n_s_index); + Py_VISIT(traverse_module_state->__pyx_n_s_int); Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); + Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled); + Py_VISIT(traverse_module_state->__pyx_n_s_line); + Py_VISIT(traverse_module_state->__pyx_n_s_linesep); Py_VISIT(traverse_module_state->__pyx_n_s_main); Py_VISIT(traverse_module_state->__pyx_n_s_name); - Py_VISIT(traverse_module_state->__pyx_n_s_new_pos); + Py_VISIT(traverse_module_state->__pyx_n_s_new_line_pos); Py_VISIT(traverse_module_state->__pyx_n_s_pos); Py_VISIT(traverse_module_state->__pyx_n_s_readfds); + Py_VISIT(traverse_module_state->__pyx_n_s_readline); + Py_VISIT(traverse_module_state->__pyx_n_s_remainder); + Py_VISIT(traverse_module_state->__pyx_n_s_remainder_len); Py_VISIT(traverse_module_state->__pyx_n_s_required_version); + Py_VISIT(traverse_module_state->__pyx_n_s_return); Py_VISIT(traverse_module_state->__pyx_n_s_select); + Py_VISIT(traverse_module_state->__pyx_n_s_send); Py_VISIT(traverse_module_state->__pyx_n_s_session); + Py_VISIT(traverse_module_state->__pyx_n_s_size); Py_VISIT(traverse_module_state->__pyx_n_s_socket); Py_VISIT(traverse_module_state->__pyx_n_s_ssh2_exit); Py_VISIT(traverse_module_state->__pyx_n_s_ssh2_utils); Py_VISIT(traverse_module_state->__pyx_kp_s_ssh2_utils_pyx); + Py_VISIT(traverse_module_state->__pyx_n_s_str); Py_VISIT(traverse_module_state->__pyx_n_s_test); + Py_VISIT(traverse_module_state->__pyx_n_s_throw); Py_VISIT(traverse_module_state->__pyx_n_s_timeout); + Py_VISIT(traverse_module_state->__pyx_n_s_typing); Py_VISIT(traverse_module_state->__pyx_kp_u_utf_8); Py_VISIT(traverse_module_state->__pyx_n_s_version); Py_VISIT(traverse_module_state->__pyx_n_s_wait_socket); Py_VISIT(traverse_module_state->__pyx_n_s_writefds); Py_VISIT(traverse_module_state->__pyx_int_0); Py_VISIT(traverse_module_state->__pyx_int_1); - Py_VISIT(traverse_module_state->__pyx_int_neg_1); - Py_VISIT(traverse_module_state->__pyx_tuple__3); - Py_VISIT(traverse_module_state->__pyx_tuple__5); - Py_VISIT(traverse_module_state->__pyx_tuple__8); + Py_VISIT(traverse_module_state->__pyx_codeobj_); + Py_VISIT(traverse_module_state->__pyx_tuple__4); + Py_VISIT(traverse_module_state->__pyx_tuple__6); + Py_VISIT(traverse_module_state->__pyx_tuple__7); Py_VISIT(traverse_module_state->__pyx_tuple__10); - Py_VISIT(traverse_module_state->__pyx_tuple__11); - Py_VISIT(traverse_module_state->__pyx_codeobj__4); - Py_VISIT(traverse_module_state->__pyx_codeobj__6); - Py_VISIT(traverse_module_state->__pyx_codeobj__7); + Py_VISIT(traverse_module_state->__pyx_tuple__12); + Py_VISIT(traverse_module_state->__pyx_codeobj__5); + Py_VISIT(traverse_module_state->__pyx_codeobj__8); Py_VISIT(traverse_module_state->__pyx_codeobj__9); - Py_VISIT(traverse_module_state->__pyx_codeobj__12); + Py_VISIT(traverse_module_state->__pyx_codeobj__11); + Py_VISIT(traverse_module_state->__pyx_codeobj__13); return 0; } #endif @@ -2732,15 +3046,18 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #if CYTHON_USE_MODULE_STATE #endif #if CYTHON_USE_MODULE_STATE +#define __pyx_type_4ssh2_5utils___pyx_scope_struct__readline __pyx_mstate_global->__pyx_type_4ssh2_5utils___pyx_scope_struct__readline #endif -#define __pyx_kp_u_ __pyx_mstate_global->__pyx_kp_u_ +#define __pyx_ptype_4ssh2_5utils___pyx_scope_struct__readline __pyx_mstate_global->__pyx_ptype_4ssh2_5utils___pyx_scope_struct__readline #define __pyx_n_s_AgentProtocolError __pyx_mstate_global->__pyx_n_s_AgentProtocolError #define __pyx_n_s_AllocError __pyx_mstate_global->__pyx_n_s_AllocError +#define __pyx_n_s_Any __pyx_mstate_global->__pyx_n_s_Any #define __pyx_n_s_AuthenticationError __pyx_mstate_global->__pyx_n_s_AuthenticationError #define __pyx_n_s_BadSocketError __pyx_mstate_global->__pyx_n_s_BadSocketError #define __pyx_n_s_BadUseError __pyx_mstate_global->__pyx_n_s_BadUseError #define __pyx_n_s_BannerRecvError __pyx_mstate_global->__pyx_n_s_BannerRecvError #define __pyx_n_s_BannerSendError __pyx_mstate_global->__pyx_n_s_BannerSendError +#define __pyx_n_s_BinaryIO __pyx_mstate_global->__pyx_n_s_BinaryIO #define __pyx_n_s_BufferTooSmallError __pyx_mstate_global->__pyx_n_s_BufferTooSmallError #define __pyx_n_s_ChannelClosedError __pyx_mstate_global->__pyx_n_s_ChannelClosedError #define __pyx_n_s_ChannelEOFSentError __pyx_mstate_global->__pyx_n_s_ChannelEOFSentError @@ -2757,22 +3074,28 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_EncryptError __pyx_mstate_global->__pyx_n_s_EncryptError #define __pyx_kp_u_Error_code_s_not_known __pyx_mstate_global->__pyx_kp_u_Error_code_s_not_known #define __pyx_n_s_FileError __pyx_mstate_global->__pyx_n_s_FileError +#define __pyx_n_s_Generator __pyx_mstate_global->__pyx_n_s_Generator +#define __pyx_kp_s_Generator_bytes __pyx_mstate_global->__pyx_kp_s_Generator_bytes #define __pyx_n_s_HostkeyInitError __pyx_mstate_global->__pyx_n_s_HostkeyInitError #define __pyx_n_s_HostkeySignError __pyx_mstate_global->__pyx_n_s_HostkeySignError #define __pyx_n_s_InvalidMACError __pyx_mstate_global->__pyx_n_s_InvalidMACError #define __pyx_n_s_InvalidPollTypeError __pyx_mstate_global->__pyx_n_s_InvalidPollTypeError #define __pyx_n_s_InvalidRequestError __pyx_mstate_global->__pyx_n_s_InvalidRequestError +#define __pyx_n_s_Iterable __pyx_mstate_global->__pyx_n_s_Iterable +#define __pyx_kp_s_Iterable_bytes __pyx_mstate_global->__pyx_kp_s_Iterable_bytes #define __pyx_n_s_KexFailureError __pyx_mstate_global->__pyx_n_s_KexFailureError #define __pyx_n_s_KeyExchangeError __pyx_mstate_global->__pyx_n_s_KeyExchangeError #define __pyx_n_s_KeyfileAuthFailedError __pyx_mstate_global->__pyx_n_s_KeyfileAuthFailedError #define __pyx_n_s_KnownHostError __pyx_mstate_global->__pyx_n_s_KnownHostError #define __pyx_n_s_MethodNoneError __pyx_mstate_global->__pyx_n_s_MethodNoneError #define __pyx_n_s_MethodNotSupported __pyx_mstate_global->__pyx_n_s_MethodNotSupported +#define __pyx_n_s_None __pyx_mstate_global->__pyx_n_s_None #define __pyx_n_s_OutOfBoundaryError __pyx_mstate_global->__pyx_n_s_OutOfBoundaryError #define __pyx_n_s_PasswordExpiredError __pyx_mstate_global->__pyx_n_s_PasswordExpiredError #define __pyx_n_s_ProtocolError __pyx_mstate_global->__pyx_n_s_ProtocolError #define __pyx_n_s_PublicKeyProtocolError __pyx_mstate_global->__pyx_n_s_PublicKeyProtocolError #define __pyx_n_s_PublickeyUnverifiedError __pyx_mstate_global->__pyx_n_s_PublickeyUnverifiedError +#define __pyx_n_s_Py_ssize_t __pyx_mstate_global->__pyx_n_s_Py_ssize_t #define __pyx_n_s_RequestDeniedError __pyx_mstate_global->__pyx_n_s_RequestDeniedError #define __pyx_n_s_SCPProtocolError __pyx_mstate_global->__pyx_n_s_SCPProtocolError #define __pyx_n_s_SFTPProtocolError __pyx_mstate_global->__pyx_n_s_SFTPProtocolError @@ -2782,61 +3105,81 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_SocketSendError __pyx_mstate_global->__pyx_n_s_SocketSendError #define __pyx_n_s_SocketTimeout __pyx_mstate_global->__pyx_n_s_SocketTimeout #define __pyx_n_s_Timeout __pyx_mstate_global->__pyx_n_s_Timeout +#define __pyx_n_s_Tuple __pyx_mstate_global->__pyx_n_s_Tuple #define __pyx_n_s_UnknownError __pyx_mstate_global->__pyx_n_s_UnknownError #define __pyx_n_s_ZlibError __pyx_mstate_global->__pyx_n_s_ZlibError -#define __pyx_n_s__13 __pyx_mstate_global->__pyx_n_s__13 +#define __pyx_n_s__14 __pyx_mstate_global->__pyx_n_s__14 #define __pyx_n_s__2 __pyx_mstate_global->__pyx_n_s__2 +#define __pyx_kp_b__2 __pyx_mstate_global->__pyx_kp_b__2 +#define __pyx_kp_u__3 __pyx_mstate_global->__pyx_kp_u__3 +#define __pyx_n_s_args __pyx_mstate_global->__pyx_n_s_args #define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines #define __pyx_n_s_block_directions __pyx_mstate_global->__pyx_n_s_block_directions #define __pyx_n_s_buf __pyx_mstate_global->__pyx_n_s_buf -#define __pyx_n_s_buf_len __pyx_mstate_global->__pyx_n_s_buf_len -#define __pyx_n_s_c_buf __pyx_mstate_global->__pyx_n_s_c_buf +#define __pyx_n_s_bytes __pyx_mstate_global->__pyx_n_s_bytes #define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback -#define __pyx_n_s_cur_buf __pyx_mstate_global->__pyx_n_s_cur_buf +#define __pyx_n_s_close __pyx_mstate_global->__pyx_n_s_close +#define __pyx_n_s_data __pyx_mstate_global->__pyx_n_s_data #define __pyx_n_s_decode __pyx_mstate_global->__pyx_n_s_decode #define __pyx_n_s_directions __pyx_mstate_global->__pyx_n_s_directions +#define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable +#define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable #define __pyx_n_s_encode __pyx_mstate_global->__pyx_n_s_encode +#define __pyx_n_s_end_of_line __pyx_mstate_global->__pyx_n_s_end_of_line #define __pyx_n_s_errcode __pyx_mstate_global->__pyx_n_s_errcode #define __pyx_n_s_exceptions __pyx_mstate_global->__pyx_n_s_exceptions #define __pyx_n_s_find_eol __pyx_mstate_global->__pyx_n_s_find_eol +#define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc #define __pyx_n_s_handle_error_codes __pyx_mstate_global->__pyx_n_s_handle_error_codes #define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import -#define __pyx_n_s_index __pyx_mstate_global->__pyx_n_s_index +#define __pyx_n_s_int __pyx_mstate_global->__pyx_n_s_int #define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine +#define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled +#define __pyx_n_s_line __pyx_mstate_global->__pyx_n_s_line +#define __pyx_n_s_linesep __pyx_mstate_global->__pyx_n_s_linesep #define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main #define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name -#define __pyx_n_s_new_pos __pyx_mstate_global->__pyx_n_s_new_pos +#define __pyx_n_s_new_line_pos __pyx_mstate_global->__pyx_n_s_new_line_pos #define __pyx_n_s_pos __pyx_mstate_global->__pyx_n_s_pos #define __pyx_n_s_readfds __pyx_mstate_global->__pyx_n_s_readfds +#define __pyx_n_s_readline __pyx_mstate_global->__pyx_n_s_readline +#define __pyx_n_s_remainder __pyx_mstate_global->__pyx_n_s_remainder +#define __pyx_n_s_remainder_len __pyx_mstate_global->__pyx_n_s_remainder_len #define __pyx_n_s_required_version __pyx_mstate_global->__pyx_n_s_required_version +#define __pyx_n_s_return __pyx_mstate_global->__pyx_n_s_return #define __pyx_n_s_select __pyx_mstate_global->__pyx_n_s_select +#define __pyx_n_s_send __pyx_mstate_global->__pyx_n_s_send #define __pyx_n_s_session __pyx_mstate_global->__pyx_n_s_session +#define __pyx_n_s_size __pyx_mstate_global->__pyx_n_s_size #define __pyx_n_s_socket __pyx_mstate_global->__pyx_n_s_socket #define __pyx_n_s_ssh2_exit __pyx_mstate_global->__pyx_n_s_ssh2_exit #define __pyx_n_s_ssh2_utils __pyx_mstate_global->__pyx_n_s_ssh2_utils #define __pyx_kp_s_ssh2_utils_pyx __pyx_mstate_global->__pyx_kp_s_ssh2_utils_pyx +#define __pyx_n_s_str __pyx_mstate_global->__pyx_n_s_str #define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test +#define __pyx_n_s_throw __pyx_mstate_global->__pyx_n_s_throw #define __pyx_n_s_timeout __pyx_mstate_global->__pyx_n_s_timeout +#define __pyx_n_s_typing __pyx_mstate_global->__pyx_n_s_typing #define __pyx_kp_u_utf_8 __pyx_mstate_global->__pyx_kp_u_utf_8 #define __pyx_n_s_version __pyx_mstate_global->__pyx_n_s_version #define __pyx_n_s_wait_socket __pyx_mstate_global->__pyx_n_s_wait_socket #define __pyx_n_s_writefds __pyx_mstate_global->__pyx_n_s_writefds #define __pyx_int_0 __pyx_mstate_global->__pyx_int_0 #define __pyx_int_1 __pyx_mstate_global->__pyx_int_1 -#define __pyx_int_neg_1 __pyx_mstate_global->__pyx_int_neg_1 -#define __pyx_tuple__3 __pyx_mstate_global->__pyx_tuple__3 -#define __pyx_tuple__5 __pyx_mstate_global->__pyx_tuple__5 -#define __pyx_tuple__8 __pyx_mstate_global->__pyx_tuple__8 +#define __pyx_codeobj_ __pyx_mstate_global->__pyx_codeobj_ +#define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4 +#define __pyx_tuple__6 __pyx_mstate_global->__pyx_tuple__6 +#define __pyx_tuple__7 __pyx_mstate_global->__pyx_tuple__7 #define __pyx_tuple__10 __pyx_mstate_global->__pyx_tuple__10 -#define __pyx_tuple__11 __pyx_mstate_global->__pyx_tuple__11 -#define __pyx_codeobj__4 __pyx_mstate_global->__pyx_codeobj__4 -#define __pyx_codeobj__6 __pyx_mstate_global->__pyx_codeobj__6 -#define __pyx_codeobj__7 __pyx_mstate_global->__pyx_codeobj__7 +#define __pyx_tuple__12 __pyx_mstate_global->__pyx_tuple__12 +#define __pyx_codeobj__5 __pyx_mstate_global->__pyx_codeobj__5 +#define __pyx_codeobj__8 __pyx_mstate_global->__pyx_codeobj__8 #define __pyx_codeobj__9 __pyx_mstate_global->__pyx_codeobj__9 -#define __pyx_codeobj__12 __pyx_mstate_global->__pyx_codeobj__12 +#define __pyx_codeobj__11 __pyx_mstate_global->__pyx_codeobj__11 +#define __pyx_codeobj__13 __pyx_mstate_global->__pyx_codeobj__13 /* #### Code section: module_code ### */ -/* "ssh2/utils.pyx":30 +/* "ssh2/utils.pyx":31 * * * cdef bytes to_bytes(_str): # <<<<<<<<<<<<<< @@ -2858,7 +3201,7 @@ static PyObject *__pyx_f_4ssh2_5utils_to_bytes(PyObject *__pyx_v__str) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("to_bytes", 1); - /* "ssh2/utils.pyx":31 + /* "ssh2/utils.pyx":32 * * cdef bytes to_bytes(_str): * if isinstance(_str, bytes): # <<<<<<<<<<<<<< @@ -2868,7 +3211,7 @@ static PyObject *__pyx_f_4ssh2_5utils_to_bytes(PyObject *__pyx_v__str) { __pyx_t_1 = PyBytes_Check(__pyx_v__str); if (__pyx_t_1) { - /* "ssh2/utils.pyx":32 + /* "ssh2/utils.pyx":33 * cdef bytes to_bytes(_str): * if isinstance(_str, bytes): * return _str # <<<<<<<<<<<<<< @@ -2876,12 +3219,12 @@ static PyObject *__pyx_f_4ssh2_5utils_to_bytes(PyObject *__pyx_v__str) { * return _str.encode(ENCODING) */ __Pyx_XDECREF(__pyx_r); - if (!(likely(PyBytes_CheckExact(__pyx_v__str))||((__pyx_v__str) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v__str))) __PYX_ERR(0, 32, __pyx_L1_error) + if (!(likely(PyBytes_CheckExact(__pyx_v__str))||((__pyx_v__str) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v__str))) __PYX_ERR(0, 33, __pyx_L1_error) __Pyx_INCREF(__pyx_v__str); __pyx_r = ((PyObject*)__pyx_v__str); goto __pyx_L0; - /* "ssh2/utils.pyx":31 + /* "ssh2/utils.pyx":32 * * cdef bytes to_bytes(_str): * if isinstance(_str, bytes): # <<<<<<<<<<<<<< @@ -2890,7 +3233,7 @@ static PyObject *__pyx_f_4ssh2_5utils_to_bytes(PyObject *__pyx_v__str) { */ } - /* "ssh2/utils.pyx":33 + /* "ssh2/utils.pyx":34 * if isinstance(_str, bytes): * return _str * elif isinstance(_str, unicode): # <<<<<<<<<<<<<< @@ -2900,7 +3243,7 @@ static PyObject *__pyx_f_4ssh2_5utils_to_bytes(PyObject *__pyx_v__str) { __pyx_t_1 = PyUnicode_Check(__pyx_v__str); if (__pyx_t_1) { - /* "ssh2/utils.pyx":34 + /* "ssh2/utils.pyx":35 * return _str * elif isinstance(_str, unicode): * return _str.encode(ENCODING) # <<<<<<<<<<<<<< @@ -2908,9 +3251,9 @@ static PyObject *__pyx_f_4ssh2_5utils_to_bytes(PyObject *__pyx_v__str) { * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v__str, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v__str, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_ENCODING); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_ENCODING); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; __pyx_t_6 = 0; @@ -2931,16 +3274,16 @@ static PyObject *__pyx_f_4ssh2_5utils_to_bytes(PyObject *__pyx_v__str) { __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_2))) __PYX_ERR(0, 34, __pyx_L1_error) + if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_2))) __PYX_ERR(0, 35, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/utils.pyx":33 + /* "ssh2/utils.pyx":34 * if isinstance(_str, bytes): * return _str * elif isinstance(_str, unicode): # <<<<<<<<<<<<<< @@ -2949,7 +3292,7 @@ static PyObject *__pyx_f_4ssh2_5utils_to_bytes(PyObject *__pyx_v__str) { */ } - /* "ssh2/utils.pyx":35 + /* "ssh2/utils.pyx":36 * elif isinstance(_str, unicode): * return _str.encode(ENCODING) * return _str # <<<<<<<<<<<<<< @@ -2957,12 +3300,12 @@ static PyObject *__pyx_f_4ssh2_5utils_to_bytes(PyObject *__pyx_v__str) { * */ __Pyx_XDECREF(__pyx_r); - if (!(likely(PyBytes_CheckExact(__pyx_v__str))||((__pyx_v__str) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v__str))) __PYX_ERR(0, 35, __pyx_L1_error) + if (!(likely(PyBytes_CheckExact(__pyx_v__str))||((__pyx_v__str) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v__str))) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_INCREF(__pyx_v__str); __pyx_r = ((PyObject*)__pyx_v__str); goto __pyx_L0; - /* "ssh2/utils.pyx":30 + /* "ssh2/utils.pyx":31 * * * cdef bytes to_bytes(_str): # <<<<<<<<<<<<<< @@ -2984,7 +3327,7 @@ static PyObject *__pyx_f_4ssh2_5utils_to_bytes(PyObject *__pyx_v__str) { return __pyx_r; } -/* "ssh2/utils.pyx":38 +/* "ssh2/utils.pyx":39 * * * cdef object to_str(char *c_str): # <<<<<<<<<<<<<< @@ -3008,17 +3351,17 @@ static PyObject *__pyx_f_4ssh2_5utils_to_str(char *__pyx_v_c_str) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("to_str", 1); - /* "ssh2/utils.pyx":39 + /* "ssh2/utils.pyx":40 * * cdef object to_str(char *c_str): * _len = len(c_str) # <<<<<<<<<<<<<< * if PY_MAJOR_VERSION < 3: * return c_str[:_len] */ - __pyx_t_1 = __Pyx_ssize_strlen(__pyx_v_c_str); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 39, __pyx_L1_error) + __pyx_t_1 = __Pyx_ssize_strlen(__pyx_v_c_str); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 40, __pyx_L1_error) __pyx_v__len = __pyx_t_1; - /* "ssh2/utils.pyx":40 + /* "ssh2/utils.pyx":41 * cdef object to_str(char *c_str): * _len = len(c_str) * if PY_MAJOR_VERSION < 3: # <<<<<<<<<<<<<< @@ -3028,7 +3371,7 @@ static PyObject *__pyx_f_4ssh2_5utils_to_str(char *__pyx_v_c_str) { __pyx_t_2 = (PY_MAJOR_VERSION < 3); if (__pyx_t_2) { - /* "ssh2/utils.pyx":41 + /* "ssh2/utils.pyx":42 * _len = len(c_str) * if PY_MAJOR_VERSION < 3: * return c_str[:_len] # <<<<<<<<<<<<<< @@ -3036,13 +3379,13 @@ static PyObject *__pyx_f_4ssh2_5utils_to_str(char *__pyx_v_c_str) { * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_c_str + 0, __pyx_v__len - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_c_str + 0, __pyx_v__len - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/utils.pyx":40 + /* "ssh2/utils.pyx":41 * cdef object to_str(char *c_str): * _len = len(c_str) * if PY_MAJOR_VERSION < 3: # <<<<<<<<<<<<<< @@ -3051,7 +3394,7 @@ static PyObject *__pyx_f_4ssh2_5utils_to_str(char *__pyx_v_c_str) { */ } - /* "ssh2/utils.pyx":42 + /* "ssh2/utils.pyx":43 * if PY_MAJOR_VERSION < 3: * return c_str[:_len] * return c_str[:_len].decode(ENCODING) # <<<<<<<<<<<<<< @@ -3059,12 +3402,12 @@ static PyObject *__pyx_f_4ssh2_5utils_to_str(char *__pyx_v_c_str) { * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_c_str + 0, __pyx_v__len - 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_c_str + 0, __pyx_v__len - 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_decode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_decode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_ENCODING); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_ENCODING); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = NULL; __pyx_t_7 = 0; @@ -3085,7 +3428,7 @@ static PyObject *__pyx_f_4ssh2_5utils_to_str(char *__pyx_v_c_str) { __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } @@ -3093,7 +3436,7 @@ static PyObject *__pyx_f_4ssh2_5utils_to_str(char *__pyx_v_c_str) { __pyx_t_3 = 0; goto __pyx_L0; - /* "ssh2/utils.pyx":38 + /* "ssh2/utils.pyx":39 * * * cdef object to_str(char *c_str): # <<<<<<<<<<<<<< @@ -3115,7 +3458,7 @@ static PyObject *__pyx_f_4ssh2_5utils_to_str(char *__pyx_v_c_str) { return __pyx_r; } -/* "ssh2/utils.pyx":45 +/* "ssh2/utils.pyx":46 * * * cdef object to_str_len(char *c_str, int length): # <<<<<<<<<<<<<< @@ -3137,7 +3480,7 @@ static PyObject *__pyx_f_4ssh2_5utils_to_str_len(char *__pyx_v_c_str, int __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("to_str_len", 1); - /* "ssh2/utils.pyx":46 + /* "ssh2/utils.pyx":47 * * cdef object to_str_len(char *c_str, int length): * if PY_MAJOR_VERSION < 3: # <<<<<<<<<<<<<< @@ -3147,7 +3490,7 @@ static PyObject *__pyx_f_4ssh2_5utils_to_str_len(char *__pyx_v_c_str, int __pyx_ __pyx_t_1 = (PY_MAJOR_VERSION < 3); if (__pyx_t_1) { - /* "ssh2/utils.pyx":47 + /* "ssh2/utils.pyx":48 * cdef object to_str_len(char *c_str, int length): * if PY_MAJOR_VERSION < 3: * return c_str[:length] # <<<<<<<<<<<<<< @@ -3155,13 +3498,13 @@ static PyObject *__pyx_f_4ssh2_5utils_to_str_len(char *__pyx_v_c_str, int __pyx_ * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_c_str + 0, __pyx_v_length - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_c_str + 0, __pyx_v_length - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/utils.pyx":46 + /* "ssh2/utils.pyx":47 * * cdef object to_str_len(char *c_str, int length): * if PY_MAJOR_VERSION < 3: # <<<<<<<<<<<<<< @@ -3170,7 +3513,7 @@ static PyObject *__pyx_f_4ssh2_5utils_to_str_len(char *__pyx_v_c_str, int __pyx_ */ } - /* "ssh2/utils.pyx":48 + /* "ssh2/utils.pyx":49 * if PY_MAJOR_VERSION < 3: * return c_str[:length] * return c_str[:length].decode(ENCODING) # <<<<<<<<<<<<<< @@ -3178,12 +3521,12 @@ static PyObject *__pyx_f_4ssh2_5utils_to_str_len(char *__pyx_v_c_str, int __pyx_ * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_c_str + 0, __pyx_v_length - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_c_str + 0, __pyx_v_length - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_decode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_decode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ENCODING); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ENCODING); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = NULL; __pyx_t_6 = 0; @@ -3204,7 +3547,7 @@ static PyObject *__pyx_f_4ssh2_5utils_to_str_len(char *__pyx_v_c_str, int __pyx_ __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } @@ -3212,7 +3555,7 @@ static PyObject *__pyx_f_4ssh2_5utils_to_str_len(char *__pyx_v_c_str, int __pyx_ __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/utils.pyx":45 + /* "ssh2/utils.pyx":46 * * * cdef object to_str_len(char *c_str, int length): # <<<<<<<<<<<<<< @@ -3234,15 +3577,14 @@ static PyObject *__pyx_f_4ssh2_5utils_to_str_len(char *__pyx_v_c_str, int __pyx_ return __pyx_r; } -/* "ssh2/utils.pyx":51 +/* "ssh2/utils.pyx":52 * * - * def find_eol(bytes buf, Py_ssize_t pos): # <<<<<<<<<<<<<< + * cpdef (int, int) find_eol(bytes buf: bytes, Py_ssize_t pos: Py_ssize_t): # <<<<<<<<<<<<<< * """Find end-of-line in buffer from position and return end position of * line and where next find_eol should start from. */ -/* Python wrapper */ static PyObject *__pyx_pw_4ssh2_5utils_1find_eol(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds @@ -3250,149 +3592,35 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_5utils_find_eol, "find_eol(bytes buf, Py_ssize_t pos)\nFind end-of-line in buffer from position and return end position of\n line and where next find_eol should start from.\n\n Eg - find_eol(b'line\nline2', 0) would return (5, 6), next call should be\n find_eol(b'line\nline2', 6) for next line where 6 was added to previous\n position.\n\n :param buf: Data buffer to parse for line.\n :type buf: bytes\n :param pos: Starting position to parse from\n :type pos: int\n\n :rtype: (int, int)"); -static PyMethodDef __pyx_mdef_4ssh2_5utils_1find_eol = {"find_eol", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_5utils_1find_eol, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_5utils_find_eol}; -static PyObject *__pyx_pw_4ssh2_5utils_1find_eol(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - PyObject *__pyx_v_buf = 0; - Py_ssize_t __pyx_v_pos; - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED Py_ssize_t __pyx_nargs; - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject* values[2] = {0,0}; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("find_eol (wrapper)", 0); - #if !CYTHON_METH_FASTCALL - #if CYTHON_ASSUME_SAFE_MACROS - __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #else - __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; - #endif - #endif - __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_buf,&__pyx_n_s_pos,0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_buf)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 51, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pos)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 51, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("find_eol", 1, 2, 2, 1); __PYX_ERR(0, 51, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "find_eol") < 0)) __PYX_ERR(0, 51, __pyx_L3_error) - } - } else if (unlikely(__pyx_nargs != 2)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - } - __pyx_v_buf = ((PyObject*)values[0]); - __pyx_v_pos = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_pos == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 51, __pyx_L3_error) - } - goto __pyx_L6_skip; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("find_eol", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 51, __pyx_L3_error) - __pyx_L6_skip:; - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - { - Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); - } - } - __Pyx_AddTraceback("ssh2.utils.find_eol", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buf), (&PyBytes_Type), 1, "buf", 1))) __PYX_ERR(0, 51, __pyx_L1_error) - __pyx_r = __pyx_pf_4ssh2_5utils_find_eol(__pyx_self, __pyx_v_buf, __pyx_v_pos); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - { - Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); - } - } - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_4ssh2_5utils_find_eol(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buf, Py_ssize_t __pyx_v_pos) { +static __pyx_ctuple_int__and_int __pyx_f_4ssh2_5utils_find_eol(PyObject *__pyx_v_buf, Py_ssize_t __pyx_v_pos, CYTHON_UNUSED int __pyx_skip_dispatch) { Py_ssize_t __pyx_v_buf_len; PyObject *__pyx_v_cur_buf = 0; char *__pyx_v_c_buf; int __pyx_v_index; int __pyx_v_new_pos; - PyObject *__pyx_r = NULL; + __pyx_ctuple_int__and_int __pyx_r; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; + __pyx_ctuple_int__and_int __pyx_t_3; PyObject *__pyx_t_4 = NULL; char *__pyx_t_5; - PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("find_eol", 1); - /* "ssh2/utils.pyx":65 + /* "ssh2/utils.pyx":66 * * :rtype: (int, int)""" * cdef Py_ssize_t buf_len = len(buf) # <<<<<<<<<<<<<< * if buf_len == 0: * return -1, pos */ - if (unlikely(__pyx_v_buf == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 65, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_PyBytes_GET_SIZE(__pyx_v_buf); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 65, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBytes_GET_SIZE(__pyx_v_buf); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 66, __pyx_L1_error) __pyx_v_buf_len = __pyx_t_1; - /* "ssh2/utils.pyx":66 + /* "ssh2/utils.pyx":67 * :rtype: (int, int)""" * cdef Py_ssize_t buf_len = len(buf) * if buf_len == 0: # <<<<<<<<<<<<<< @@ -3402,29 +3630,19 @@ static PyObject *__pyx_pf_4ssh2_5utils_find_eol(CYTHON_UNUSED PyObject *__pyx_se __pyx_t_2 = (__pyx_v_buf_len == 0); if (__pyx_t_2) { - /* "ssh2/utils.pyx":67 + /* "ssh2/utils.pyx":68 * cdef Py_ssize_t buf_len = len(buf) * if buf_len == 0: * return -1, pos # <<<<<<<<<<<<<< * cdef bytes cur_buf = buf[pos:buf_len] * cdef char* c_buf = cur_buf */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_pos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_int_neg_1); - __Pyx_GIVEREF(__pyx_int_neg_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_neg_1)) __PYX_ERR(0, 67, __pyx_L1_error); - __Pyx_GIVEREF(__pyx_t_3); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3)) __PYX_ERR(0, 67, __pyx_L1_error); - __pyx_t_3 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_t_3.f0 = -1; + __pyx_t_3.f1 = __pyx_v_pos; + __pyx_r = __pyx_t_3; goto __pyx_L0; - /* "ssh2/utils.pyx":66 + /* "ssh2/utils.pyx":67 * :rtype: (int, int)""" * cdef Py_ssize_t buf_len = len(buf) * if buf_len == 0: # <<<<<<<<<<<<<< @@ -3433,33 +3651,29 @@ static PyObject *__pyx_pf_4ssh2_5utils_find_eol(CYTHON_UNUSED PyObject *__pyx_se */ } - /* "ssh2/utils.pyx":68 + /* "ssh2/utils.pyx":69 * if buf_len == 0: * return -1, pos * cdef bytes cur_buf = buf[pos:buf_len] # <<<<<<<<<<<<<< * cdef char* c_buf = cur_buf * cdef int index */ - if (unlikely(__pyx_v_buf == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 68, __pyx_L1_error) - } - __pyx_t_4 = PySequence_GetSlice(__pyx_v_buf, __pyx_v_pos, __pyx_v_buf_len); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error) + __pyx_t_4 = PySequence_GetSlice(__pyx_v_buf, __pyx_v_pos, __pyx_v_buf_len); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_v_cur_buf = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; - /* "ssh2/utils.pyx":69 + /* "ssh2/utils.pyx":70 * return -1, pos * cdef bytes cur_buf = buf[pos:buf_len] * cdef char* c_buf = cur_buf # <<<<<<<<<<<<<< * cdef int index * cdef int new_pos */ - __pyx_t_5 = __Pyx_PyBytes_AsWritableString(__pyx_v_cur_buf); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyBytes_AsWritableString(__pyx_v_cur_buf); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 70, __pyx_L1_error) __pyx_v_c_buf = __pyx_t_5; - /* "ssh2/utils.pyx":72 + /* "ssh2/utils.pyx":73 * cdef int index * cdef int new_pos * with nogil: # <<<<<<<<<<<<<< @@ -3475,7 +3689,7 @@ static PyObject *__pyx_pf_4ssh2_5utils_find_eol(CYTHON_UNUSED PyObject *__pyx_se #endif /*try:*/ { - /* "ssh2/utils.pyx":73 + /* "ssh2/utils.pyx":74 * cdef int new_pos * with nogil: * new_pos = 0 # <<<<<<<<<<<<<< @@ -3484,7 +3698,7 @@ static PyObject *__pyx_pf_4ssh2_5utils_find_eol(CYTHON_UNUSED PyObject *__pyx_se */ __pyx_v_new_pos = 0; - /* "ssh2/utils.pyx":74 + /* "ssh2/utils.pyx":75 * with nogil: * new_pos = 0 * index = c_find_eol(c_buf, &new_pos) # <<<<<<<<<<<<<< @@ -3494,7 +3708,7 @@ static PyObject *__pyx_pf_4ssh2_5utils_find_eol(CYTHON_UNUSED PyObject *__pyx_se __pyx_v_index = find_eol(__pyx_v_c_buf, (&__pyx_v_new_pos)); } - /* "ssh2/utils.pyx":72 + /* "ssh2/utils.pyx":73 * cdef int index * cdef int new_pos * with nogil: # <<<<<<<<<<<<<< @@ -3513,89 +3727,67 @@ static PyObject *__pyx_pf_4ssh2_5utils_find_eol(CYTHON_UNUSED PyObject *__pyx_se } } - /* "ssh2/utils.pyx":75 + /* "ssh2/utils.pyx":76 * new_pos = 0 * index = c_find_eol(c_buf, &new_pos) * return index, new_pos # <<<<<<<<<<<<<< * * */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 75, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_new_pos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 75, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 75, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_4); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4)) __PYX_ERR(0, 75, __pyx_L1_error); - __Pyx_GIVEREF(__pyx_t_3); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3)) __PYX_ERR(0, 75, __pyx_L1_error); - __pyx_t_4 = 0; - __pyx_t_3 = 0; - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_t_3.f0 = __pyx_v_index; + __pyx_t_3.f1 = __pyx_v_new_pos; + __pyx_r = __pyx_t_3; goto __pyx_L0; - /* "ssh2/utils.pyx":51 + /* "ssh2/utils.pyx":52 * * - * def find_eol(bytes buf, Py_ssize_t pos): # <<<<<<<<<<<<<< + * cpdef (int, int) find_eol(bytes buf: bytes, Py_ssize_t pos: Py_ssize_t): # <<<<<<<<<<<<<< * """Find end-of-line in buffer from position and return end position of * line and where next find_eol should start from. */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("ssh2.utils.find_eol", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_pretend_to_initialize(&__pyx_r); __pyx_L0:; __Pyx_XDECREF(__pyx_v_cur_buf); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "ssh2/utils.pyx":78 - * - * - * def version(int required_version=0): # <<<<<<<<<<<<<< - * """Get libssh2 version string. - * - */ - /* Python wrapper */ -static PyObject *__pyx_pw_4ssh2_5utils_3version(PyObject *__pyx_self, +static PyObject *__pyx_pw_4ssh2_5utils_1find_eol(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_5utils_2version, "version(int required_version=0)\nGet libssh2 version string.\n\n Passing in a non-zero required_version causes the function to return\n `None` if version is less than required_version\n\n :param required_version: Minimum required version\n :type required_version: int\n "); -static PyMethodDef __pyx_mdef_4ssh2_5utils_3version = {"version", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_5utils_3version, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_5utils_2version}; -static PyObject *__pyx_pw_4ssh2_5utils_3version(PyObject *__pyx_self, +PyDoc_STRVAR(__pyx_doc_4ssh2_5utils_find_eol, "find_eol(buf: bytes, pos: Py_ssize_t) -> (int,_int)_\nFind end-of-line in buffer from position and return end position of\n line and where next find_eol should start from.\n\n Eg - find_eol(b'line\nline2', 0) would return (5, 6), next call should be\n find_eol(b'line\nline2', 6) for next line where 6 was added to previous\n position.\n\n :param buf: Data buffer to parse for line.\n :type buf: bytes\n :param pos: Starting position to parse from\n :type pos: int\n\n :rtype: (int, int)"); +static PyMethodDef __pyx_mdef_4ssh2_5utils_1find_eol = {"find_eol", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_5utils_1find_eol, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_5utils_find_eol}; +static PyObject *__pyx_pw_4ssh2_5utils_1find_eol(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { - int __pyx_v_required_version; + PyObject *__pyx_v_buf = 0; + Py_ssize_t __pyx_v_pos; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject* values[1] = {0}; + PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("version (wrapper)", 0); + __Pyx_RefNannySetupContext("find_eol (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -3605,10 +3797,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_required_version,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_buf,&__pyx_n_s_pos,0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; @@ -3617,33 +3811,39 @@ PyObject *__pyx_args, PyObject *__pyx_kwds kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: - if (kw_args > 0) { - PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_required_version); - if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 78, __pyx_L3_error) + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_buf)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "version") < 0)) __PYX_ERR(0, 78, __pyx_L3_error) - } - } else { - switch (__pyx_nargs) { - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 52, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pos)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 52, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("find_eol", 1, 2, 2, 1); __PYX_ERR(0, 52, __pyx_L3_error) + } } - } - if (values[0]) { - __pyx_v_required_version = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_required_version == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 78, __pyx_L3_error) + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "find_eol") < 0)) __PYX_ERR(0, 52, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; } else { - __pyx_v_required_version = ((int)((int)0)); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); } + __pyx_v_buf = ((PyObject*)values[0]); + __pyx_v_pos = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_pos == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 52, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("version", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 78, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("find_eol", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 52, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3653,13 +3853,18 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } - __Pyx_AddTraceback("ssh2.utils.version", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("ssh2.utils.find_eol", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4ssh2_5utils_2version(__pyx_self, __pyx_v_required_version); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buf), (&PyBytes_Type), 0, "buf", 1))) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_r = __pyx_pf_4ssh2_5utils_find_eol(__pyx_self, __pyx_v_buf, __pyx_v_pos); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { @@ -3670,218 +3875,72 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_4ssh2_5utils_2version(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_required_version) { - char const *__pyx_v_version; +static PyObject *__pyx_pf_4ssh2_5utils_find_eol(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buf, Py_ssize_t __pyx_v_pos) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; + __pyx_ctuple_int__and_int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("version", 1); - - /* "ssh2/utils.pyx":88 - * """ - * cdef const char *version - * with nogil: # <<<<<<<<<<<<<< - * version = c_ssh2.libssh2_version(required_version) - * if version is NULL: - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - _save = NULL; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - - /* "ssh2/utils.pyx":89 - * cdef const char *version - * with nogil: - * version = c_ssh2.libssh2_version(required_version) # <<<<<<<<<<<<<< - * if version is NULL: - * return - */ - __pyx_v_version = libssh2_version(__pyx_v_required_version); - } - - /* "ssh2/utils.pyx":88 - * """ - * cdef const char *version - * with nogil: # <<<<<<<<<<<<<< - * version = c_ssh2.libssh2_version(required_version) - * if version is NULL: - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } - - /* "ssh2/utils.pyx":90 - * with nogil: - * version = c_ssh2.libssh2_version(required_version) - * if version is NULL: # <<<<<<<<<<<<<< - * return - * return version - */ - __pyx_t_1 = (__pyx_v_version == NULL); - if (__pyx_t_1) { - - /* "ssh2/utils.pyx":91 - * version = c_ssh2.libssh2_version(required_version) - * if version is NULL: - * return # <<<<<<<<<<<<<< - * return version - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - - /* "ssh2/utils.pyx":90 - * with nogil: - * version = c_ssh2.libssh2_version(required_version) - * if version is NULL: # <<<<<<<<<<<<<< - * return - * return version - */ - } - - /* "ssh2/utils.pyx":92 - * if version is NULL: - * return - * return version # <<<<<<<<<<<<<< - * - * - */ + __Pyx_RefNannySetupContext("find_eol", 1); __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_version); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4ssh2_5utils_find_eol(__pyx_v_buf, __pyx_v_pos, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_2 = __pyx_convert__to_py___pyx_ctuple_int__and_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "ssh2/utils.pyx":78 - * - * - * def version(int required_version=0): # <<<<<<<<<<<<<< - * """Get libssh2 version string. - * - */ - /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("ssh2.utils.version", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("ssh2.utils.find_eol", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } +static PyObject *__pyx_gb_4ssh2_5utils_4generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "ssh2/utils.pyx":95 - * - * - * def ssh2_exit(): # <<<<<<<<<<<<<< - * """Call libssh2_exit""" - * c_ssh2.libssh2_exit() - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_4ssh2_5utils_5ssh2_exit(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_5utils_4ssh2_exit, "ssh2_exit()\nCall libssh2_exit"); -static PyMethodDef __pyx_mdef_4ssh2_5utils_5ssh2_exit = {"ssh2_exit", (PyCFunction)__pyx_pw_4ssh2_5utils_5ssh2_exit, METH_NOARGS, __pyx_doc_4ssh2_5utils_4ssh2_exit}; -static PyObject *__pyx_pw_4ssh2_5utils_5ssh2_exit(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("ssh2_exit (wrapper)", 0); - __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - __pyx_r = __pyx_pf_4ssh2_5utils_4ssh2_exit(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_4ssh2_5utils_4ssh2_exit(CYTHON_UNUSED PyObject *__pyx_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("ssh2_exit", 1); - - /* "ssh2/utils.pyx":97 - * def ssh2_exit(): - * """Call libssh2_exit""" - * c_ssh2.libssh2_exit() # <<<<<<<<<<<<<< - * - * - */ - libssh2_exit(); - - /* "ssh2/utils.pyx":95 - * - * - * def ssh2_exit(): # <<<<<<<<<<<<<< - * """Call libssh2_exit""" - * c_ssh2.libssh2_exit() - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "ssh2/utils.pyx":100 +/* "ssh2/utils.pyx":79 * * - * def wait_socket(_socket not None, Session session, timeout=1): # <<<<<<<<<<<<<< - * """Helper function for testing non-blocking mode. + * def readline(buf: Iterable[bytes]) -> Generator[bytes]: # <<<<<<<<<<<<<< + * """Returns a generator of line by line output in given iterable buffer. * */ /* Python wrapper */ -static PyObject *__pyx_pw_4ssh2_5utils_7wait_socket(PyObject *__pyx_self, +static PyObject *__pyx_pw_4ssh2_5utils_3readline(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_5utils_6wait_socket, "wait_socket(_socket, Session session, timeout=1)\nHelper function for testing non-blocking mode.\n\n This function blocks the calling thread for seconds -\n to be used only for testing purposes.\n "); -static PyMethodDef __pyx_mdef_4ssh2_5utils_7wait_socket = {"wait_socket", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_5utils_7wait_socket, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_5utils_6wait_socket}; -static PyObject *__pyx_pw_4ssh2_5utils_7wait_socket(PyObject *__pyx_self, +PyDoc_STRVAR(__pyx_doc_4ssh2_5utils_2readline, "readline(buf: Iterable[bytes]) -> Generator[bytes]\nReturns a generator of line by line output in given iterable buffer.\n\n :param buf: The iterable buffer to read from. Should yield a block of data per iteration.\n "); +static PyMethodDef __pyx_mdef_4ssh2_5utils_3readline = {"readline", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_5utils_3readline, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_5utils_2readline}; +static PyObject *__pyx_pw_4ssh2_5utils_3readline(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { - PyObject *__pyx_v__socket = 0; - struct __pyx_obj_4ssh2_7session_Session *__pyx_v_session = 0; - PyObject *__pyx_v_timeout = 0; + PyObject *__pyx_v_buf = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject* values[3] = {0,0,0}; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("wait_socket (wrapper)", 0); + __Pyx_RefNannySetupContext("readline (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -3891,15 +3950,10 @@ PyObject *__pyx_args, PyObject *__pyx_kwds #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_socket,&__pyx_n_s_session,&__pyx_n_s_timeout,0}; - values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)__pyx_int_1))); + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_buf,0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { - case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; @@ -3908,51 +3962,27 @@ PyObject *__pyx_args, PyObject *__pyx_kwds kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_socket)) != 0)) { + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_buf)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 79, __pyx_L3_error) else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_session)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("wait_socket", 0, 2, 3, 1); __PYX_ERR(0, 100, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_timeout); - if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L3_error) - } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "wait_socket") < 0)) __PYX_ERR(0, 100, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "readline") < 0)) __PYX_ERR(0, 79, __pyx_L3_error) } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; } else { - switch (__pyx_nargs) { - case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - __pyx_v__socket = values[0]; - __pyx_v_session = ((struct __pyx_obj_4ssh2_7session_Session *)values[1]); - __pyx_v_timeout = values[2]; + __pyx_v_buf = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("wait_socket", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 100, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("readline", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 79, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3962,21 +3992,13 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } - __Pyx_AddTraceback("ssh2.utils.wait_socket", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("ssh2.utils.readline", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(((PyObject *)__pyx_v__socket) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "_socket"); __PYX_ERR(0, 100, __pyx_L1_error) - } - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_session), __pyx_ptype_4ssh2_7session_Session, 1, "session", 0))) __PYX_ERR(0, 100, __pyx_L1_error) - __pyx_r = __pyx_pf_4ssh2_5utils_6wait_socket(__pyx_self, __pyx_v__socket, __pyx_v_session, __pyx_v_timeout); + __pyx_r = __pyx_pf_4ssh2_5utils_2readline(__pyx_self, __pyx_v_buf); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { @@ -3987,3050 +4009,4307 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_4ssh2_5utils_6wait_socket(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v__socket, struct __pyx_obj_4ssh2_7session_Session *__pyx_v_session, PyObject *__pyx_v_timeout) { - int __pyx_v_directions; - PyObject *__pyx_v_readfds = NULL; - PyObject *__pyx_v_writefds = NULL; +static PyObject *__pyx_pf_4ssh2_5utils_2readline(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buf) { + struct __pyx_obj_4ssh2_5utils___pyx_scope_struct__readline *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - unsigned int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("wait_socket", 1); - - /* "ssh2/utils.pyx":106 - * to be used only for testing purposes. - * """ - * cdef int directions = session.block_directions() # <<<<<<<<<<<<<< - * if directions == 0: - * return 0 - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_session), __pyx_n_s_block_directions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - __pyx_t_4 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_4 = 1; - } + __Pyx_RefNannySetupContext("readline", 0); + __pyx_cur_scope = (struct __pyx_obj_4ssh2_5utils___pyx_scope_struct__readline *)__pyx_tp_new_4ssh2_5utils___pyx_scope_struct__readline(__pyx_ptype_4ssh2_5utils___pyx_scope_struct__readline, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_4ssh2_5utils___pyx_scope_struct__readline *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 79, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } - #endif + __pyx_cur_scope->__pyx_v_buf = __pyx_v_buf; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_buf); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_buf); { - PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; - __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4ssh2_5utils_4generator, __pyx_codeobj_, (PyObject *) __pyx_cur_scope, __pyx_n_s_readline, __pyx_n_s_readline, __pyx_n_s_ssh2_utils); if (unlikely(!gen)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; } - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_directions = __pyx_t_5; - - /* "ssh2/utils.pyx":107 - * """ - * cdef int directions = session.block_directions() - * if directions == 0: # <<<<<<<<<<<<<< - * return 0 - * readfds = [_socket] \ - */ - __pyx_t_6 = (__pyx_v_directions == 0); - if (__pyx_t_6) { - /* "ssh2/utils.pyx":108 - * cdef int directions = session.block_directions() - * if directions == 0: - * return 0 # <<<<<<<<<<<<<< - * readfds = [_socket] \ - * if (directions & c_ssh2.LIBSSH2_SESSION_BLOCK_INBOUND) else () - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_int_0); - __pyx_r = __pyx_int_0; - goto __pyx_L0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("ssh2.utils.readline", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "ssh2/utils.pyx":107 - * """ - * cdef int directions = session.block_directions() - * if directions == 0: # <<<<<<<<<<<<<< - * return 0 - * readfds = [_socket] \ - */ +static PyObject *__pyx_gb_4ssh2_5utils_4generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_4ssh2_5utils___pyx_scope_struct__readline *__pyx_cur_scope = ((struct __pyx_obj_4ssh2_5utils___pyx_scope_struct__readline *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + __pyx_ctuple_int__and_int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("readline", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L10_resume_from_yield; + case 2: goto __pyx_L13_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 79, __pyx_L1_error) - /* "ssh2/utils.pyx":110 - * return 0 - * readfds = [_socket] \ - * if (directions & c_ssh2.LIBSSH2_SESSION_BLOCK_INBOUND) else () # <<<<<<<<<<<<<< - * writefds = [_socket] \ - * if (directions & c_ssh2.LIBSSH2_SESSION_BLOCK_OUTBOUND) else () + /* "ssh2/utils.pyx":86 + * cdef size_t pos + * cdef Py_ssize_t size + * cdef bytes remainder = b"" # <<<<<<<<<<<<<< + * cdef size_t remainder_len = 0 + * cdef int linesep */ - __pyx_t_6 = ((__pyx_v_directions & LIBSSH2_SESSION_BLOCK_INBOUND) != 0); - if (__pyx_t_6) { + __Pyx_INCREF(__pyx_kp_b__2); + __Pyx_GIVEREF(__pyx_kp_b__2); + __pyx_cur_scope->__pyx_v_remainder = __pyx_kp_b__2; - /* "ssh2/utils.pyx":109 - * if directions == 0: - * return 0 - * readfds = [_socket] \ # <<<<<<<<<<<<<< - * if (directions & c_ssh2.LIBSSH2_SESSION_BLOCK_INBOUND) else () - * writefds = [_socket] \ + /* "ssh2/utils.pyx":87 + * cdef Py_ssize_t size + * cdef bytes remainder = b"" + * cdef size_t remainder_len = 0 # <<<<<<<<<<<<<< + * cdef int linesep + * cdef int new_line_pos */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 109, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v__socket); - __Pyx_GIVEREF(__pyx_v__socket); - if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v__socket)) __PYX_ERR(0, 109, __pyx_L1_error); - __pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_v_remainder_len = 0; + + /* "ssh2/utils.pyx":90 + * cdef int linesep + * cdef int new_line_pos + * for data in buf: # <<<<<<<<<<<<<< + * pos = 0 + * size = len(data) + */ + if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_buf)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_buf)) { + __pyx_t_1 = __pyx_cur_scope->__pyx_v_buf; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + __pyx_t_3 = NULL; } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_buf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_3)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 90, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 90, __pyx_L1_error) + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 90, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 90, __pyx_L1_error) + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 90, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_data); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_data, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; - /* "ssh2/utils.pyx":110 - * return 0 - * readfds = [_socket] \ - * if (directions & c_ssh2.LIBSSH2_SESSION_BLOCK_INBOUND) else () # <<<<<<<<<<<<<< - * writefds = [_socket] \ - * if (directions & c_ssh2.LIBSSH2_SESSION_BLOCK_OUTBOUND) else () + /* "ssh2/utils.pyx":91 + * cdef int new_line_pos + * for data in buf: + * pos = 0 # <<<<<<<<<<<<<< + * size = len(data) + * while pos < size: + */ + __pyx_cur_scope->__pyx_v_pos = 0; + + /* "ssh2/utils.pyx":92 + * for data in buf: + * pos = 0 + * size = len(data) # <<<<<<<<<<<<<< + * while pos < size: + * linesep, new_line_pos = find_eol(data, pos) + */ + __pyx_t_5 = PyObject_Length(__pyx_cur_scope->__pyx_v_data); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_cur_scope->__pyx_v_size = __pyx_t_5; + + /* "ssh2/utils.pyx":93 + * pos = 0 + * size = len(data) + * while pos < size: # <<<<<<<<<<<<<< + * linesep, new_line_pos = find_eol(data, pos) + * if linesep == -1: */ - __Pyx_INCREF(__pyx_empty_tuple); - __pyx_t_1 = __pyx_empty_tuple; - } - __pyx_v_readfds = __pyx_t_1; - __pyx_t_1 = 0; + while (1) { + __pyx_t_6 = (__pyx_cur_scope->__pyx_v_pos < __pyx_cur_scope->__pyx_v_size); + if (!__pyx_t_6) break; + + /* "ssh2/utils.pyx":94 + * size = len(data) + * while pos < size: + * linesep, new_line_pos = find_eol(data, pos) # <<<<<<<<<<<<<< + * if linesep == -1: + * remainder += data[pos:] + */ + if (!(likely(PyBytes_CheckExact(__pyx_cur_scope->__pyx_v_data))||((__pyx_cur_scope->__pyx_v_data) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_cur_scope->__pyx_v_data))) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_t_7 = __pyx_f_4ssh2_5utils_find_eol(((PyObject*)__pyx_cur_scope->__pyx_v_data), __pyx_cur_scope->__pyx_v_pos, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_t_8 = __pyx_t_7.f0; + __pyx_t_9 = __pyx_t_7.f1; + __pyx_cur_scope->__pyx_v_linesep = __pyx_t_8; + __pyx_cur_scope->__pyx_v_new_line_pos = __pyx_t_9; + + /* "ssh2/utils.pyx":95 + * while pos < size: + * linesep, new_line_pos = find_eol(data, pos) + * if linesep == -1: # <<<<<<<<<<<<<< + * remainder += data[pos:] + * remainder_len = len(remainder) + */ + __pyx_t_6 = (__pyx_cur_scope->__pyx_v_linesep == -1L); + if (__pyx_t_6) { + + /* "ssh2/utils.pyx":96 + * linesep, new_line_pos = find_eol(data, pos) + * if linesep == -1: + * remainder += data[pos:] # <<<<<<<<<<<<<< + * remainder_len = len(remainder) + * break + */ + __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_data, __pyx_cur_scope->__pyx_v_pos, 0, NULL, NULL, NULL, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_10 = PyNumber_InPlaceAdd(__pyx_cur_scope->__pyx_v_remainder, __pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_10))||((__pyx_t_10) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_10))) __PYX_ERR(0, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_remainder); + __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_remainder, ((PyObject*)__pyx_t_10)); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_10 = 0; + + /* "ssh2/utils.pyx":97 + * if linesep == -1: + * remainder += data[pos:] + * remainder_len = len(remainder) # <<<<<<<<<<<<<< + * break + * end_of_line = pos + linesep + */ + if (unlikely(__pyx_cur_scope->__pyx_v_remainder == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 97, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_PyBytes_GET_SIZE(__pyx_cur_scope->__pyx_v_remainder); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_cur_scope->__pyx_v_remainder_len = __pyx_t_5; - /* "ssh2/utils.pyx":112 - * if (directions & c_ssh2.LIBSSH2_SESSION_BLOCK_INBOUND) else () - * writefds = [_socket] \ - * if (directions & c_ssh2.LIBSSH2_SESSION_BLOCK_OUTBOUND) else () # <<<<<<<<<<<<<< - * return select(readfds, writefds, (), timeout) - * + /* "ssh2/utils.pyx":98 + * remainder += data[pos:] + * remainder_len = len(remainder) + * break # <<<<<<<<<<<<<< + * end_of_line = pos + linesep + * if remainder_len > 0: */ - __pyx_t_6 = ((__pyx_v_directions & LIBSSH2_SESSION_BLOCK_OUTBOUND) != 0); - if (__pyx_t_6) { + goto __pyx_L7_break; - /* "ssh2/utils.pyx":111 - * readfds = [_socket] \ - * if (directions & c_ssh2.LIBSSH2_SESSION_BLOCK_INBOUND) else () - * writefds = [_socket] \ # <<<<<<<<<<<<<< - * if (directions & c_ssh2.LIBSSH2_SESSION_BLOCK_OUTBOUND) else () - * return select(readfds, writefds, (), timeout) + /* "ssh2/utils.pyx":95 + * while pos < size: + * linesep, new_line_pos = find_eol(data, pos) + * if linesep == -1: # <<<<<<<<<<<<<< + * remainder += data[pos:] + * remainder_len = len(remainder) */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v__socket); - __Pyx_GIVEREF(__pyx_v__socket); - if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v__socket)) __PYX_ERR(0, 111, __pyx_L1_error); - __pyx_t_1 = __pyx_t_2; - __pyx_t_2 = 0; - } else { + } - /* "ssh2/utils.pyx":112 - * if (directions & c_ssh2.LIBSSH2_SESSION_BLOCK_INBOUND) else () - * writefds = [_socket] \ - * if (directions & c_ssh2.LIBSSH2_SESSION_BLOCK_OUTBOUND) else () # <<<<<<<<<<<<<< - * return select(readfds, writefds, (), timeout) - * + /* "ssh2/utils.pyx":99 + * remainder_len = len(remainder) + * break + * end_of_line = pos + linesep # <<<<<<<<<<<<<< + * if remainder_len > 0: + * line = remainder + data[pos:end_of_line] + */ + __pyx_cur_scope->__pyx_v_end_of_line = (__pyx_cur_scope->__pyx_v_pos + __pyx_cur_scope->__pyx_v_linesep); + + /* "ssh2/utils.pyx":100 + * break + * end_of_line = pos + linesep + * if remainder_len > 0: # <<<<<<<<<<<<<< + * line = remainder + data[pos:end_of_line] + * remainder = b"" + */ + __pyx_t_6 = (__pyx_cur_scope->__pyx_v_remainder_len > 0); + if (__pyx_t_6) { + + /* "ssh2/utils.pyx":101 + * end_of_line = pos + linesep + * if remainder_len > 0: + * line = remainder + data[pos:end_of_line] # <<<<<<<<<<<<<< + * remainder = b"" + * remainder_len = 0 + */ + __pyx_t_10 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_data, __pyx_cur_scope->__pyx_v_pos, __pyx_cur_scope->__pyx_v_end_of_line, NULL, NULL, NULL, 1, 1, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_4 = PyNumber_Add(__pyx_cur_scope->__pyx_v_remainder, __pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_line); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_line, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + + /* "ssh2/utils.pyx":102 + * if remainder_len > 0: + * line = remainder + data[pos:end_of_line] + * remainder = b"" # <<<<<<<<<<<<<< + * remainder_len = 0 + * else: + */ + __Pyx_INCREF(__pyx_kp_b__2); + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_remainder); + __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_remainder, __pyx_kp_b__2); + __Pyx_GIVEREF(__pyx_kp_b__2); + + /* "ssh2/utils.pyx":103 + * line = remainder + data[pos:end_of_line] + * remainder = b"" + * remainder_len = 0 # <<<<<<<<<<<<<< + * else: + * line = data[pos:end_of_line] + */ + __pyx_cur_scope->__pyx_v_remainder_len = 0; + + /* "ssh2/utils.pyx":100 + * break + * end_of_line = pos + linesep + * if remainder_len > 0: # <<<<<<<<<<<<<< + * line = remainder + data[pos:end_of_line] + * remainder = b"" + */ + goto __pyx_L9; + } + + /* "ssh2/utils.pyx":105 + * remainder_len = 0 + * else: + * line = data[pos:end_of_line] # <<<<<<<<<<<<<< + * yield line + * pos += linesep + new_line_pos + */ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_data, __pyx_cur_scope->__pyx_v_pos, __pyx_cur_scope->__pyx_v_end_of_line, NULL, NULL, NULL, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 105, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_line); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_line, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + } + __pyx_L9:; + + /* "ssh2/utils.pyx":106 + * else: + * line = data[pos:end_of_line] + * yield line # <<<<<<<<<<<<<< + * pos += linesep + new_line_pos + * if remainder_len > 0: + */ + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_line); + __pyx_r = __pyx_cur_scope->__pyx_v_line; + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L10_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 106, __pyx_L1_error) + + /* "ssh2/utils.pyx":107 + * line = data[pos:end_of_line] + * yield line + * pos += linesep + new_line_pos # <<<<<<<<<<<<<< + * if remainder_len > 0: + * # Finished reading without finding ending linesep + */ + __pyx_cur_scope->__pyx_v_pos = (__pyx_cur_scope->__pyx_v_pos + (__pyx_cur_scope->__pyx_v_linesep + __pyx_cur_scope->__pyx_v_new_line_pos)); + } + __pyx_L7_break:; + + /* "ssh2/utils.pyx":90 + * cdef int linesep + * cdef int new_line_pos + * for data in buf: # <<<<<<<<<<<<<< + * pos = 0 + * size = len(data) */ - __Pyx_INCREF(__pyx_empty_tuple); - __pyx_t_1 = __pyx_empty_tuple; } - __pyx_v_writefds = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ssh2/utils.pyx":113 - * writefds = [_socket] \ - * if (directions & c_ssh2.LIBSSH2_SESSION_BLOCK_OUTBOUND) else () - * return select(readfds, writefds, (), timeout) # <<<<<<<<<<<<<< + /* "ssh2/utils.pyx":108 + * yield line + * pos += linesep + new_line_pos + * if remainder_len > 0: # <<<<<<<<<<<<<< + * # Finished reading without finding ending linesep + * yield remainder + */ + __pyx_t_6 = (__pyx_cur_scope->__pyx_v_remainder_len > 0); + if (__pyx_t_6) { + + /* "ssh2/utils.pyx":110 + * if remainder_len > 0: + * # Finished reading without finding ending linesep + * yield remainder # <<<<<<<<<<<<<< * * */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_select); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - __pyx_t_4 = 0; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_4 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[5] = {__pyx_t_3, __pyx_v_readfds, __pyx_v_writefds, __pyx_empty_tuple, __pyx_v_timeout}; - __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 4+__pyx_t_4); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_remainder); + __pyx_r = __pyx_cur_scope->__pyx_v_remainder; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 2; + return __pyx_r; + __pyx_L13_resume_from_yield:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 110, __pyx_L1_error) + + /* "ssh2/utils.pyx":108 + * yield line + * pos += linesep + new_line_pos + * if remainder_len > 0: # <<<<<<<<<<<<<< + * # Finished reading without finding ending linesep + * yield remainder + */ } - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); - /* "ssh2/utils.pyx":100 + /* "ssh2/utils.pyx":79 * * - * def wait_socket(_socket not None, Session session, timeout=1): # <<<<<<<<<<<<<< - * """Helper function for testing non-blocking mode. + * def readline(buf: Iterable[bytes]) -> Generator[bytes]: # <<<<<<<<<<<<<< + * """Returns a generator of line by line output in given iterable buffer. * */ /* function exit code */ + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; __pyx_L1_error:; + __Pyx_Generator_Replace_StopIteration(0); __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("ssh2.utils.wait_socket", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("readline", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; - __Pyx_XDECREF(__pyx_v_readfds); - __Pyx_XDECREF(__pyx_v_writefds); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_r); __pyx_r = 0; + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "ssh2/utils.pyx":116 +/* "ssh2/utils.pyx":113 * * - * cpdef int handle_error_codes(int errcode) except -1: # <<<<<<<<<<<<<< - * """Raise appropriate exception for given error code. + * def version(int required_version=0) -> str: # <<<<<<<<<<<<<< + * """Get libssh2 version string. * */ -static PyObject *__pyx_pw_4ssh2_5utils_9handle_error_codes(PyObject *__pyx_self, +/* Python wrapper */ +static PyObject *__pyx_pw_4ssh2_5utils_6version(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_UNUSED int __pyx_skip_dispatch) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - unsigned int __pyx_t_6; +PyDoc_STRVAR(__pyx_doc_4ssh2_5utils_5version, "version(required_version: int = 0) -> str\nGet libssh2 version string.\n\n Passing in a non-zero required_version causes the function to return\n `None` if version is less than required_version\n\n :param required_version: Minimum required version\n :type required_version: int\n "); +static PyMethodDef __pyx_mdef_4ssh2_5utils_6version = {"version", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_5utils_6version, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_5utils_5version}; +static PyObject *__pyx_pw_4ssh2_5utils_6version(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + int __pyx_v_required_version; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("handle_error_codes", 1); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("version (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_required_version,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_required_version); + if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 113, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "version") < 0)) __PYX_ERR(0, 113, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + if (values[0]) { + __pyx_v_required_version = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_required_version == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 113, __pyx_L3_error) + } else { + __pyx_v_required_version = ((int)((int)0)); + } + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("version", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 113, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("ssh2.utils.version", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4ssh2_5utils_5version(__pyx_self, __pyx_v_required_version); - /* "ssh2/utils.pyx":127 - * """ - * # Cython generates a C switch from this code - only use equality checks - * if errcode == 0: # <<<<<<<<<<<<<< - * return 0 - * elif errcode == error_codes._LIBSSH2_ERROR_EAGAIN: - */ - switch (__pyx_v_errcode) { - case 0: + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "ssh2/utils.pyx":128 - * # Cython generates a C switch from this code - only use equality checks - * if errcode == 0: - * return 0 # <<<<<<<<<<<<<< - * elif errcode == error_codes._LIBSSH2_ERROR_EAGAIN: - * return errcode - */ - __pyx_r = 0; - goto __pyx_L0; +static PyObject *__pyx_pf_4ssh2_5utils_5version(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_required_version) { + char const *__pyx_v_version; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("version", 1); - /* "ssh2/utils.pyx":127 + /* "ssh2/utils.pyx":123 * """ - * # Cython generates a C switch from this code - only use equality checks - * if errcode == 0: # <<<<<<<<<<<<<< - * return 0 - * elif errcode == error_codes._LIBSSH2_ERROR_EAGAIN: + * cdef const char *version + * with nogil: # <<<<<<<<<<<<<< + * version = c_ssh2.libssh2_version(required_version) + * if version is NULL: */ - break; - case LIBSSH2_ERROR_EAGAIN: + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "ssh2/utils.pyx":130 - * return 0 - * elif errcode == error_codes._LIBSSH2_ERROR_EAGAIN: - * return errcode # <<<<<<<<<<<<<< - * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_NONE: - * raise exceptions.SSH2Error + /* "ssh2/utils.pyx":124 + * cdef const char *version + * with nogil: + * version = c_ssh2.libssh2_version(required_version) # <<<<<<<<<<<<<< + * if version is NULL: + * return */ - __pyx_r = __pyx_v_errcode; - goto __pyx_L0; + __pyx_v_version = libssh2_version(__pyx_v_required_version); + } - /* "ssh2/utils.pyx":129 - * if errcode == 0: - * return 0 - * elif errcode == error_codes._LIBSSH2_ERROR_EAGAIN: # <<<<<<<<<<<<<< - * return errcode - * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_NONE: + /* "ssh2/utils.pyx":123 + * """ + * cdef const char *version + * with nogil: # <<<<<<<<<<<<<< + * version = c_ssh2.libssh2_version(required_version) + * if version is NULL: */ - break; - case LIBSSH2_ERROR_SOCKET_NONE: + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } + } - /* "ssh2/utils.pyx":132 - * return errcode - * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_NONE: - * raise exceptions.SSH2Error # <<<<<<<<<<<<<< - * elif errcode == error_codes._LIBSSH2_ERROR_BANNER_RECV: - * raise exceptions.BannerRecvError + /* "ssh2/utils.pyx":125 + * with nogil: + * version = c_ssh2.libssh2_version(required_version) + * if version is NULL: # <<<<<<<<<<<<<< + * return + * return to_str(version) */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_SSH2Error); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __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, 132, __pyx_L1_error) + __pyx_t_1 = (__pyx_v_version == NULL); + if (__pyx_t_1) { - /* "ssh2/utils.pyx":131 - * elif errcode == error_codes._LIBSSH2_ERROR_EAGAIN: - * return errcode - * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_NONE: # <<<<<<<<<<<<<< - * raise exceptions.SSH2Error - * elif errcode == error_codes._LIBSSH2_ERROR_BANNER_RECV: + /* "ssh2/utils.pyx":126 + * version = c_ssh2.libssh2_version(required_version) + * if version is NULL: + * return # <<<<<<<<<<<<<< + * return to_str(version) + * */ - break; - case LIBSSH2_ERROR_BANNER_RECV: + __Pyx_XDECREF(__pyx_r); + __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; - /* "ssh2/utils.pyx":134 - * raise exceptions.SSH2Error - * elif errcode == error_codes._LIBSSH2_ERROR_BANNER_RECV: - * raise exceptions.BannerRecvError # <<<<<<<<<<<<<< - * elif errcode == error_codes._LIBSSH2_ERROR_BANNER_SEND: - * raise exceptions.BannerSendError + /* "ssh2/utils.pyx":125 + * with nogil: + * version = c_ssh2.libssh2_version(required_version) + * if version is NULL: # <<<<<<<<<<<<<< + * return + * return to_str(version) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_BannerRecvError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __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, 134, __pyx_L1_error) + } - /* "ssh2/utils.pyx":133 - * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_NONE: - * raise exceptions.SSH2Error - * elif errcode == error_codes._LIBSSH2_ERROR_BANNER_RECV: # <<<<<<<<<<<<<< - * raise exceptions.BannerRecvError - * elif errcode == error_codes._LIBSSH2_ERROR_BANNER_SEND: + /* "ssh2/utils.pyx":127 + * if version is NULL: + * return + * return to_str(version) # <<<<<<<<<<<<<< + * + * */ - break; - case LIBSSH2_ERROR_BANNER_SEND: + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_4ssh2_5utils_to_str(__pyx_v_version); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_2))) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; - /* "ssh2/utils.pyx":136 - * 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 + /* "ssh2/utils.pyx":113 + * + * + * def version(int required_version=0) -> str: # <<<<<<<<<<<<<< + * """Get libssh2 version string. + * */ - __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); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_BannerSendError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 136, __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, 136, __pyx_L1_error) - /* "ssh2/utils.pyx":135 - * elif errcode == error_codes._LIBSSH2_ERROR_BANNER_RECV: - * raise exceptions.BannerRecvError - * elif errcode == error_codes._LIBSSH2_ERROR_BANNER_SEND: # <<<<<<<<<<<<<< - * raise exceptions.BannerSendError - * elif errcode == error_codes._LIBSSH2_ERROR_INVALID_MAC: - */ - break; - case LIBSSH2_ERROR_INVALID_MAC: + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("ssh2.utils.version", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "ssh2/utils.pyx":138 - * 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 +/* "ssh2/utils.pyx":130 + * + * + * def ssh2_exit() -> None: # <<<<<<<<<<<<<< + * """Call libssh2_exit""" + * c_ssh2.libssh2_exit() */ - __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_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); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 138, __pyx_L1_error) - /* "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: +/* Python wrapper */ +static PyObject *__pyx_pw_4ssh2_5utils_8ssh2_exit(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +PyDoc_STRVAR(__pyx_doc_4ssh2_5utils_7ssh2_exit, "ssh2_exit() -> None\nCall libssh2_exit"); +static PyMethodDef __pyx_mdef_4ssh2_5utils_8ssh2_exit = {"ssh2_exit", (PyCFunction)__pyx_pw_4ssh2_5utils_8ssh2_exit, METH_NOARGS, __pyx_doc_4ssh2_5utils_7ssh2_exit}; +static PyObject *__pyx_pw_4ssh2_5utils_8ssh2_exit(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("ssh2_exit (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_4ssh2_5utils_7ssh2_exit(__pyx_self); - /* "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) + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "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: +static PyObject *__pyx_pf_4ssh2_5utils_7ssh2_exit(CYTHON_UNUSED PyObject *__pyx_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("ssh2_exit", 1); + + /* "ssh2/utils.pyx":132 + * def ssh2_exit() -> None: + * """Call libssh2_exit""" + * c_ssh2.libssh2_exit() # <<<<<<<<<<<<<< + * + * */ - break; - case LIBSSH2_ERROR_ALLOC: + libssh2_exit(); - /* "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 + /* "ssh2/utils.pyx":130 + * + * + * def ssh2_exit() -> None: # <<<<<<<<<<<<<< + * """Call libssh2_exit""" + * c_ssh2.libssh2_exit() */ - __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: + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "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 +/* "ssh2/utils.pyx":135 + * + * + * def wait_socket(_socket not None: BinaryIO, Session session, timeout: int=1) -> None: # <<<<<<<<<<<<<< + * """Helper function for testing non-blocking mode. + * */ - __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: +static PyObject *__pyx_pf_4ssh2_5utils_13__defaults__(CYTHON_UNUSED PyObject *__pyx_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__defaults__", 1); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_timeout); + __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_timeout); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_timeout)) __PYX_ERR(0, 135, __pyx_L1_error); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 135, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None)) __PYX_ERR(0, 135, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "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) + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("ssh2.utils.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "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: - */ - break; - case LIBSSH2_ERROR_TIMEOUT: +/* Python wrapper */ +static PyObject *__pyx_pw_4ssh2_5utils_10wait_socket(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_4ssh2_5utils_9wait_socket, "wait_socket(_socket: BinaryIO, session: Session, timeout: int = 1) -> None\nHelper function for testing non-blocking mode.\n\n This function blocks the calling thread for seconds -\n to be used only for testing purposes.\n "); +static PyMethodDef __pyx_mdef_4ssh2_5utils_10wait_socket = {"wait_socket", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_5utils_10wait_socket, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_5utils_9wait_socket}; +static PyObject *__pyx_pw_4ssh2_5utils_10wait_socket(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v__socket = 0; + struct __pyx_obj_4ssh2_7session_Session *__pyx_v_session = 0; + PyObject *__pyx_v_timeout = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("wait_socket (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_socket,&__pyx_n_s_session,&__pyx_n_s_timeout,0}; + __pyx_defaults *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self); + values[2] = __Pyx_Arg_NewRef_FASTCALL(__pyx_dynamic_args->__pyx_arg_timeout); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_socket)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 135, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_session)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 135, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("wait_socket", 0, 2, 3, 1); __PYX_ERR(0, 135, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_timeout); + if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 135, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "wait_socket") < 0)) __PYX_ERR(0, 135, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v__socket = values[0]; + __pyx_v_session = ((struct __pyx_obj_4ssh2_7session_Session *)values[1]); + __pyx_v_timeout = ((PyObject*)values[2]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("wait_socket", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 135, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("ssh2.utils.wait_socket", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(((PyObject *)__pyx_v__socket) == Py_None)) { + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "_socket"); __PYX_ERR(0, 135, __pyx_L1_error) + } + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_session), __pyx_ptype_4ssh2_7session_Session, 1, "session", 0))) __PYX_ERR(0, 135, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_timeout), (&PyInt_Type), 0, "timeout", 1))) __PYX_ERR(0, 135, __pyx_L1_error) + __pyx_r = __pyx_pf_4ssh2_5utils_9wait_socket(__pyx_self, __pyx_v__socket, __pyx_v_session, __pyx_v_timeout); - /* "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 + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_4ssh2_5utils_9wait_socket(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v__socket, struct __pyx_obj_4ssh2_7session_Session *__pyx_v_session, PyObject *__pyx_v_timeout) { + int __pyx_v_directions; + PyObject *__pyx_v_readfds = NULL; + PyObject *__pyx_v_writefds = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + unsigned int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("wait_socket", 1); + + /* "ssh2/utils.pyx":141 + * to be used only for testing purposes. + * """ + * cdef int directions = session.block_directions() # <<<<<<<<<<<<<< + * if directions == 0: + * return 0 */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_session), __pyx_n_s_block_directions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __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, 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, 148, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_directions = __pyx_t_5; - /* "ssh2/utils.pyx":147 - * 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_HOSTKEY_INIT: - */ - break; - case LIBSSH2_ERROR_HOSTKEY_INIT: - - /* "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 + /* "ssh2/utils.pyx":142 + * """ + * cdef int directions = session.block_directions() + * if directions == 0: # <<<<<<<<<<<<<< + * return 0 + * readfds = [_socket] \ */ - __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, 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, 150, __pyx_L1_error) + __pyx_t_6 = (__pyx_v_directions == 0); + if (__pyx_t_6) { - /* "ssh2/utils.pyx":149 - * elif errcode == error_codes._LIBSSH2_ERROR_TIMEOUT: - * raise exceptions.Timeout - * elif errcode == error_codes._LIBSSH2_ERROR_HOSTKEY_INIT: # <<<<<<<<<<<<<< - * raise exceptions.HostkeyInitError - * elif errcode == error_codes._LIBSSH2_ERROR_HOSTKEY_SIGN: + /* "ssh2/utils.pyx":143 + * cdef int directions = session.block_directions() + * if directions == 0: + * return 0 # <<<<<<<<<<<<<< + * readfds = [_socket] \ + * if (directions & c_ssh2.LIBSSH2_SESSION_BLOCK_INBOUND) else () */ - break; - case LIBSSH2_ERROR_HOSTKEY_SIGN: + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_int_0); + __pyx_r = __pyx_int_0; + goto __pyx_L0; - /* "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 + /* "ssh2/utils.pyx":142 + * """ + * cdef int directions = session.block_directions() + * if directions == 0: # <<<<<<<<<<<<<< + * return 0 + * readfds = [_socket] \ */ - __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, 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, 152, __pyx_L1_error) + } - /* "ssh2/utils.pyx":151 - * elif errcode == error_codes._LIBSSH2_ERROR_HOSTKEY_INIT: - * raise exceptions.HostkeyInitError - * elif errcode == error_codes._LIBSSH2_ERROR_HOSTKEY_SIGN: # <<<<<<<<<<<<<< - * raise exceptions.HostkeySignError - * elif errcode == error_codes._LIBSSH2_ERROR_DECRYPT: + /* "ssh2/utils.pyx":145 + * return 0 + * readfds = [_socket] \ + * if (directions & c_ssh2.LIBSSH2_SESSION_BLOCK_INBOUND) else () # <<<<<<<<<<<<<< + * writefds = [_socket] \ + * if (directions & c_ssh2.LIBSSH2_SESSION_BLOCK_OUTBOUND) else () */ - break; - case LIBSSH2_ERROR_DECRYPT: + __pyx_t_6 = ((__pyx_v_directions & LIBSSH2_SESSION_BLOCK_INBOUND) != 0); + if (__pyx_t_6) { - /* "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 + /* "ssh2/utils.pyx":144 + * if directions == 0: + * return 0 + * readfds = [_socket] \ # <<<<<<<<<<<<<< + * if (directions & c_ssh2.LIBSSH2_SESSION_BLOCK_INBOUND) else () + * writefds = [_socket] \ */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error) + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __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, 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, 154, __pyx_L1_error) - - /* "ssh2/utils.pyx":153 - * elif errcode == error_codes._LIBSSH2_ERROR_HOSTKEY_SIGN: - * raise exceptions.HostkeySignError - * elif errcode == error_codes._LIBSSH2_ERROR_DECRYPT: # <<<<<<<<<<<<<< - * raise exceptions.DecryptError - * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_DISCONNECT: - */ - break; - case LIBSSH2_ERROR_SOCKET_DISCONNECT: + __Pyx_INCREF(__pyx_v__socket); + __Pyx_GIVEREF(__pyx_v__socket); + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v__socket)) __PYX_ERR(0, 144, __pyx_L1_error); + __pyx_t_1 = __pyx_t_2; + __pyx_t_2 = 0; + } else { - /* "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 + /* "ssh2/utils.pyx":145 + * return 0 + * readfds = [_socket] \ + * if (directions & c_ssh2.LIBSSH2_SESSION_BLOCK_INBOUND) else () # <<<<<<<<<<<<<< + * writefds = [_socket] \ + * if (directions & c_ssh2.LIBSSH2_SESSION_BLOCK_OUTBOUND) else () */ - __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, 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, 156, __pyx_L1_error) + __Pyx_INCREF(__pyx_empty_tuple); + __pyx_t_1 = __pyx_empty_tuple; + } + __pyx_v_readfds = __pyx_t_1; + __pyx_t_1 = 0; - /* "ssh2/utils.pyx":155 - * elif errcode == error_codes._LIBSSH2_ERROR_DECRYPT: - * raise exceptions.DecryptError - * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_DISCONNECT: # <<<<<<<<<<<<<< - * raise exceptions.SocketDisconnectError - * elif errcode == error_codes._LIBSSH2_ERROR_PROTO: + /* "ssh2/utils.pyx":147 + * if (directions & c_ssh2.LIBSSH2_SESSION_BLOCK_INBOUND) else () + * writefds = [_socket] \ + * if (directions & c_ssh2.LIBSSH2_SESSION_BLOCK_OUTBOUND) else () # <<<<<<<<<<<<<< + * return select(readfds, writefds, (), timeout) + * */ - break; - case LIBSSH2_ERROR_PROTO: + __pyx_t_6 = ((__pyx_v_directions & LIBSSH2_SESSION_BLOCK_OUTBOUND) != 0); + if (__pyx_t_6) { - /* "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 + /* "ssh2/utils.pyx":146 + * readfds = [_socket] \ + * if (directions & c_ssh2.LIBSSH2_SESSION_BLOCK_INBOUND) else () + * writefds = [_socket] \ # <<<<<<<<<<<<<< + * if (directions & c_ssh2.LIBSSH2_SESSION_BLOCK_OUTBOUND) else () + * return select(readfds, writefds, (), timeout) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 158, __pyx_L1_error) + __pyx_t_2 = PyList_New(1); 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_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, 158, __pyx_L1_error) + __Pyx_INCREF(__pyx_v__socket); + __Pyx_GIVEREF(__pyx_v__socket); + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v__socket)) __PYX_ERR(0, 146, __pyx_L1_error); + __pyx_t_1 = __pyx_t_2; + __pyx_t_2 = 0; + } else { - /* "ssh2/utils.pyx":157 - * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_DISCONNECT: - * raise exceptions.SocketDisconnectError - * elif errcode == error_codes._LIBSSH2_ERROR_PROTO: # <<<<<<<<<<<<<< - * raise exceptions.ProtocolError - * elif errcode == error_codes._LIBSSH2_ERROR_PASSWORD_EXPIRED: + /* "ssh2/utils.pyx":147 + * if (directions & c_ssh2.LIBSSH2_SESSION_BLOCK_INBOUND) else () + * writefds = [_socket] \ + * if (directions & c_ssh2.LIBSSH2_SESSION_BLOCK_OUTBOUND) else () # <<<<<<<<<<<<<< + * return select(readfds, writefds, (), timeout) + * */ - break; - case LIBSSH2_ERROR_PASSWORD_EXPIRED: + __Pyx_INCREF(__pyx_empty_tuple); + __pyx_t_1 = __pyx_empty_tuple; + } + __pyx_v_writefds = __pyx_t_1; + __pyx_t_1 = 0; - /* "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 + /* "ssh2/utils.pyx":148 + * writefds = [_socket] \ + * if (directions & c_ssh2.LIBSSH2_SESSION_BLOCK_OUTBOUND) else () + * return select(readfds, writefds, (), timeout) # <<<<<<<<<<<<<< + * + * */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_select); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[5] = {__pyx_t_3, __pyx_v_readfds, __pyx_v_writefds, __pyx_empty_tuple, __pyx_v_timeout}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 4+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + 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_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, 160, __pyx_L1_error) + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "ssh2/utils.pyx":159 - * elif errcode == error_codes._LIBSSH2_ERROR_PROTO: - * raise exceptions.ProtocolError - * elif errcode == error_codes._LIBSSH2_ERROR_PASSWORD_EXPIRED: # <<<<<<<<<<<<<< - * raise exceptions.PasswordExpiredError - * elif errcode == error_codes._LIBSSH2_ERROR_FILE: + /* "ssh2/utils.pyx":135 + * + * + * def wait_socket(_socket not None: BinaryIO, Session session, timeout: int=1) -> None: # <<<<<<<<<<<<<< + * """Helper function for testing non-blocking mode. + * */ - break; - case LIBSSH2_ERROR_FILE: - /* "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 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("ssh2.utils.wait_socket", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_readfds); + __Pyx_XDECREF(__pyx_v_writefds); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ssh2/utils.pyx":151 + * + * + * cpdef int handle_error_codes(int errcode) except -1: # <<<<<<<<<<<<<< + * """Raise appropriate exception for given error code. + * */ - __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, 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, 162, __pyx_L1_error) - /* "ssh2/utils.pyx":161 - * elif errcode == error_codes._LIBSSH2_ERROR_PASSWORD_EXPIRED: - * raise exceptions.PasswordExpiredError - * elif errcode == error_codes._LIBSSH2_ERROR_FILE: # <<<<<<<<<<<<<< - * raise exceptions.FileError - * elif errcode == error_codes._LIBSSH2_ERROR_METHOD_NONE: +static PyObject *__pyx_pw_4ssh2_5utils_12handle_error_codes(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static int __pyx_f_4ssh2_5utils_handle_error_codes(int __pyx_v_errcode, CYTHON_UNUSED int __pyx_skip_dispatch) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + unsigned int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("handle_error_codes", 1); + + /* "ssh2/utils.pyx":162 + * """ + * # Cython generates a C switch from this code - only use equality checks + * if errcode == 0: # <<<<<<<<<<<<<< + * return 0 + * elif errcode == error_codes._LIBSSH2_ERROR_EAGAIN: + */ + switch (__pyx_v_errcode) { + case 0: + + /* "ssh2/utils.pyx":163 + * # Cython generates a C switch from this code - only use equality checks + * if errcode == 0: + * return 0 # <<<<<<<<<<<<<< + * elif errcode == error_codes._LIBSSH2_ERROR_EAGAIN: + * return errcode + */ + __pyx_r = 0; + goto __pyx_L0; + + /* "ssh2/utils.pyx":162 + * """ + * # Cython generates a C switch from this code - only use equality checks + * if errcode == 0: # <<<<<<<<<<<<<< + * return 0 + * elif errcode == error_codes._LIBSSH2_ERROR_EAGAIN: */ break; - case LIBSSH2_ERROR_METHOD_NONE: + case LIBSSH2_ERROR_EAGAIN: + + /* "ssh2/utils.pyx":165 + * return 0 + * elif errcode == error_codes._LIBSSH2_ERROR_EAGAIN: + * return errcode # <<<<<<<<<<<<<< + * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_NONE: + * raise exceptions.SSH2Error + */ + __pyx_r = __pyx_v_errcode; + goto __pyx_L0; /* "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 + * if errcode == 0: + * return 0 + * elif errcode == error_codes._LIBSSH2_ERROR_EAGAIN: # <<<<<<<<<<<<<< + * return errcode + * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_NONE: + */ + break; + case LIBSSH2_ERROR_SOCKET_NONE: + + /* "ssh2/utils.pyx":167 + * return errcode + * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_NONE: + * raise exceptions.SSH2Error # <<<<<<<<<<<<<< + * elif errcode == error_codes._LIBSSH2_ERROR_BANNER_RECV: + * raise exceptions.BannerRecvError */ - __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, 167, __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, 164, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_SSH2Error); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 167, __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, 167, __pyx_L1_error) - /* "ssh2/utils.pyx":163 - * elif errcode == error_codes._LIBSSH2_ERROR_FILE: - * raise exceptions.FileError - * elif errcode == error_codes._LIBSSH2_ERROR_METHOD_NONE: # <<<<<<<<<<<<<< - * raise exceptions.MethodNoneError - * elif errcode == error_codes._LIBSSH2_ERROR_AUTHENTICATION_FAILED: + /* "ssh2/utils.pyx":166 + * elif errcode == error_codes._LIBSSH2_ERROR_EAGAIN: + * return errcode + * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_NONE: # <<<<<<<<<<<<<< + * raise exceptions.SSH2Error + * elif errcode == error_codes._LIBSSH2_ERROR_BANNER_RECV: */ break; - case LIBSSH2_ERROR_AUTHENTICATION_FAILED: + case LIBSSH2_ERROR_BANNER_RECV: - /* "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 + /* "ssh2/utils.pyx":169 + * raise exceptions.SSH2Error + * elif errcode == error_codes._LIBSSH2_ERROR_BANNER_RECV: + * raise exceptions.BannerRecvError # <<<<<<<<<<<<<< + * elif errcode == error_codes._LIBSSH2_ERROR_BANNER_SEND: + * raise exceptions.BannerSendError */ - __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, 169, __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, 166, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_BannerRecvError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __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, 169, __pyx_L1_error) - /* "ssh2/utils.pyx":165 - * elif errcode == error_codes._LIBSSH2_ERROR_METHOD_NONE: - * raise exceptions.MethodNoneError - * elif errcode == error_codes._LIBSSH2_ERROR_AUTHENTICATION_FAILED: # <<<<<<<<<<<<<< - * raise exceptions.AuthenticationError - * elif errcode == error_codes._LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED: + /* "ssh2/utils.pyx":168 + * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_NONE: + * raise exceptions.SSH2Error + * elif errcode == error_codes._LIBSSH2_ERROR_BANNER_RECV: # <<<<<<<<<<<<<< + * raise exceptions.BannerRecvError + * elif errcode == error_codes._LIBSSH2_ERROR_BANNER_SEND: */ break; - case LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED: + case LIBSSH2_ERROR_BANNER_SEND: - /* "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 + /* "ssh2/utils.pyx":171 + * 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 */ - __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, 171, __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, 168, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_BannerSendError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __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, 171, __pyx_L1_error) - /* "ssh2/utils.pyx":167 - * elif errcode == error_codes._LIBSSH2_ERROR_AUTHENTICATION_FAILED: - * raise exceptions.AuthenticationError - * elif errcode == error_codes._LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED: # <<<<<<<<<<<<<< - * raise exceptions.PublickeyUnverifiedError - * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_OUTOFORDER: + /* "ssh2/utils.pyx":170 + * elif errcode == error_codes._LIBSSH2_ERROR_BANNER_RECV: + * raise exceptions.BannerRecvError + * elif errcode == error_codes._LIBSSH2_ERROR_BANNER_SEND: # <<<<<<<<<<<<<< + * raise exceptions.BannerSendError + * elif errcode == error_codes._LIBSSH2_ERROR_INVALID_MAC: */ break; - case LIBSSH2_ERROR_CHANNEL_OUTOFORDER: + case LIBSSH2_ERROR_INVALID_MAC: - /* "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 + /* "ssh2/utils.pyx":173 + * 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 */ - __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, 173, __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, 170, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_InvalidMACError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __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, 173, __pyx_L1_error) - /* "ssh2/utils.pyx":169 - * elif errcode == error_codes._LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED: - * raise exceptions.PublickeyUnverifiedError - * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_OUTOFORDER: # <<<<<<<<<<<<<< - * raise exceptions.ChannelOutOfOrderError - * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_FAILURE: + /* "ssh2/utils.pyx":172 + * 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_CHANNEL_FAILURE: + case LIBSSH2_ERROR_KEX_FAILURE: - /* "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 + /* "ssh2/utils.pyx":175 + * 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, 172, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __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, 172, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_KexFailureError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 175, __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, 175, __pyx_L1_error) - /* "ssh2/utils.pyx":171 - * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_OUTOFORDER: - * raise exceptions.ChannelOutOfOrderError - * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_FAILURE: # <<<<<<<<<<<<<< - * raise exceptions.ChannelFailure - * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_REQUEST_DENIED: + /* "ssh2/utils.pyx":174 + * 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_CHANNEL_REQUEST_DENIED: + case LIBSSH2_ERROR_ALLOC: - /* "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 + /* "ssh2/utils.pyx":177 + * 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, 174, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __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, 174, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_AllocError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __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, 177, __pyx_L1_error) - /* "ssh2/utils.pyx":173 - * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_FAILURE: - * raise exceptions.ChannelFailure - * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_REQUEST_DENIED: # <<<<<<<<<<<<<< - * raise exceptions.ChannelRequestDenied - * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_UNKNOWN: + /* "ssh2/utils.pyx":176 + * 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_CHANNEL_UNKNOWN: + case LIBSSH2_ERROR_SOCKET_SEND: - /* "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 + /* "ssh2/utils.pyx":179 + * 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, 176, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __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, 176, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_SocketSendError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 179, __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, 179, __pyx_L1_error) - /* "ssh2/utils.pyx":175 - * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_REQUEST_DENIED: - * raise exceptions.ChannelRequestDenied - * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_UNKNOWN: # <<<<<<<<<<<<<< - * raise exceptions.ChannelUnknownError - * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_WINDOW_EXCEEDED: + /* "ssh2/utils.pyx":178 + * 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_CHANNEL_WINDOW_EXCEEDED: + case LIBSSH2_ERROR_KEY_EXCHANGE_FAILURE: - /* "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, 178, __pyx_L1_error) + /* "ssh2/utils.pyx":181 + * 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, 181, __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, 178, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_KeyExchangeError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __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, 181, __pyx_L1_error) - /* "ssh2/utils.pyx":177 - * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_UNKNOWN: - * raise exceptions.ChannelUnknownError - * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_WINDOW_EXCEEDED: # <<<<<<<<<<<<<< - * raise exceptions.ChannelWindowExceeded - * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_PACKET_EXCEEDED: + /* "ssh2/utils.pyx":180 + * 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: */ break; - case LIBSSH2_ERROR_CHANNEL_PACKET_EXCEEDED: + case LIBSSH2_ERROR_TIMEOUT: - /* "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 + /* "ssh2/utils.pyx":183 + * 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, 180, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __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, 180, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Timeout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __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, 183, __pyx_L1_error) - /* "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: # <<<<<<<<<<<<<< - * raise exceptions.ChannelPacketExceeded - * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_CLOSED: + /* "ssh2/utils.pyx":182 + * 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_HOSTKEY_INIT: */ break; - case LIBSSH2_ERROR_CHANNEL_CLOSED: + case LIBSSH2_ERROR_HOSTKEY_INIT: - /* "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 + /* "ssh2/utils.pyx":185 + * 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, 182, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 185, __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, 182, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_HostkeyInitError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 185, __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, 185, __pyx_L1_error) - /* "ssh2/utils.pyx":181 - * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_PACKET_EXCEEDED: - * raise exceptions.ChannelPacketExceeded - * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_CLOSED: # <<<<<<<<<<<<<< - * raise exceptions.ChannelClosedError - * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_EOF_SENT: + /* "ssh2/utils.pyx":184 + * elif errcode == error_codes._LIBSSH2_ERROR_TIMEOUT: + * raise exceptions.Timeout + * elif errcode == error_codes._LIBSSH2_ERROR_HOSTKEY_INIT: # <<<<<<<<<<<<<< + * raise exceptions.HostkeyInitError + * elif errcode == error_codes._LIBSSH2_ERROR_HOSTKEY_SIGN: */ break; - case LIBSSH2_ERROR_CHANNEL_EOF_SENT: + case LIBSSH2_ERROR_HOSTKEY_SIGN: - /* "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 + /* "ssh2/utils.pyx":187 + * 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, 184, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 187, __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, 184, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_HostkeySignError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 187, __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, 187, __pyx_L1_error) - /* "ssh2/utils.pyx":183 - * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_CLOSED: - * raise exceptions.ChannelClosedError - * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_EOF_SENT: # <<<<<<<<<<<<<< - * raise exceptions.ChannelEOFSentError - * elif errcode == error_codes._LIBSSH2_ERROR_SCP_PROTOCOL: + /* "ssh2/utils.pyx":186 + * elif errcode == error_codes._LIBSSH2_ERROR_HOSTKEY_INIT: + * raise exceptions.HostkeyInitError + * elif errcode == error_codes._LIBSSH2_ERROR_HOSTKEY_SIGN: # <<<<<<<<<<<<<< + * raise exceptions.HostkeySignError + * elif errcode == error_codes._LIBSSH2_ERROR_DECRYPT: */ break; - case LIBSSH2_ERROR_SCP_PROTOCOL: + case LIBSSH2_ERROR_DECRYPT: - /* "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 + /* "ssh2/utils.pyx":189 + * 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, 186, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 189, __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, 186, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_DecryptError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __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, 189, __pyx_L1_error) - /* "ssh2/utils.pyx":185 - * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_EOF_SENT: - * raise exceptions.ChannelEOFSentError - * elif errcode == error_codes._LIBSSH2_ERROR_SCP_PROTOCOL: # <<<<<<<<<<<<<< - * raise exceptions.SCPProtocolError - * elif errcode == error_codes._LIBSSH2_ERROR_ZLIB: + /* "ssh2/utils.pyx":188 + * elif errcode == error_codes._LIBSSH2_ERROR_HOSTKEY_SIGN: + * raise exceptions.HostkeySignError + * elif errcode == error_codes._LIBSSH2_ERROR_DECRYPT: # <<<<<<<<<<<<<< + * raise exceptions.DecryptError + * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_DISCONNECT: */ break; - case LIBSSH2_ERROR_ZLIB: + case LIBSSH2_ERROR_SOCKET_DISCONNECT: - /* "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 + /* "ssh2/utils.pyx":191 + * 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, 188, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __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, 188, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_SocketDisconnectError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 191, __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, 191, __pyx_L1_error) - /* "ssh2/utils.pyx":187 - * elif errcode == error_codes._LIBSSH2_ERROR_SCP_PROTOCOL: - * raise exceptions.SCPProtocolError - * elif errcode == error_codes._LIBSSH2_ERROR_ZLIB: # <<<<<<<<<<<<<< - * raise exceptions.ZlibError - * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_TIMEOUT: + /* "ssh2/utils.pyx":190 + * elif errcode == error_codes._LIBSSH2_ERROR_DECRYPT: + * raise exceptions.DecryptError + * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_DISCONNECT: # <<<<<<<<<<<<<< + * raise exceptions.SocketDisconnectError + * elif errcode == error_codes._LIBSSH2_ERROR_PROTO: */ break; - case LIBSSH2_ERROR_SOCKET_TIMEOUT: + case LIBSSH2_ERROR_PROTO: - /* "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 + /* "ssh2/utils.pyx":193 + * 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, 190, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __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, 190, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ProtocolError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __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, 193, __pyx_L1_error) - /* "ssh2/utils.pyx":189 - * elif errcode == error_codes._LIBSSH2_ERROR_ZLIB: - * raise exceptions.ZlibError - * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_TIMEOUT: # <<<<<<<<<<<<<< - * raise exceptions.SocketTimeout - * elif errcode == error_codes._LIBSSH2_ERROR_SFTP_PROTOCOL: + /* "ssh2/utils.pyx":192 + * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_DISCONNECT: + * raise exceptions.SocketDisconnectError + * elif errcode == error_codes._LIBSSH2_ERROR_PROTO: # <<<<<<<<<<<<<< + * raise exceptions.ProtocolError + * elif errcode == error_codes._LIBSSH2_ERROR_PASSWORD_EXPIRED: */ break; - case LIBSSH2_ERROR_SFTP_PROTOCOL: + case LIBSSH2_ERROR_PASSWORD_EXPIRED: - /* "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 + /* "ssh2/utils.pyx":195 + * 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, 192, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __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, 192, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_PasswordExpiredError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 195, __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, 195, __pyx_L1_error) - /* "ssh2/utils.pyx":191 - * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_TIMEOUT: - * raise exceptions.SocketTimeout - * elif errcode == error_codes._LIBSSH2_ERROR_SFTP_PROTOCOL: # <<<<<<<<<<<<<< - * raise exceptions.SFTPProtocolError - * elif errcode == error_codes._LIBSSH2_ERROR_REQUEST_DENIED: + /* "ssh2/utils.pyx":194 + * elif errcode == error_codes._LIBSSH2_ERROR_PROTO: + * raise exceptions.ProtocolError + * elif errcode == error_codes._LIBSSH2_ERROR_PASSWORD_EXPIRED: # <<<<<<<<<<<<<< + * raise exceptions.PasswordExpiredError + * elif errcode == error_codes._LIBSSH2_ERROR_FILE: */ break; - case LIBSSH2_ERROR_REQUEST_DENIED: + case LIBSSH2_ERROR_FILE: - /* "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 + /* "ssh2/utils.pyx":197 + * 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, 194, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 197, __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, 194, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FileError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __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, 197, __pyx_L1_error) - /* "ssh2/utils.pyx":193 - * elif errcode == error_codes._LIBSSH2_ERROR_SFTP_PROTOCOL: - * raise exceptions.SFTPProtocolError - * elif errcode == error_codes._LIBSSH2_ERROR_REQUEST_DENIED: # <<<<<<<<<<<<<< - * raise exceptions.RequestDeniedError - * elif errcode == error_codes._LIBSSH2_ERROR_METHOD_NOT_SUPPORTED: + /* "ssh2/utils.pyx":196 + * elif errcode == error_codes._LIBSSH2_ERROR_PASSWORD_EXPIRED: + * raise exceptions.PasswordExpiredError + * elif errcode == error_codes._LIBSSH2_ERROR_FILE: # <<<<<<<<<<<<<< + * raise exceptions.FileError + * elif errcode == error_codes._LIBSSH2_ERROR_METHOD_NONE: */ break; - case LIBSSH2_ERROR_METHOD_NOT_SUPPORTED: + case LIBSSH2_ERROR_METHOD_NONE: - /* "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 + /* "ssh2/utils.pyx":199 + * 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, 196, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __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, 196, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_MethodNoneError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 199, __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, 199, __pyx_L1_error) - /* "ssh2/utils.pyx":195 - * elif errcode == error_codes._LIBSSH2_ERROR_REQUEST_DENIED: - * raise exceptions.RequestDeniedError - * elif errcode == error_codes._LIBSSH2_ERROR_METHOD_NOT_SUPPORTED: # <<<<<<<<<<<<<< - * raise exceptions.MethodNotSupported - * elif errcode == error_codes._LIBSSH2_ERROR_INVAL: + /* "ssh2/utils.pyx":198 + * elif errcode == error_codes._LIBSSH2_ERROR_FILE: + * raise exceptions.FileError + * elif errcode == error_codes._LIBSSH2_ERROR_METHOD_NONE: # <<<<<<<<<<<<<< + * raise exceptions.MethodNoneError + * elif errcode == error_codes._LIBSSH2_ERROR_AUTHENTICATION_FAILED: */ break; - case LIBSSH2_ERROR_INVAL: + case LIBSSH2_ERROR_AUTHENTICATION_FAILED: - /* "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 + /* "ssh2/utils.pyx":201 + * 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, 198, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __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, 198, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_AuthenticationError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __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, 201, __pyx_L1_error) - /* "ssh2/utils.pyx":197 - * elif errcode == error_codes._LIBSSH2_ERROR_METHOD_NOT_SUPPORTED: - * raise exceptions.MethodNotSupported - * elif errcode == error_codes._LIBSSH2_ERROR_INVAL: # <<<<<<<<<<<<<< - * raise exceptions.InvalidRequestError - * elif errcode == error_codes._LIBSSH2_ERROR_INVALID_POLL_TYPE: + /* "ssh2/utils.pyx":200 + * elif errcode == error_codes._LIBSSH2_ERROR_METHOD_NONE: + * raise exceptions.MethodNoneError + * elif errcode == error_codes._LIBSSH2_ERROR_AUTHENTICATION_FAILED: # <<<<<<<<<<<<<< + * raise exceptions.AuthenticationError + * elif errcode == error_codes._LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED: */ break; - case LIBSSH2_ERROR_INVALID_POLL_TYPE: + case LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED: - /* "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 + /* "ssh2/utils.pyx":203 + * 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, 200, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __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, 200, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_PublickeyUnverifiedError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __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, 203, __pyx_L1_error) - /* "ssh2/utils.pyx":199 - * elif errcode == error_codes._LIBSSH2_ERROR_INVAL: - * raise exceptions.InvalidRequestError - * elif errcode == error_codes._LIBSSH2_ERROR_INVALID_POLL_TYPE: # <<<<<<<<<<<<<< - * raise exceptions.InvalidPollTypeError - * elif errcode == error_codes._LIBSSH2_ERROR_PUBLICKEY_PROTOCOL: + /* "ssh2/utils.pyx":202 + * elif errcode == error_codes._LIBSSH2_ERROR_AUTHENTICATION_FAILED: + * raise exceptions.AuthenticationError + * elif errcode == error_codes._LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED: # <<<<<<<<<<<<<< + * raise exceptions.PublickeyUnverifiedError + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_OUTOFORDER: */ break; - case LIBSSH2_ERROR_PUBLICKEY_PROTOCOL: + case LIBSSH2_ERROR_CHANNEL_OUTOFORDER: - /* "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 + /* "ssh2/utils.pyx":205 + * 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, 202, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __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, 202, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ChannelOutOfOrderError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __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, 205, __pyx_L1_error) - /* "ssh2/utils.pyx":201 - * elif errcode == error_codes._LIBSSH2_ERROR_INVALID_POLL_TYPE: - * raise exceptions.InvalidPollTypeError - * elif errcode == error_codes._LIBSSH2_ERROR_PUBLICKEY_PROTOCOL: # <<<<<<<<<<<<<< - * raise exceptions.PublicKeyProtocolError - * elif errcode == error_codes._LIBSSH2_ERROR_BUFFER_TOO_SMALL: + /* "ssh2/utils.pyx":204 + * elif errcode == error_codes._LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED: + * raise exceptions.PublickeyUnverifiedError + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_OUTOFORDER: # <<<<<<<<<<<<<< + * raise exceptions.ChannelOutOfOrderError + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_FAILURE: */ break; - case LIBSSH2_ERROR_BUFFER_TOO_SMALL: + case LIBSSH2_ERROR_CHANNEL_FAILURE: - /* "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 + /* "ssh2/utils.pyx":207 + * 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, 204, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __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, 204, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ChannelFailure); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __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, 207, __pyx_L1_error) - /* "ssh2/utils.pyx":203 - * elif errcode == error_codes._LIBSSH2_ERROR_PUBLICKEY_PROTOCOL: - * raise exceptions.PublicKeyProtocolError - * elif errcode == error_codes._LIBSSH2_ERROR_BUFFER_TOO_SMALL: # <<<<<<<<<<<<<< - * raise exceptions.BufferTooSmallError - * elif errcode == error_codes._LIBSSH2_ERROR_BAD_USE: + /* "ssh2/utils.pyx":206 + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_OUTOFORDER: + * raise exceptions.ChannelOutOfOrderError + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_FAILURE: # <<<<<<<<<<<<<< + * raise exceptions.ChannelFailure + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_REQUEST_DENIED: */ break; - case LIBSSH2_ERROR_BAD_USE: + case LIBSSH2_ERROR_CHANNEL_REQUEST_DENIED: - /* "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 + /* "ssh2/utils.pyx":209 + * 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, 206, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 209, __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, 206, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ChannelRequestDenied); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __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, 209, __pyx_L1_error) - /* "ssh2/utils.pyx":205 - * elif errcode == error_codes._LIBSSH2_ERROR_BUFFER_TOO_SMALL: - * raise exceptions.BufferTooSmallError - * elif errcode == error_codes._LIBSSH2_ERROR_BAD_USE: # <<<<<<<<<<<<<< - * raise exceptions.BadUseError - * elif errcode == error_codes._LIBSSH2_ERROR_COMPRESS: + /* "ssh2/utils.pyx":208 + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_FAILURE: + * raise exceptions.ChannelFailure + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_REQUEST_DENIED: # <<<<<<<<<<<<<< + * raise exceptions.ChannelRequestDenied + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_UNKNOWN: */ break; - case LIBSSH2_ERROR_COMPRESS: + case LIBSSH2_ERROR_CHANNEL_UNKNOWN: - /* "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 + /* "ssh2/utils.pyx":211 + * 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, 208, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __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, 208, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ChannelUnknownError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __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, 211, __pyx_L1_error) - /* "ssh2/utils.pyx":207 - * elif errcode == error_codes._LIBSSH2_ERROR_BAD_USE: - * raise exceptions.BadUseError - * elif errcode == error_codes._LIBSSH2_ERROR_COMPRESS: # <<<<<<<<<<<<<< - * raise exceptions.CompressError - * elif errcode == error_codes._LIBSSH2_ERROR_OUT_OF_BOUNDARY: + /* "ssh2/utils.pyx":210 + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_REQUEST_DENIED: + * raise exceptions.ChannelRequestDenied + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_UNKNOWN: # <<<<<<<<<<<<<< + * raise exceptions.ChannelUnknownError + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_WINDOW_EXCEEDED: */ break; - case LIBSSH2_ERROR_OUT_OF_BOUNDARY: + case LIBSSH2_ERROR_CHANNEL_WINDOW_EXCEEDED: - /* "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 + /* "ssh2/utils.pyx":213 + * 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, 210, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __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, 210, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ChannelWindowExceeded); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __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) + __PYX_ERR(0, 213, __pyx_L1_error) - /* "ssh2/utils.pyx":209 - * elif errcode == error_codes._LIBSSH2_ERROR_COMPRESS: - * raise exceptions.CompressError - * elif errcode == error_codes._LIBSSH2_ERROR_OUT_OF_BOUNDARY: # <<<<<<<<<<<<<< - * raise exceptions.OutOfBoundaryError - * elif errcode == error_codes._LIBSSH2_ERROR_AGENT_PROTOCOL: + /* "ssh2/utils.pyx":212 + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_UNKNOWN: + * raise exceptions.ChannelUnknownError + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_WINDOW_EXCEEDED: # <<<<<<<<<<<<<< + * raise exceptions.ChannelWindowExceeded + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_PACKET_EXCEEDED: */ break; - case LIBSSH2_ERROR_AGENT_PROTOCOL: + case LIBSSH2_ERROR_CHANNEL_PACKET_EXCEEDED: - /* "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 + /* "ssh2/utils.pyx":215 + * 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, 212, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __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, 212, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ChannelPacketExceeded); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __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, 212, __pyx_L1_error) + __PYX_ERR(0, 215, __pyx_L1_error) - /* "ssh2/utils.pyx":211 - * elif errcode == error_codes._LIBSSH2_ERROR_OUT_OF_BOUNDARY: - * raise exceptions.OutOfBoundaryError - * elif errcode == error_codes._LIBSSH2_ERROR_AGENT_PROTOCOL: # <<<<<<<<<<<<<< - * raise exceptions.AgentProtocolError - * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_RECV: + /* "ssh2/utils.pyx":214 + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_WINDOW_EXCEEDED: + * raise exceptions.ChannelWindowExceeded + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_PACKET_EXCEEDED: # <<<<<<<<<<<<<< + * raise exceptions.ChannelPacketExceeded + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_CLOSED: */ break; - case LIBSSH2_ERROR_SOCKET_RECV: + case LIBSSH2_ERROR_CHANNEL_CLOSED: - /* "ssh2/utils.pyx":214 - * raise exceptions.AgentProtocolError - * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_RECV: - * raise exceptions.SocketRecvError # <<<<<<<<<<<<<< - * elif errcode == error_codes._LIBSSH2_ERROR_ENCRYPT: - * raise exceptions.EncryptError + /* "ssh2/utils.pyx":217 + * 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, 214, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 217, __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, 214, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ChannelClosedError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __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, 214, __pyx_L1_error) + __PYX_ERR(0, 217, __pyx_L1_error) - /* "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_ENCRYPT: + /* "ssh2/utils.pyx":216 + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_PACKET_EXCEEDED: + * raise exceptions.ChannelPacketExceeded + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_CLOSED: # <<<<<<<<<<<<<< + * raise exceptions.ChannelClosedError + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_EOF_SENT: */ break; - case LIBSSH2_ERROR_ENCRYPT: + case LIBSSH2_ERROR_CHANNEL_EOF_SENT: - /* "ssh2/utils.pyx":216 - * raise exceptions.SocketRecvError - * elif errcode == error_codes._LIBSSH2_ERROR_ENCRYPT: - * raise exceptions.EncryptError # <<<<<<<<<<<<<< - * elif errcode == error_codes._LIBSSH2_ERROR_BAD_SOCKET: - * raise exceptions.BadSocketError + /* "ssh2/utils.pyx":219 + * 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, 216, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __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_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ChannelEOFSentError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 219, __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, 216, __pyx_L1_error) - - /* "ssh2/utils.pyx":215 - * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_RECV: - * raise exceptions.SocketRecvError - * elif errcode == error_codes._LIBSSH2_ERROR_ENCRYPT: # <<<<<<<<<<<<<< - * raise exceptions.EncryptError - * elif errcode == error_codes._LIBSSH2_ERROR_BAD_SOCKET: - */ - break; - case LIBSSH2_ERROR_BAD_SOCKET: + __PYX_ERR(0, 219, __pyx_L1_error) /* "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 + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_CLOSED: + * raise exceptions.ChannelClosedError + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_EOF_SENT: # <<<<<<<<<<<<<< + * raise exceptions.ChannelEOFSentError + * elif errcode == error_codes._LIBSSH2_ERROR_SCP_PROTOCOL: + */ + break; + case LIBSSH2_ERROR_SCP_PROTOCOL: + + /* "ssh2/utils.pyx":221 + * 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, 218, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __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_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_SCPProtocolError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __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, 218, __pyx_L1_error) + __PYX_ERR(0, 221, __pyx_L1_error) - /* "ssh2/utils.pyx":217 - * 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: + /* "ssh2/utils.pyx":220 + * elif errcode == error_codes._LIBSSH2_ERROR_CHANNEL_EOF_SENT: + * raise exceptions.ChannelEOFSentError + * elif errcode == error_codes._LIBSSH2_ERROR_SCP_PROTOCOL: # <<<<<<<<<<<<<< + * raise exceptions.SCPProtocolError + * elif errcode == error_codes._LIBSSH2_ERROR_ZLIB: */ break; - case LIBSSH2_ERROR_KNOWN_HOSTS: + case LIBSSH2_ERROR_ZLIB: - /* "ssh2/utils.pyx":220 - * 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 + /* "ssh2/utils.pyx":223 + * 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, 220, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __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_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ZlibError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 223, __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, 220, __pyx_L1_error) + __PYX_ERR(0, 223, __pyx_L1_error) - /* "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: + /* "ssh2/utils.pyx":222 + * elif errcode == error_codes._LIBSSH2_ERROR_SCP_PROTOCOL: + * raise exceptions.SCPProtocolError + * elif errcode == error_codes._LIBSSH2_ERROR_ZLIB: # <<<<<<<<<<<<<< + * raise exceptions.ZlibError + * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_TIMEOUT: */ break; - case LIBSSH2_ERROR_CHANNEL_WINDOW_FULL: + case LIBSSH2_ERROR_SOCKET_TIMEOUT: - /* "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 + /* "ssh2/utils.pyx":225 + * 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, 222, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 225, __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_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_SocketTimeout); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __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) + __PYX_ERR(0, 225, __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: + /* "ssh2/utils.pyx":224 + * elif errcode == error_codes._LIBSSH2_ERROR_ZLIB: + * raise exceptions.ZlibError + * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_TIMEOUT: # <<<<<<<<<<<<<< + * raise exceptions.SocketTimeout + * elif errcode == error_codes._LIBSSH2_ERROR_SFTP_PROTOCOL: */ break; - case LIBSSH2_ERROR_KEYFILE_AUTH_FAILED: + case LIBSSH2_ERROR_SFTP_PROTOCOL: - /* "ssh2/utils.pyx":224 - * raise exceptions.ChannelWindowFullError - * elif errcode == error_codes._LIBSSH2_ERROR_KEYFILE_AUTH_FAILED: - * raise exceptions.KeyfileAuthFailedError # <<<<<<<<<<<<<< - * else: - * # Switch default + /* "ssh2/utils.pyx":227 + * 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, 224, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __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_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_SFTPProtocolError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 227, __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) + __PYX_ERR(0, 227, __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: + /* "ssh2/utils.pyx":226 + * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_TIMEOUT: + * raise exceptions.SocketTimeout + * elif errcode == error_codes._LIBSSH2_ERROR_SFTP_PROTOCOL: # <<<<<<<<<<<<<< + * raise exceptions.SFTPProtocolError + * elif errcode == error_codes._LIBSSH2_ERROR_REQUEST_DENIED: */ break; - default: + case LIBSSH2_ERROR_REQUEST_DENIED: - /* "ssh2/utils.pyx":227 - * else: - * # Switch default - * if errcode < 0: # <<<<<<<<<<<<<< - * raise exceptions.UnknownError("Error code %s not known", errcode) - * return errcode + /* "ssh2/utils.pyx":229 + * 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_t_3 = (__pyx_v_errcode < 0); - if (unlikely(__pyx_t_3)) { + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 229, __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, 229, __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, 229, __pyx_L1_error) - /* "ssh2/utils.pyx":228 - * # Switch default - * if errcode < 0: - * raise exceptions.UnknownError("Error code %s not known", errcode) # <<<<<<<<<<<<<< - * return errcode + /* "ssh2/utils.pyx":228 + * elif errcode == error_codes._LIBSSH2_ERROR_SFTP_PROTOCOL: + * raise exceptions.SFTPProtocolError + * elif errcode == error_codes._LIBSSH2_ERROR_REQUEST_DENIED: # <<<<<<<<<<<<<< + * raise exceptions.RequestDeniedError + * elif errcode == error_codes._LIBSSH2_ERROR_METHOD_NOT_SUPPORTED: */ - __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_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 - if (unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_6 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_kp_u_Error_code_s_not_known, __pyx_t_1}; - __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 228, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 228, __pyx_L1_error) + break; + case LIBSSH2_ERROR_METHOD_NOT_SUPPORTED: - /* "ssh2/utils.pyx":227 - * else: - * # Switch default - * if errcode < 0: # <<<<<<<<<<<<<< - * raise exceptions.UnknownError("Error code %s not known", errcode) - * return errcode + /* "ssh2/utils.pyx":231 + * 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, 231, __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, 231, __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, 231, __pyx_L1_error) - /* "ssh2/utils.pyx":229 - * if errcode < 0: - * raise exceptions.UnknownError("Error code %s not known", errcode) - * return errcode # <<<<<<<<<<<<<< + /* "ssh2/utils.pyx":230 + * elif errcode == error_codes._LIBSSH2_ERROR_REQUEST_DENIED: + * raise exceptions.RequestDeniedError + * elif errcode == error_codes._LIBSSH2_ERROR_METHOD_NOT_SUPPORTED: # <<<<<<<<<<<<<< + * raise exceptions.MethodNotSupported + * elif errcode == error_codes._LIBSSH2_ERROR_INVAL: */ - __pyx_r = __pyx_v_errcode; - goto __pyx_L0; break; - } + case LIBSSH2_ERROR_INVAL: - /* "ssh2/utils.pyx":116 - * - * - * cpdef int handle_error_codes(int errcode) except -1: # <<<<<<<<<<<<<< - * """Raise appropriate exception for given error code. - * + /* "ssh2/utils.pyx":233 + * 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, 233, __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, 233, __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, 233, __pyx_L1_error) - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("ssh2.utils.handle_error_codes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "ssh2/utils.pyx":232 + * elif errcode == error_codes._LIBSSH2_ERROR_METHOD_NOT_SUPPORTED: + * raise exceptions.MethodNotSupported + * elif errcode == error_codes._LIBSSH2_ERROR_INVAL: # <<<<<<<<<<<<<< + * raise exceptions.InvalidRequestError + * elif errcode == error_codes._LIBSSH2_ERROR_INVALID_POLL_TYPE: + */ + break; + case LIBSSH2_ERROR_INVALID_POLL_TYPE: -/* Python wrapper */ -static PyObject *__pyx_pw_4ssh2_5utils_9handle_error_codes(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -PyDoc_STRVAR(__pyx_doc_4ssh2_5utils_8handle_error_codes, "handle_error_codes(int errcode) -> int\nRaise appropriate exception for given error code.\n\n Returns 0 on no error and ``LIBSSH2_ERROR_EAGAIN`` on ``EAGAIN``.\n\n :raises: Appropriate exception from :py:mod:`ssh2.exceptions`.\n\n :param errcode: Error code as returned by\n :py:func:`ssh2.session.Session.last_errno`\n "); -static PyMethodDef __pyx_mdef_4ssh2_5utils_9handle_error_codes = {"handle_error_codes", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_5utils_9handle_error_codes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_5utils_8handle_error_codes}; -static PyObject *__pyx_pw_4ssh2_5utils_9handle_error_codes(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - int __pyx_v_errcode; - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED Py_ssize_t __pyx_nargs; - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject* values[1] = {0}; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("handle_error_codes (wrapper)", 0); - #if !CYTHON_METH_FASTCALL - #if CYTHON_ASSUME_SAFE_MACROS - __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #else - __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; - #endif - #endif - __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_errcode,0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_errcode)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "handle_error_codes") < 0)) __PYX_ERR(0, 116, __pyx_L3_error) - } - } else if (unlikely(__pyx_nargs != 1)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - } - __pyx_v_errcode = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_errcode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L3_error) - } - goto __pyx_L6_skip; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("handle_error_codes", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 116, __pyx_L3_error) - __pyx_L6_skip:; - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - { - Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); - } - } - __Pyx_AddTraceback("ssh2.utils.handle_error_codes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4ssh2_5utils_8handle_error_codes(__pyx_self, __pyx_v_errcode); - - /* function exit code */ - { - Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); - } - } - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_4ssh2_5utils_8handle_error_codes(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_errcode) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("handle_error_codes", 1); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_errcode, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 116, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("ssh2.utils.handle_error_codes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; -#ifndef CYTHON_SMALL_CODE -#if defined(__clang__) - #define CYTHON_SMALL_CODE -#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) - #define CYTHON_SMALL_CODE __attribute__((cold)) -#else - #define CYTHON_SMALL_CODE -#endif -#endif -/* #### Code section: pystring_table ### */ - -static int __Pyx_CreateStringTabAndInitStrings(void) { - __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0}, - {&__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}, - {&__pyx_n_s_BannerRecvError, __pyx_k_BannerRecvError, sizeof(__pyx_k_BannerRecvError), 0, 0, 1, 1}, - {&__pyx_n_s_BannerSendError, __pyx_k_BannerSendError, sizeof(__pyx_k_BannerSendError), 0, 0, 1, 1}, - {&__pyx_n_s_BufferTooSmallError, __pyx_k_BufferTooSmallError, sizeof(__pyx_k_BufferTooSmallError), 0, 0, 1, 1}, - {&__pyx_n_s_ChannelClosedError, __pyx_k_ChannelClosedError, sizeof(__pyx_k_ChannelClosedError), 0, 0, 1, 1}, - {&__pyx_n_s_ChannelEOFSentError, __pyx_k_ChannelEOFSentError, sizeof(__pyx_k_ChannelEOFSentError), 0, 0, 1, 1}, - {&__pyx_n_s_ChannelFailure, __pyx_k_ChannelFailure, sizeof(__pyx_k_ChannelFailure), 0, 0, 1, 1}, - {&__pyx_n_s_ChannelOutOfOrderError, __pyx_k_ChannelOutOfOrderError, sizeof(__pyx_k_ChannelOutOfOrderError), 0, 0, 1, 1}, - {&__pyx_n_s_ChannelPacketExceeded, __pyx_k_ChannelPacketExceeded, sizeof(__pyx_k_ChannelPacketExceeded), 0, 0, 1, 1}, - {&__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}, - {&__pyx_n_s_EncryptError, __pyx_k_EncryptError, sizeof(__pyx_k_EncryptError), 0, 0, 1, 1}, - {&__pyx_kp_u_Error_code_s_not_known, __pyx_k_Error_code_s_not_known, sizeof(__pyx_k_Error_code_s_not_known), 0, 1, 0, 0}, - {&__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}, - {&__pyx_n_s_OutOfBoundaryError, __pyx_k_OutOfBoundaryError, sizeof(__pyx_k_OutOfBoundaryError), 0, 0, 1, 1}, - {&__pyx_n_s_PasswordExpiredError, __pyx_k_PasswordExpiredError, sizeof(__pyx_k_PasswordExpiredError), 0, 0, 1, 1}, - {&__pyx_n_s_ProtocolError, __pyx_k_ProtocolError, sizeof(__pyx_k_ProtocolError), 0, 0, 1, 1}, - {&__pyx_n_s_PublicKeyProtocolError, __pyx_k_PublicKeyProtocolError, sizeof(__pyx_k_PublicKeyProtocolError), 0, 0, 1, 1}, - {&__pyx_n_s_PublickeyUnverifiedError, __pyx_k_PublickeyUnverifiedError, sizeof(__pyx_k_PublickeyUnverifiedError), 0, 0, 1, 1}, - {&__pyx_n_s_RequestDeniedError, __pyx_k_RequestDeniedError, sizeof(__pyx_k_RequestDeniedError), 0, 0, 1, 1}, - {&__pyx_n_s_SCPProtocolError, __pyx_k_SCPProtocolError, sizeof(__pyx_k_SCPProtocolError), 0, 0, 1, 1}, - {&__pyx_n_s_SFTPProtocolError, __pyx_k_SFTPProtocolError, sizeof(__pyx_k_SFTPProtocolError), 0, 0, 1, 1}, - {&__pyx_n_s_SSH2Error, __pyx_k_SSH2Error, sizeof(__pyx_k_SSH2Error), 0, 0, 1, 1}, - {&__pyx_n_s_SocketDisconnectError, __pyx_k_SocketDisconnectError, sizeof(__pyx_k_SocketDisconnectError), 0, 0, 1, 1}, - {&__pyx_n_s_SocketRecvError, __pyx_k_SocketRecvError, sizeof(__pyx_k_SocketRecvError), 0, 0, 1, 1}, - {&__pyx_n_s_SocketSendError, __pyx_k_SocketSendError, sizeof(__pyx_k_SocketSendError), 0, 0, 1, 1}, - {&__pyx_n_s_SocketTimeout, __pyx_k_SocketTimeout, sizeof(__pyx_k_SocketTimeout), 0, 0, 1, 1}, - {&__pyx_n_s_Timeout, __pyx_k_Timeout, sizeof(__pyx_k_Timeout), 0, 0, 1, 1}, - {&__pyx_n_s_UnknownError, __pyx_k_UnknownError, sizeof(__pyx_k_UnknownError), 0, 0, 1, 1}, - {&__pyx_n_s_ZlibError, __pyx_k_ZlibError, sizeof(__pyx_k_ZlibError), 0, 0, 1, 1}, - {&__pyx_n_s__13, __pyx_k__13, sizeof(__pyx_k__13), 0, 0, 1, 1}, - {&__pyx_n_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 1}, - {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, - {&__pyx_n_s_block_directions, __pyx_k_block_directions, sizeof(__pyx_k_block_directions), 0, 0, 1, 1}, - {&__pyx_n_s_buf, __pyx_k_buf, sizeof(__pyx_k_buf), 0, 0, 1, 1}, - {&__pyx_n_s_buf_len, __pyx_k_buf_len, sizeof(__pyx_k_buf_len), 0, 0, 1, 1}, - {&__pyx_n_s_c_buf, __pyx_k_c_buf, sizeof(__pyx_k_c_buf), 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_cur_buf, __pyx_k_cur_buf, sizeof(__pyx_k_cur_buf), 0, 0, 1, 1}, - {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1}, - {&__pyx_n_s_directions, __pyx_k_directions, sizeof(__pyx_k_directions), 0, 0, 1, 1}, - {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, - {&__pyx_n_s_errcode, __pyx_k_errcode, sizeof(__pyx_k_errcode), 0, 0, 1, 1}, - {&__pyx_n_s_exceptions, __pyx_k_exceptions, sizeof(__pyx_k_exceptions), 0, 0, 1, 1}, - {&__pyx_n_s_find_eol, __pyx_k_find_eol, sizeof(__pyx_k_find_eol), 0, 0, 1, 1}, - {&__pyx_n_s_handle_error_codes, __pyx_k_handle_error_codes, sizeof(__pyx_k_handle_error_codes), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1}, - {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_new_pos, __pyx_k_new_pos, sizeof(__pyx_k_new_pos), 0, 0, 1, 1}, - {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1}, - {&__pyx_n_s_readfds, __pyx_k_readfds, sizeof(__pyx_k_readfds), 0, 0, 1, 1}, - {&__pyx_n_s_required_version, __pyx_k_required_version, sizeof(__pyx_k_required_version), 0, 0, 1, 1}, - {&__pyx_n_s_select, __pyx_k_select, sizeof(__pyx_k_select), 0, 0, 1, 1}, - {&__pyx_n_s_session, __pyx_k_session, sizeof(__pyx_k_session), 0, 0, 1, 1}, - {&__pyx_n_s_socket, __pyx_k_socket, sizeof(__pyx_k_socket), 0, 0, 1, 1}, - {&__pyx_n_s_ssh2_exit, __pyx_k_ssh2_exit, sizeof(__pyx_k_ssh2_exit), 0, 0, 1, 1}, - {&__pyx_n_s_ssh2_utils, __pyx_k_ssh2_utils, sizeof(__pyx_k_ssh2_utils), 0, 0, 1, 1}, - {&__pyx_kp_s_ssh2_utils_pyx, __pyx_k_ssh2_utils_pyx, sizeof(__pyx_k_ssh2_utils_pyx), 0, 0, 1, 0}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_timeout, __pyx_k_timeout, sizeof(__pyx_k_timeout), 0, 0, 1, 1}, - {&__pyx_kp_u_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 1, 0, 0}, - {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1}, - {&__pyx_n_s_wait_socket, __pyx_k_wait_socket, sizeof(__pyx_k_wait_socket), 0, 0, 1, 1}, - {&__pyx_n_s_writefds, __pyx_k_writefds, sizeof(__pyx_k_writefds), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} - }; - return __Pyx_InitStrings(__pyx_string_tab); -} -/* #### Code section: cached_builtins ### */ -static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - return 0; -} -/* #### Code section: cached_constants ### */ - -static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - - /* "ssh2/utils.pyx":51 - * - * - * def find_eol(bytes buf, Py_ssize_t pos): # <<<<<<<<<<<<<< - * """Find end-of-line in buffer from position and return end position of - * line and where next find_eol should start from. + /* "ssh2/utils.pyx":235 + * 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_tuple__3 = PyTuple_Pack(7, __pyx_n_s_buf, __pyx_n_s_pos, __pyx_n_s_buf_len, __pyx_n_s_cur_buf, __pyx_n_s_c_buf, __pyx_n_s_index, __pyx_n_s_new_pos); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 51, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); - __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__3, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_utils_pyx, __pyx_n_s_find_eol, 51, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 51, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __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, 235, __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, 235, __pyx_L1_error) - /* "ssh2/utils.pyx":78 - * - * - * def version(int required_version=0): # <<<<<<<<<<<<<< - * """Get libssh2 version string. - * + /* "ssh2/utils.pyx":234 + * elif errcode == error_codes._LIBSSH2_ERROR_INVAL: + * raise exceptions.InvalidRequestError + * elif errcode == error_codes._LIBSSH2_ERROR_INVALID_POLL_TYPE: # <<<<<<<<<<<<<< + * raise exceptions.InvalidPollTypeError + * elif errcode == error_codes._LIBSSH2_ERROR_PUBLICKEY_PROTOCOL: */ - __pyx_tuple__5 = PyTuple_Pack(2, __pyx_n_s_required_version, __pyx_n_s_version); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); - __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_utils_pyx, __pyx_n_s_version, 78, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 78, __pyx_L1_error) + break; + case LIBSSH2_ERROR_PUBLICKEY_PROTOCOL: - /* "ssh2/utils.pyx":95 - * - * - * def ssh2_exit(): # <<<<<<<<<<<<<< - * """Call libssh2_exit""" - * c_ssh2.libssh2_exit() + /* "ssh2/utils.pyx":237 + * 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_codeobj__7 = (PyObject*)__Pyx_PyCode_New(0, 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_utils_pyx, __pyx_n_s_ssh2_exit, 95, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 237, __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, 237, __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, 237, __pyx_L1_error) - /* "ssh2/utils.pyx":100 - * - * - * def wait_socket(_socket not None, Session session, timeout=1): # <<<<<<<<<<<<<< - * """Helper function for testing non-blocking mode. - * + /* "ssh2/utils.pyx":236 + * elif errcode == error_codes._LIBSSH2_ERROR_INVALID_POLL_TYPE: + * raise exceptions.InvalidPollTypeError + * elif errcode == error_codes._LIBSSH2_ERROR_PUBLICKEY_PROTOCOL: # <<<<<<<<<<<<<< + * raise exceptions.PublicKeyProtocolError + * elif errcode == error_codes._LIBSSH2_ERROR_BUFFER_TOO_SMALL: */ - __pyx_tuple__8 = PyTuple_Pack(6, __pyx_n_s_socket, __pyx_n_s_session, __pyx_n_s_timeout, __pyx_n_s_directions, __pyx_n_s_readfds, __pyx_n_s_writefds); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); - __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_utils_pyx, __pyx_n_s_wait_socket, 100, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 100, __pyx_L1_error) - __pyx_tuple__10 = PyTuple_Pack(1, ((PyObject *)__pyx_int_1)); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); + break; + case LIBSSH2_ERROR_BUFFER_TOO_SMALL: - /* "ssh2/utils.pyx":116 - * - * - * cpdef int handle_error_codes(int errcode) except -1: # <<<<<<<<<<<<<< - * """Raise appropriate exception for given error code. - * + /* "ssh2/utils.pyx":239 + * 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_tuple__11 = PyTuple_Pack(1, __pyx_n_s_errcode); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); - __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_utils_pyx, __pyx_n_s_handle_error_codes, 116, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} -/* #### Code section: init_constants ### */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __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, 239, __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, 239, __pyx_L1_error) -static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { - if (__Pyx_CreateStringTabAndInitStrings() < 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) - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} -/* #### Code section: init_globals ### */ + /* "ssh2/utils.pyx":238 + * elif errcode == error_codes._LIBSSH2_ERROR_PUBLICKEY_PROTOCOL: + * raise exceptions.PublicKeyProtocolError + * elif errcode == error_codes._LIBSSH2_ERROR_BUFFER_TOO_SMALL: # <<<<<<<<<<<<<< + * raise exceptions.BufferTooSmallError + * elif errcode == error_codes._LIBSSH2_ERROR_BAD_USE: + */ + break; + case LIBSSH2_ERROR_BAD_USE: -static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { - return 0; -} -/* #### Code section: init_module ### */ + /* "ssh2/utils.pyx":241 + * 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, 241, __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, 241, __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, 241, __pyx_L1_error) -static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ + /* "ssh2/utils.pyx":240 + * elif errcode == error_codes._LIBSSH2_ERROR_BUFFER_TOO_SMALL: + * raise exceptions.BufferTooSmallError + * elif errcode == error_codes._LIBSSH2_ERROR_BAD_USE: # <<<<<<<<<<<<<< + * raise exceptions.BadUseError + * elif errcode == error_codes._LIBSSH2_ERROR_COMPRESS: + */ + break; + case LIBSSH2_ERROR_COMPRESS: -static int __Pyx_modinit_global_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); - /*--- Global init code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "ssh2/utils.pyx":243 + * 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, 243, __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, 243, __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, 243, __pyx_L1_error) -static int __Pyx_modinit_variable_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); - /*--- Variable export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "ssh2/utils.pyx":242 + * elif errcode == error_codes._LIBSSH2_ERROR_BAD_USE: + * raise exceptions.BadUseError + * elif errcode == error_codes._LIBSSH2_ERROR_COMPRESS: # <<<<<<<<<<<<<< + * raise exceptions.CompressError + * elif errcode == error_codes._LIBSSH2_ERROR_OUT_OF_BOUNDARY: + */ + break; + case LIBSSH2_ERROR_OUT_OF_BOUNDARY: -static int __Pyx_modinit_function_export_code(void) { - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); - /*--- Function export code ---*/ - if (__Pyx_ExportFunction("to_bytes", (void (*)(void))__pyx_f_4ssh2_5utils_to_bytes, "PyObject *(PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportFunction("to_str", (void (*)(void))__pyx_f_4ssh2_5utils_to_str, "PyObject *(char *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportFunction("to_str_len", (void (*)(void))__pyx_f_4ssh2_5utils_to_str_len, "PyObject *(char *, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportFunction("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) - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} + /* "ssh2/utils.pyx":245 + * 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, 245, __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, 245, __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, 245, __pyx_L1_error) -static int __Pyx_modinit_type_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); - /*--- Type init code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "ssh2/utils.pyx":244 + * elif errcode == error_codes._LIBSSH2_ERROR_COMPRESS: + * raise exceptions.CompressError + * elif errcode == error_codes._LIBSSH2_ERROR_OUT_OF_BOUNDARY: # <<<<<<<<<<<<<< + * raise exceptions.OutOfBoundaryError + * elif errcode == error_codes._LIBSSH2_ERROR_AGENT_PROTOCOL: + */ + break; + case LIBSSH2_ERROR_AGENT_PROTOCOL: -static int __Pyx_modinit_type_import_code(void) { - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); - /*--- Type import code ---*/ - __pyx_t_1 = PyImport_ImportModule("ssh2.session"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_4ssh2_7session_Session = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.session", "Session", sizeof(struct __pyx_obj_4ssh2_7session_Session), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_7session_Session),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_4ssh2_7session_Session) __PYX_ERR(1, 19, __pyx_L1_error) - __pyx_ptype_4ssh2_7session_MethodType = __Pyx_ImportType_3_0_11(__pyx_t_1, "ssh2.session", "MethodType", sizeof(struct __pyx_obj_4ssh2_7session_MethodType), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_4ssh2_7session_MethodType),__Pyx_ImportType_CheckSize_Warn_3_0_11); 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; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_RefNannyFinishContext(); - return -1; -} + /* "ssh2/utils.pyx":247 + * 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, 247, __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, 247, __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, 247, __pyx_L1_error) -static int __Pyx_modinit_variable_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); - /*--- Variable import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "ssh2/utils.pyx":246 + * elif errcode == error_codes._LIBSSH2_ERROR_OUT_OF_BOUNDARY: + * raise exceptions.OutOfBoundaryError + * elif errcode == error_codes._LIBSSH2_ERROR_AGENT_PROTOCOL: # <<<<<<<<<<<<<< + * raise exceptions.AgentProtocolError + * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_RECV: + */ + break; + case LIBSSH2_ERROR_SOCKET_RECV: -static int __Pyx_modinit_function_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); - /*--- Function import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "ssh2/utils.pyx":249 + * raise exceptions.AgentProtocolError + * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_RECV: + * raise exceptions.SocketRecvError # <<<<<<<<<<<<<< + * 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, 249, __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, 249, __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, 249, __pyx_L1_error) + /* "ssh2/utils.pyx":248 + * 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_ENCRYPT: + */ + break; + case LIBSSH2_ERROR_ENCRYPT: -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec_utils(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec_utils}, - {0, NULL} -}; -#endif + /* "ssh2/utils.pyx":251 + * raise exceptions.SocketRecvError + * 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_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_EncryptError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 251, __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, 251, __pyx_L1_error) -#ifdef __cplusplus -namespace { - struct PyModuleDef __pyx_moduledef = - #else - static struct PyModuleDef __pyx_moduledef = - #endif - { - PyModuleDef_HEAD_INIT, - "utils", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #elif CYTHON_USE_MODULE_STATE - sizeof(__pyx_mstate), /* m_size */ - #else - -1, /* m_size */ - #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ - #endif - #if CYTHON_USE_MODULE_STATE - __pyx_m_traverse, /* m_traverse */ - __pyx_m_clear, /* m_clear */ - NULL /* m_free */ - #else - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ - #endif - }; - #ifdef __cplusplus -} /* anonymous namespace */ -#endif -#endif + /* "ssh2/utils.pyx":250 + * elif errcode == error_codes._LIBSSH2_ERROR_SOCKET_RECV: + * raise exceptions.SocketRecvError + * elif errcode == error_codes._LIBSSH2_ERROR_ENCRYPT: # <<<<<<<<<<<<<< + * raise exceptions.EncryptError + * elif errcode == error_codes._LIBSSH2_ERROR_BAD_SOCKET: + */ + break; + case LIBSSH2_ERROR_BAD_SOCKET: -#ifndef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC -#elif PY_MAJOR_VERSION < 3 -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" void -#else -#define __Pyx_PyMODINIT_FUNC void -#endif -#else -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * -#else -#define __Pyx_PyMODINIT_FUNC PyObject * -#endif -#endif + /* "ssh2/utils.pyx":253 + * 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_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 253, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_BadSocketError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __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, 253, __pyx_L1_error) + /* "ssh2/utils.pyx":252 + * 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: + */ + break; + case LIBSSH2_ERROR_KNOWN_HOSTS: -#if PY_MAJOR_VERSION < 3 -__Pyx_PyMODINIT_FUNC initutils(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC initutils(void) -#else -__Pyx_PyMODINIT_FUNC PyInit_utils(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC PyInit_utils(void) -#if CYTHON_PEP489_MULTI_PHASE_INIT -{ - return PyModuleDef_Init(&__pyx_moduledef); -} -static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { - #if PY_VERSION_HEX >= 0x030700A1 - static PY_INT64_T main_interpreter_id = -1; - PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); - if (main_interpreter_id == -1) { - main_interpreter_id = current_id; - return (unlikely(current_id == -1)) ? -1 : 0; - } else if (unlikely(main_interpreter_id != current_id)) - #else - static PyInterpreterState *main_interpreter = NULL; - PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; - if (!main_interpreter) { - main_interpreter = current_interpreter; - } else if (unlikely(main_interpreter != current_interpreter)) - #endif - { - PyErr_SetString( - PyExc_ImportError, - "Interpreter change detected - this module can only be loaded into one interpreter per process."); - return -1; + /* "ssh2/utils.pyx":255 + * 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 + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_KnownHostError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __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, 255, __pyx_L1_error) + + /* "ssh2/utils.pyx":254 + * 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":257 + * 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, 257, __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, 257, __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, 257, __pyx_L1_error) + + /* "ssh2/utils.pyx":256 + * 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":259 + * 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, 259, __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, 259, __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, 259, __pyx_L1_error) + + /* "ssh2/utils.pyx":258 + * 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":262 + * else: + * # Switch default + * if errcode < 0: # <<<<<<<<<<<<<< + * raise exceptions.UnknownError("Error code %s not known", errcode) + * return errcode + */ + __pyx_t_3 = (__pyx_v_errcode < 0); + if (unlikely(__pyx_t_3)) { + + /* "ssh2/utils.pyx":263 + * # Switch default + * if errcode < 0: + * raise exceptions.UnknownError("Error code %s not known", errcode) # <<<<<<<<<<<<<< + * return errcode + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 263, __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, 263, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __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, 263, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_kp_u_Error_code_s_not_known, __pyx_t_1}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 263, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 263, __pyx_L1_error) + + /* "ssh2/utils.pyx":262 + * else: + * # Switch default + * if errcode < 0: # <<<<<<<<<<<<<< + * raise exceptions.UnknownError("Error code %s not known", errcode) + * return errcode + */ } - return 0; + + /* "ssh2/utils.pyx":264 + * if errcode < 0: + * raise exceptions.UnknownError("Error code %s not known", errcode) + * return errcode # <<<<<<<<<<<<<< + */ + __pyx_r = __pyx_v_errcode; + goto __pyx_L0; + break; + } + + /* "ssh2/utils.pyx":151 + * + * + * cpdef int handle_error_codes(int errcode) except -1: # <<<<<<<<<<<<<< + * """Raise appropriate exception for given error code. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("ssh2.utils.handle_error_codes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -#if CYTHON_COMPILING_IN_LIMITED_API -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) + +/* Python wrapper */ +static PyObject *__pyx_pw_4ssh2_5utils_12handle_error_codes(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) +PyObject *__pyx_args, PyObject *__pyx_kwds #endif -{ - PyObject *value = PyObject_GetAttrString(spec, from_name); - int result = 0; - if (likely(value)) { - if (allow_none || value != Py_None) { -#if CYTHON_COMPILING_IN_LIMITED_API - result = PyModule_AddObject(module, to_name, value); +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_4ssh2_5utils_11handle_error_codes, "handle_error_codes(errcode: int) -> int\nRaise appropriate exception for given error code.\n\n Returns 0 on no error and ``LIBSSH2_ERROR_EAGAIN`` on ``EAGAIN``.\n\n :raises: Appropriate exception from :py:mod:`ssh2.exceptions`.\n\n :param errcode: Error code as returned by\n :py:func:`ssh2.session.Session.last_errno`\n "); +static PyMethodDef __pyx_mdef_4ssh2_5utils_12handle_error_codes = {"handle_error_codes", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4ssh2_5utils_12handle_error_codes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4ssh2_5utils_11handle_error_codes}; +static PyObject *__pyx_pw_4ssh2_5utils_12handle_error_codes(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else - result = PyDict_SetItemString(moddict, to_name, value); +PyObject *__pyx_args, PyObject *__pyx_kwds #endif - } - Py_DECREF(value); - } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - } else { - result = -1; - } - return result; -} -static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { - PyObject *module = NULL, *moddict, *modname; - CYTHON_UNUSED_VAR(def); - if (__Pyx_check_single_interpreter()) - return NULL; - if (__pyx_m) - return __Pyx_NewRef(__pyx_m); - modname = PyObject_GetAttrString(spec, "name"); - if (unlikely(!modname)) goto bad; - module = PyModule_NewObject(modname); - Py_DECREF(modname); - if (unlikely(!module)) goto bad; -#if CYTHON_COMPILING_IN_LIMITED_API - moddict = module; -#else - moddict = PyModule_GetDict(module); - if (unlikely(!moddict)) goto bad; -#endif - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; - return module; -bad: - Py_XDECREF(module); - return NULL; -} - - -static CYTHON_SMALL_CODE int __pyx_pymod_exec_utils(PyObject *__pyx_pyinit_module) -#endif -#endif -{ - int stringtab_initialized = 0; - #if CYTHON_USE_MODULE_STATE - int pystate_addmodule_run = 0; +) { + int __pyx_v_errcode; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - #if CYTHON_PEP489_MULTI_PHASE_INIT - if (__pyx_m) { - if (__pyx_m == __pyx_pyinit_module) return 0; - PyErr_SetString(PyExc_RuntimeError, "Module 'utils' has already been imported. Re-initialisation is not supported."); - return -1; - } - #elif PY_MAJOR_VERSION >= 3 - if (__pyx_m) return __Pyx_NewRef(__pyx_m); - #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); + __Pyx_RefNannySetupContext("handle_error_codes (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("utils", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #elif CYTHON_USE_MODULE_STATE - __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); - __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "utils" pseudovariable */ - if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) - pystate_addmodule_run = 1; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_errcode,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_errcode)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 151, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "handle_error_codes") < 0)) __PYX_ERR(0, 151, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_errcode = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_errcode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 151, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("handle_error_codes", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 151, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("ssh2.utils.handle_error_codes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4ssh2_5utils_11handle_error_codes(__pyx_self, __pyx_v_errcode); + + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_4ssh2_5utils_11handle_error_codes(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_errcode) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("handle_error_codes", 1); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4ssh2_5utils_handle_error_codes(__pyx_v_errcode, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 151, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("ssh2.utils.handle_error_codes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +#if CYTHON_USE_FREELISTS +static struct __pyx_obj_4ssh2_5utils___pyx_scope_struct__readline *__pyx_freelist_4ssh2_5utils___pyx_scope_struct__readline[8]; +static int __pyx_freecount_4ssh2_5utils___pyx_scope_struct__readline = 0; +#endif + +static PyObject *__pyx_tp_new_4ssh2_5utils___pyx_scope_struct__readline(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_freecount_4ssh2_5utils___pyx_scope_struct__readline > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_4ssh2_5utils___pyx_scope_struct__readline)))) { + o = (PyObject*)__pyx_freelist_4ssh2_5utils___pyx_scope_struct__readline[--__pyx_freecount_4ssh2_5utils___pyx_scope_struct__readline]; + memset(o, 0, sizeof(struct __pyx_obj_4ssh2_5utils___pyx_scope_struct__readline)); + (void) PyObject_INIT(o, t); + PyObject_GC_Track(o); + } else #endif + { + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + } #endif - CYTHON_UNUSED_VAR(__pyx_t_1); - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_cython_runtime = __Pyx_PyImport_AddModuleRef((const char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if CYTHON_REFNANNY -__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); -if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); + return o; } -#endif - __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_utils(void)", 0); - if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pxy_PyFrame_Initialize_Offsets - __Pxy_PyFrame_Initialize_Offsets(); + +static void __pyx_tp_dealloc_4ssh2_5utils___pyx_scope_struct__readline(PyObject *o) { + struct __pyx_obj_4ssh2_5utils___pyx_scope_struct__readline *p = (struct __pyx_obj_4ssh2_5utils___pyx_scope_struct__readline *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4ssh2_5utils___pyx_scope_struct__readline) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } #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) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_buf); + Py_CLEAR(p->__pyx_v_data); + Py_CLEAR(p->__pyx_v_line); + Py_CLEAR(p->__pyx_v_remainder); + Py_CLEAR(p->__pyx_t_0); + #if CYTHON_USE_FREELISTS + if (((int)(__pyx_freecount_4ssh2_5utils___pyx_scope_struct__readline < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4ssh2_5utils___pyx_scope_struct__readline)))) { + __pyx_freelist_4ssh2_5utils___pyx_scope_struct__readline[__pyx_freecount_4ssh2_5utils___pyx_scope_struct__readline++] = ((struct __pyx_obj_4ssh2_5utils___pyx_scope_struct__readline *)o); + } else #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + { + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + } +} + +static int __pyx_tp_traverse_4ssh2_5utils___pyx_scope_struct__readline(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4ssh2_5utils___pyx_scope_struct__readline *p = (struct __pyx_obj_4ssh2_5utils___pyx_scope_struct__readline *)o; + if (p->__pyx_v_buf) { + e = (*v)(p->__pyx_v_buf, a); if (e) return e; + } + if (p->__pyx_v_data) { + e = (*v)(p->__pyx_v_data, a); if (e) return e; + } + if (p->__pyx_v_line) { + e = (*v)(p->__pyx_v_line, a); if (e) return e; + } + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_4ssh2_5utils___pyx_scope_struct__readline_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4ssh2_5utils___pyx_scope_struct__readline}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_4ssh2_5utils___pyx_scope_struct__readline}, + {Py_tp_new, (void *)__pyx_tp_new_4ssh2_5utils___pyx_scope_struct__readline}, + {0, 0}, +}; +static PyType_Spec __pyx_type_4ssh2_5utils___pyx_scope_struct__readline_spec = { + "ssh2.utils.__pyx_scope_struct__readline", + sizeof(struct __pyx_obj_4ssh2_5utils___pyx_scope_struct__readline), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, + __pyx_type_4ssh2_5utils___pyx_scope_struct__readline_slots, +}; +#else + +static PyTypeObject __pyx_type_4ssh2_5utils___pyx_scope_struct__readline = { + PyVarObject_HEAD_INIT(0, 0) + "ssh2.utils.""__pyx_scope_struct__readline", /*tp_name*/ + sizeof(struct __pyx_obj_4ssh2_5utils___pyx_scope_struct__readline), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4ssh2_5utils___pyx_scope_struct__readline, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ #endif - #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #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_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_4ssh2_5utils___pyx_scope_struct__readline, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_4ssh2_5utils___pyx_scope_struct__readline, /*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 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - PyEval_InitThreads(); + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ #endif - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - stringtab_initialized = 1; - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 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_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ #endif - if (__pyx_module_is_main_ssh2__utils) { - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "ssh2.utils")) { - if (unlikely((PyDict_SetItemString(modules, "ssh2.utils", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) - } - } + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global type/function init code ---*/ - (void)__Pyx_modinit_global_init_code(); - (void)__Pyx_modinit_variable_export_code(); - if (unlikely((__Pyx_modinit_function_export_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) - (void)__Pyx_modinit_type_init_code(); - if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) - (void)__Pyx_modinit_variable_import_code(); - (void)__Pyx_modinit_function_import_code(); - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif - /* "ssh2/utils.pyx":17 - * # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * from select import select # <<<<<<<<<<<<<< - * - * from cpython.version cimport PY_MAJOR_VERSION - */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_n_s_select); - __Pyx_GIVEREF(__pyx_n_s_select); - if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_select)) __PYX_ERR(0, 17, __pyx_L1_error); - __pyx_t_3 = __Pyx_Import(__pyx_n_s_select, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_select); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_select, __pyx_t_2) < 0) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) + #define CYTHON_SMALL_CODE __attribute__((cold)) +#else + #define CYTHON_SMALL_CODE +#endif +#endif +/* #### Code section: pystring_table ### */ - /* "ssh2/utils.pyx":22 - * - * from .session cimport Session - * from . import exceptions # <<<<<<<<<<<<<< - * from . cimport c_ssh2 - * from . cimport error_codes - */ - __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 22, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_n_s_exceptions); - __Pyx_GIVEREF(__pyx_n_s_exceptions); - if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_exceptions)) __PYX_ERR(0, 22, __pyx_L1_error); - __pyx_t_2 = __Pyx_Import(__pyx_n_s__2, __pyx_t_3, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 22, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_exceptions, __pyx_t_3) < 0) __PYX_ERR(0, 22, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; +static int __Pyx_CreateStringTabAndInitStrings(void) { + __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_Any, __pyx_k_Any, sizeof(__pyx_k_Any), 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}, + {&__pyx_n_s_BannerRecvError, __pyx_k_BannerRecvError, sizeof(__pyx_k_BannerRecvError), 0, 0, 1, 1}, + {&__pyx_n_s_BannerSendError, __pyx_k_BannerSendError, sizeof(__pyx_k_BannerSendError), 0, 0, 1, 1}, + {&__pyx_n_s_BinaryIO, __pyx_k_BinaryIO, sizeof(__pyx_k_BinaryIO), 0, 0, 1, 1}, + {&__pyx_n_s_BufferTooSmallError, __pyx_k_BufferTooSmallError, sizeof(__pyx_k_BufferTooSmallError), 0, 0, 1, 1}, + {&__pyx_n_s_ChannelClosedError, __pyx_k_ChannelClosedError, sizeof(__pyx_k_ChannelClosedError), 0, 0, 1, 1}, + {&__pyx_n_s_ChannelEOFSentError, __pyx_k_ChannelEOFSentError, sizeof(__pyx_k_ChannelEOFSentError), 0, 0, 1, 1}, + {&__pyx_n_s_ChannelFailure, __pyx_k_ChannelFailure, sizeof(__pyx_k_ChannelFailure), 0, 0, 1, 1}, + {&__pyx_n_s_ChannelOutOfOrderError, __pyx_k_ChannelOutOfOrderError, sizeof(__pyx_k_ChannelOutOfOrderError), 0, 0, 1, 1}, + {&__pyx_n_s_ChannelPacketExceeded, __pyx_k_ChannelPacketExceeded, sizeof(__pyx_k_ChannelPacketExceeded), 0, 0, 1, 1}, + {&__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}, + {&__pyx_n_s_EncryptError, __pyx_k_EncryptError, sizeof(__pyx_k_EncryptError), 0, 0, 1, 1}, + {&__pyx_kp_u_Error_code_s_not_known, __pyx_k_Error_code_s_not_known, sizeof(__pyx_k_Error_code_s_not_known), 0, 1, 0, 0}, + {&__pyx_n_s_FileError, __pyx_k_FileError, sizeof(__pyx_k_FileError), 0, 0, 1, 1}, + {&__pyx_n_s_Generator, __pyx_k_Generator, sizeof(__pyx_k_Generator), 0, 0, 1, 1}, + {&__pyx_kp_s_Generator_bytes, __pyx_k_Generator_bytes, sizeof(__pyx_k_Generator_bytes), 0, 0, 1, 0}, + {&__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_Iterable, __pyx_k_Iterable, sizeof(__pyx_k_Iterable), 0, 0, 1, 1}, + {&__pyx_kp_s_Iterable_bytes, __pyx_k_Iterable_bytes, sizeof(__pyx_k_Iterable_bytes), 0, 0, 1, 0}, + {&__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}, + {&__pyx_n_s_None, __pyx_k_None, sizeof(__pyx_k_None), 0, 0, 1, 1}, + {&__pyx_n_s_OutOfBoundaryError, __pyx_k_OutOfBoundaryError, sizeof(__pyx_k_OutOfBoundaryError), 0, 0, 1, 1}, + {&__pyx_n_s_PasswordExpiredError, __pyx_k_PasswordExpiredError, sizeof(__pyx_k_PasswordExpiredError), 0, 0, 1, 1}, + {&__pyx_n_s_ProtocolError, __pyx_k_ProtocolError, sizeof(__pyx_k_ProtocolError), 0, 0, 1, 1}, + {&__pyx_n_s_PublicKeyProtocolError, __pyx_k_PublicKeyProtocolError, sizeof(__pyx_k_PublicKeyProtocolError), 0, 0, 1, 1}, + {&__pyx_n_s_PublickeyUnverifiedError, __pyx_k_PublickeyUnverifiedError, sizeof(__pyx_k_PublickeyUnverifiedError), 0, 0, 1, 1}, + {&__pyx_n_s_Py_ssize_t, __pyx_k_Py_ssize_t, sizeof(__pyx_k_Py_ssize_t), 0, 0, 1, 1}, + {&__pyx_n_s_RequestDeniedError, __pyx_k_RequestDeniedError, sizeof(__pyx_k_RequestDeniedError), 0, 0, 1, 1}, + {&__pyx_n_s_SCPProtocolError, __pyx_k_SCPProtocolError, sizeof(__pyx_k_SCPProtocolError), 0, 0, 1, 1}, + {&__pyx_n_s_SFTPProtocolError, __pyx_k_SFTPProtocolError, sizeof(__pyx_k_SFTPProtocolError), 0, 0, 1, 1}, + {&__pyx_n_s_SSH2Error, __pyx_k_SSH2Error, sizeof(__pyx_k_SSH2Error), 0, 0, 1, 1}, + {&__pyx_n_s_SocketDisconnectError, __pyx_k_SocketDisconnectError, sizeof(__pyx_k_SocketDisconnectError), 0, 0, 1, 1}, + {&__pyx_n_s_SocketRecvError, __pyx_k_SocketRecvError, sizeof(__pyx_k_SocketRecvError), 0, 0, 1, 1}, + {&__pyx_n_s_SocketSendError, __pyx_k_SocketSendError, sizeof(__pyx_k_SocketSendError), 0, 0, 1, 1}, + {&__pyx_n_s_SocketTimeout, __pyx_k_SocketTimeout, sizeof(__pyx_k_SocketTimeout), 0, 0, 1, 1}, + {&__pyx_n_s_Timeout, __pyx_k_Timeout, sizeof(__pyx_k_Timeout), 0, 0, 1, 1}, + {&__pyx_n_s_Tuple, __pyx_k_Tuple, sizeof(__pyx_k_Tuple), 0, 0, 1, 1}, + {&__pyx_n_s_UnknownError, __pyx_k_UnknownError, sizeof(__pyx_k_UnknownError), 0, 0, 1, 1}, + {&__pyx_n_s_ZlibError, __pyx_k_ZlibError, sizeof(__pyx_k_ZlibError), 0, 0, 1, 1}, + {&__pyx_n_s__14, __pyx_k__14, sizeof(__pyx_k__14), 0, 0, 1, 1}, + {&__pyx_n_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 1}, + {&__pyx_kp_b__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 0, 0}, + {&__pyx_kp_u__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 1, 0, 0}, + {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1}, + {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, + {&__pyx_n_s_block_directions, __pyx_k_block_directions, sizeof(__pyx_k_block_directions), 0, 0, 1, 1}, + {&__pyx_n_s_buf, __pyx_k_buf, sizeof(__pyx_k_buf), 0, 0, 1, 1}, + {&__pyx_n_s_bytes, __pyx_k_bytes, sizeof(__pyx_k_bytes), 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_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1}, + {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1}, + {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1}, + {&__pyx_n_s_directions, __pyx_k_directions, sizeof(__pyx_k_directions), 0, 0, 1, 1}, + {&__pyx_kp_u_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0}, + {&__pyx_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0}, + {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, + {&__pyx_n_s_end_of_line, __pyx_k_end_of_line, sizeof(__pyx_k_end_of_line), 0, 0, 1, 1}, + {&__pyx_n_s_errcode, __pyx_k_errcode, sizeof(__pyx_k_errcode), 0, 0, 1, 1}, + {&__pyx_n_s_exceptions, __pyx_k_exceptions, sizeof(__pyx_k_exceptions), 0, 0, 1, 1}, + {&__pyx_n_s_find_eol, __pyx_k_find_eol, sizeof(__pyx_k_find_eol), 0, 0, 1, 1}, + {&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0}, + {&__pyx_n_s_handle_error_codes, __pyx_k_handle_error_codes, sizeof(__pyx_k_handle_error_codes), 0, 0, 1, 1}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_int, __pyx_k_int, sizeof(__pyx_k_int), 0, 0, 1, 1}, + {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, + {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0}, + {&__pyx_n_s_line, __pyx_k_line, sizeof(__pyx_k_line), 0, 0, 1, 1}, + {&__pyx_n_s_linesep, __pyx_k_linesep, sizeof(__pyx_k_linesep), 0, 0, 1, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_n_s_new_line_pos, __pyx_k_new_line_pos, sizeof(__pyx_k_new_line_pos), 0, 0, 1, 1}, + {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1}, + {&__pyx_n_s_readfds, __pyx_k_readfds, sizeof(__pyx_k_readfds), 0, 0, 1, 1}, + {&__pyx_n_s_readline, __pyx_k_readline, sizeof(__pyx_k_readline), 0, 0, 1, 1}, + {&__pyx_n_s_remainder, __pyx_k_remainder, sizeof(__pyx_k_remainder), 0, 0, 1, 1}, + {&__pyx_n_s_remainder_len, __pyx_k_remainder_len, sizeof(__pyx_k_remainder_len), 0, 0, 1, 1}, + {&__pyx_n_s_required_version, __pyx_k_required_version, sizeof(__pyx_k_required_version), 0, 0, 1, 1}, + {&__pyx_n_s_return, __pyx_k_return, sizeof(__pyx_k_return), 0, 0, 1, 1}, + {&__pyx_n_s_select, __pyx_k_select, sizeof(__pyx_k_select), 0, 0, 1, 1}, + {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1}, + {&__pyx_n_s_session, __pyx_k_session, sizeof(__pyx_k_session), 0, 0, 1, 1}, + {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, + {&__pyx_n_s_socket, __pyx_k_socket, sizeof(__pyx_k_socket), 0, 0, 1, 1}, + {&__pyx_n_s_ssh2_exit, __pyx_k_ssh2_exit, sizeof(__pyx_k_ssh2_exit), 0, 0, 1, 1}, + {&__pyx_n_s_ssh2_utils, __pyx_k_ssh2_utils, sizeof(__pyx_k_ssh2_utils), 0, 0, 1, 1}, + {&__pyx_kp_s_ssh2_utils_pyx, __pyx_k_ssh2_utils_pyx, sizeof(__pyx_k_ssh2_utils_pyx), 0, 0, 1, 0}, + {&__pyx_n_s_str, __pyx_k_str, sizeof(__pyx_k_str), 0, 0, 1, 1}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1}, + {&__pyx_n_s_timeout, __pyx_k_timeout, sizeof(__pyx_k_timeout), 0, 0, 1, 1}, + {&__pyx_n_s_typing, __pyx_k_typing, sizeof(__pyx_k_typing), 0, 0, 1, 1}, + {&__pyx_kp_u_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 1, 0, 0}, + {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1}, + {&__pyx_n_s_wait_socket, __pyx_k_wait_socket, sizeof(__pyx_k_wait_socket), 0, 0, 1, 1}, + {&__pyx_n_s_writefds, __pyx_k_writefds, sizeof(__pyx_k_writefds), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} + }; + return __Pyx_InitStrings(__pyx_string_tab); +} +/* #### Code section: cached_builtins ### */ +static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { + return 0; +} +/* #### Code section: cached_constants ### */ - /* "ssh2/utils.pyx":27 - * - * - * ENCODING='utf-8' # <<<<<<<<<<<<<< +static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "ssh2/utils.pyx":52 * * + * cpdef (int, int) find_eol(bytes buf: bytes, Py_ssize_t pos: Py_ssize_t): # <<<<<<<<<<<<<< + * """Find end-of-line in buffer from position and return end position of + * line and where next find_eol should start from. */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_ENCODING, __pyx_kp_u_utf_8) < 0) __PYX_ERR(0, 27, __pyx_L1_error) + __pyx_tuple__4 = PyTuple_Pack(2, __pyx_n_s_buf, __pyx_n_s_pos); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_GIVEREF(__pyx_tuple__4); + __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_utils_pyx, __pyx_n_s_find_eol, 52, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 52, __pyx_L1_error) - /* "ssh2/utils.pyx":51 + /* "ssh2/utils.pyx":79 * * - * def find_eol(bytes buf, Py_ssize_t pos): # <<<<<<<<<<<<<< - * """Find end-of-line in buffer from position and return end position of - * line and where next find_eol should start from. + * def readline(buf: Iterable[bytes]) -> Generator[bytes]: # <<<<<<<<<<<<<< + * """Returns a generator of line by line output in given iterable buffer. + * */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_5utils_1find_eol, 0, __pyx_n_s_find_eol, NULL, __pyx_n_s_ssh2_utils, __pyx_d, ((PyObject *)__pyx_codeobj__4)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_find_eol, __pyx_t_2) < 0) __PYX_ERR(0, 51, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_tuple__6 = PyTuple_Pack(10, __pyx_n_s_buf, __pyx_n_s_pos, __pyx_n_s_size, __pyx_n_s_remainder, __pyx_n_s_remainder_len, __pyx_n_s_linesep, __pyx_n_s_new_line_pos, __pyx_n_s_data, __pyx_n_s_end_of_line, __pyx_n_s_line); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__6); + __Pyx_GIVEREF(__pyx_tuple__6); + __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_utils_pyx, __pyx_n_s_readline, 79, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 79, __pyx_L1_error) - /* "ssh2/utils.pyx":78 + /* "ssh2/utils.pyx":113 * * - * def version(int required_version=0): # <<<<<<<<<<<<<< + * def version(int required_version=0) -> str: # <<<<<<<<<<<<<< * """Get libssh2 version string. * */ - __pyx_t_2 = __Pyx_PyInt_From_int(((int)0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_5utils_3version, 0, __pyx_n_s_version, NULL, __pyx_n_s_ssh2_utils, __pyx_d, ((PyObject *)__pyx_codeobj__6)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_t_2) < 0) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_tuple__7 = PyTuple_Pack(2, __pyx_n_s_required_version, __pyx_n_s_version); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 113, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); + __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_utils_pyx, __pyx_n_s_version, 113, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 113, __pyx_L1_error) - /* "ssh2/utils.pyx":95 + /* "ssh2/utils.pyx":130 * * - * def ssh2_exit(): # <<<<<<<<<<<<<< + * def ssh2_exit() -> None: # <<<<<<<<<<<<<< * """Call libssh2_exit""" * c_ssh2.libssh2_exit() */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_5utils_5ssh2_exit, 0, __pyx_n_s_ssh2_exit, NULL, __pyx_n_s_ssh2_utils, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_ssh2_exit, __pyx_t_2) < 0) __PYX_ERR(0, 95, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(0, 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_utils_pyx, __pyx_n_s_ssh2_exit, 130, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 130, __pyx_L1_error) - /* "ssh2/utils.pyx":100 + /* "ssh2/utils.pyx":135 * * - * def wait_socket(_socket not None, Session session, timeout=1): # <<<<<<<<<<<<<< + * def wait_socket(_socket not None: BinaryIO, Session session, timeout: int=1) -> None: # <<<<<<<<<<<<<< * """Helper function for testing non-blocking mode. * */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_5utils_7wait_socket, 0, __pyx_n_s_wait_socket, NULL, __pyx_n_s_ssh2_utils, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__10); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_wait_socket, __pyx_t_2) < 0) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_tuple__10 = PyTuple_Pack(6, __pyx_n_s_socket, __pyx_n_s_session, __pyx_n_s_timeout, __pyx_n_s_directions, __pyx_n_s_readfds, __pyx_n_s_writefds); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 135, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); + __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_utils_pyx, __pyx_n_s_wait_socket, 135, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 135, __pyx_L1_error) - /* "ssh2/utils.pyx":116 + /* "ssh2/utils.pyx":151 * * * cpdef int handle_error_codes(int errcode) except -1: # <<<<<<<<<<<<<< * """Raise appropriate exception for given error code. * */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_5utils_9handle_error_codes, 0, __pyx_n_s_handle_error_codes, NULL, __pyx_n_s_ssh2_utils, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_handle_error_codes, __pyx_t_2) < 0) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "ssh2/utils.pyx":1 - * # This file is part of ssh2-python. # <<<<<<<<<<<<<< - * # 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_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /*--- Wrapped vars code ---*/ - - goto __pyx_L0; + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_errcode); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); + __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ssh2_utils_pyx, __pyx_n_s_handle_error_codes, 151, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_RefNannyFinishContext(); + return 0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - if (__pyx_m) { - if (__pyx_d && stringtab_initialized) { - __Pyx_AddTraceback("init ssh2.utils", __pyx_clineno, __pyx_lineno, __pyx_filename); - } - #if !CYTHON_USE_MODULE_STATE - Py_CLEAR(__pyx_m); - #else - Py_DECREF(__pyx_m); - if (pystate_addmodule_run) { - PyObject *tp, *value, *tb; - PyErr_Fetch(&tp, &value, &tb); - PyState_RemoveModule(&__pyx_moduledef); - PyErr_Restore(tp, value, tb); - } - #endif - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init ssh2.utils"); - } - __pyx_L0:; __Pyx_RefNannyFinishContext(); - #if CYTHON_PEP489_MULTI_PHASE_INIT - return (__pyx_m != NULL) ? 0 : -1; - #elif PY_MAJOR_VERSION >= 3 - return __pyx_m; - #else - return; - #endif + return -1; } -/* #### Code section: cleanup_globals ### */ -/* #### Code section: cleanup_module ### */ -/* #### Code section: main_method ### */ -/* #### Code section: utility_code_pragmas ### */ -#ifdef _MSC_VER -#pragma warning( push ) -/* Warning 4127: conditional expression is constant - * Cython uses constant conditional expressions to allow in inline functions to be optimized at - * compile-time, so this warning is not useful - */ -#pragma warning( disable : 4127 ) -#endif - - +/* #### Code section: init_constants ### */ -/* #### Code section: utility_code_def ### */ +static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { + if (__Pyx_CreateStringTabAndInitStrings() < 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) + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_globals ### */ -/* --- Runtime support code --- */ -/* Refnanny */ -#if CYTHON_REFNANNY -static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule(modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, "RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); -end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { + return 0; } -#endif +/* #### Code section: init_module ### */ -/* RaiseUnexpectedTypeError */ -static int -__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) -{ - __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); - PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, - expected, obj_type_name); - __Pyx_DECREF_TypeName(obj_type_name); - return 0; -} +static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ -/* PyObjectGetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); +static int __Pyx_modinit_global_init_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); + /*--- Global init code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; } -#endif -/* PyErrExceptionMatches */ -#if CYTHON_FAST_THREAD_STATE -static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; i= 0x030C00A6 - PyObject *current_exception = tstate->current_exception; - if (unlikely(!current_exception)) return 0; - exc_type = (PyObject*) Py_TYPE(current_exception); - if (exc_type == err) return 1; -#else - exc_type = tstate->curexc_type; - if (exc_type == err) return 1; - if (unlikely(!exc_type)) return 0; -#endif - #if CYTHON_AVOID_BORROWED_REFS - Py_INCREF(exc_type); - #endif - if (unlikely(PyTuple_Check(err))) { - result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); - } else { - result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); - } - #if CYTHON_AVOID_BORROWED_REFS - Py_DECREF(exc_type); - #endif - return result; + +static int __Pyx_modinit_function_export_code(void) { + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); + /*--- Function export code ---*/ + if (__Pyx_ExportFunction("to_bytes", (void (*)(void))__pyx_f_4ssh2_5utils_to_bytes, "PyObject *(PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("to_str", (void (*)(void))__pyx_f_4ssh2_5utils_to_str, "PyObject *(char *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("to_str_len", (void (*)(void))__pyx_f_4ssh2_5utils_to_str_len, "PyObject *(char *, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("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_ExportFunction("find_eol", (void (*)(void))__pyx_f_4ssh2_5utils_find_eol, "__pyx_ctuple_int__and_int (PyObject *, Py_ssize_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; } -#endif -/* PyErrFetchRestore */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { -#if PY_VERSION_HEX >= 0x030C00A6 - PyObject *tmp_value; - assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); - if (value) { - #if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) - #endif - PyException_SetTraceback(value, tb); - } - tmp_value = tstate->current_exception; - tstate->current_exception = value; - Py_XDECREF(tmp_value); - Py_XDECREF(type); - Py_XDECREF(tb); -#else - 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); -#endif +static int __Pyx_modinit_type_init_code(void) { + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + #if CYTHON_USE_TYPE_SPECS + __pyx_ptype_4ssh2_5utils___pyx_scope_struct__readline = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4ssh2_5utils___pyx_scope_struct__readline_spec, NULL); if (unlikely(!__pyx_ptype_4ssh2_5utils___pyx_scope_struct__readline)) __PYX_ERR(0, 79, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4ssh2_5utils___pyx_scope_struct__readline_spec, __pyx_ptype_4ssh2_5utils___pyx_scope_struct__readline) < 0) __PYX_ERR(0, 79, __pyx_L1_error) + #else + __pyx_ptype_4ssh2_5utils___pyx_scope_struct__readline = &__pyx_type_4ssh2_5utils___pyx_scope_struct__readline; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_ptype_4ssh2_5utils___pyx_scope_struct__readline) < 0) __PYX_ERR(0, 79, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_ptype_4ssh2_5utils___pyx_scope_struct__readline->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4ssh2_5utils___pyx_scope_struct__readline->tp_dictoffset && __pyx_ptype_4ssh2_5utils___pyx_scope_struct__readline->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_4ssh2_5utils___pyx_scope_struct__readline->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + } + #endif + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; } -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { -#if PY_VERSION_HEX >= 0x030C00A6 - PyObject* exc_value; - exc_value = tstate->current_exception; - tstate->current_exception = 0; - *value = exc_value; - *type = NULL; - *tb = NULL; - if (exc_value) { - *type = (PyObject*) Py_TYPE(exc_value); - Py_INCREF(*type); - #if CYTHON_COMPILING_IN_CPYTHON - *tb = ((PyBaseExceptionObject*) exc_value)->traceback; - Py_XINCREF(*tb); - #else - *tb = PyException_GetTraceback(exc_value); - #endif - } -#else - *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 + +static int __Pyx_modinit_type_import_code(void) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __pyx_t_1 = PyImport_ImportModule("ssh2.session"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_ptype_4ssh2_7session_Session = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.session", "Session", sizeof(struct __pyx_obj_4ssh2_7session_Session), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_7session_Session),__Pyx_ImportType_CheckSize_Warn_3_0_12); if (!__pyx_ptype_4ssh2_7session_Session) __PYX_ERR(1, 19, __pyx_L1_error) + __pyx_ptype_4ssh2_7session_MethodType = __Pyx_ImportType_3_0_12(__pyx_t_1, "ssh2.session", "MethodType", sizeof(struct __pyx_obj_4ssh2_7session_MethodType), __PYX_GET_STRUCT_ALIGNMENT_3_0_12(struct __pyx_obj_4ssh2_7session_MethodType),__Pyx_ImportType_CheckSize_Warn_3_0_12); 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; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; } -#endif -/* PyObjectGetAttrStrNoError */ -#if __PYX_LIMITED_VERSION_HEX < 0x030d00A1 -static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - __Pyx_PyErr_Clear(); +static int __Pyx_modinit_variable_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; } -#endif -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { - PyObject *result; -#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1 - (void) PyObject_GetOptionalAttr(obj, attr_name, &result); - return result; -#else -#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { - return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); - } -#endif - result = __Pyx_PyObject_GetAttrStr(obj, attr_name); - if (unlikely(!result)) { - __Pyx_PyObject_GetAttrStr_ClearAttributeError(); - } - return result; -#endif + +static int __Pyx_modinit_function_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); + /*--- Function import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; } -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); - if (unlikely(!result) && !PyErr_Occurred()) { - PyErr_Format(PyExc_NameError, + #if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_utils(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_utils}, + {0, NULL} +}; #endif - } - return result; -} -/* PyDictVersioning */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { - PyObject **dictptr = NULL; - Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; - if (offset) { -#if CYTHON_COMPILING_IN_CPYTHON - dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); -#else - dictptr = _PyObject_GetDictPtr(obj); +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "utils", + 0, /* m_doc */ + #if CYTHON_PEP489_MULTI_PHASE_INIT + 0, /* m_size */ + #elif CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstate), /* m_size */ + #else + -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #if CYTHON_USE_MODULE_STATE + __pyx_m_traverse, /* m_traverse */ + __pyx_m_clear, /* m_clear */ + NULL /* m_free */ + #else + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + #endif + }; + #ifdef __cplusplus +} /* anonymous namespace */ #endif - } - return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; -} -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) - return 0; - return obj_dict_version == __Pyx_get_object_dict_version(obj); -} #endif -/* GetModuleGlobalName */ -#if CYTHON_USE_DICT_VERSIONS -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#ifndef CYTHON_NO_PYINIT_EXPORT +#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#elif PY_MAJOR_VERSION < 3 +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" void #else -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#define __Pyx_PyMODINIT_FUNC void #endif -{ - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && PY_VERSION_HEX < 0x030d0000 - result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } else if (unlikely(PyErr_Occurred())) { - return NULL; - } -#elif CYTHON_COMPILING_IN_LIMITED_API - if (unlikely(!__pyx_m)) { - return NULL; - } - result = PyObject_GetAttr(__pyx_m, name); - if (likely(result)) { - return result; - } #else - result = PyDict_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } -#endif +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * #else - result = PyObject_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } - PyErr_Clear(); +#define __Pyx_PyMODINIT_FUNC PyObject * +#endif #endif - return __Pyx_GetBuiltinName(name); -} -/* PyFunctionFastCall */ -#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; - } - fastlocals = __Pyx_PyFrame_GetLocalsplus(f); - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; - } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; + +#if PY_MAJOR_VERSION < 3 +__Pyx_PyMODINIT_FUNC initutils(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC initutils(void) +#else +__Pyx_PyMODINIT_FUNC PyInit_utils(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_utils(void) +#if CYTHON_PEP489_MULTI_PHASE_INIT +{ + return PyModuleDef_Init(&__pyx_moduledef); } -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; -#endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; - #if PY_MAJOR_VERSION < 3 - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) { - return NULL; - } +static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { + #if PY_VERSION_HEX >= 0x030700A1 + static PY_INT64_T main_interpreter_id = -1; + PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); + if (main_interpreter_id == -1) { + main_interpreter_id = current_id; + return (unlikely(current_id == -1)) ? -1 : 0; + } else if (unlikely(main_interpreter_id != current_id)) #else - if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) { - return NULL; - } + static PyInterpreterState *main_interpreter = NULL; + PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; + if (!main_interpreter) { + main_interpreter = current_interpreter; + } else if (unlikely(main_interpreter != current_interpreter)) #endif - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && -#endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; - } - } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; - } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; - } - nk = i / 2; - } - else { - kwtuple = NULL; - k = NULL; - } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); - } - else { - d = NULL; - nd = 0; + { + PyErr_SetString( + PyExc_ImportError, + "Interpreter change detected - this module can only be loaded into one interpreter per process."); + return -1; } -#if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); + return 0; +} +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) #else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, closure); +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) #endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; -} +{ + PyObject *value = PyObject_GetAttrString(spec, from_name); + int result = 0; + if (likely(value)) { + if (allow_none || value != Py_None) { +#if CYTHON_COMPILING_IN_LIMITED_API + result = PyModule_AddObject(module, to_name, value); +#else + result = PyDict_SetItemString(moddict, to_name, value); #endif - -/* PyObjectCall */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = Py_TYPE(func)->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - #if PY_MAJOR_VERSION < 3 - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - #else - if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) - return NULL; - #endif - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); + } + Py_DECREF(value); + } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + } else { + result = -1; } return result; } -#endif - -/* PyObjectCallMethO */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func); - self = __Pyx_CyOrPyCFunction_GET_SELF(func); - #if PY_MAJOR_VERSION < 3 - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - #else - if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { + PyObject *module = NULL, *moddict, *modname; + CYTHON_UNUSED_VAR(def); + if (__Pyx_check_single_interpreter()) return NULL; - #endif - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} + if (__pyx_m) + return __Pyx_NewRef(__pyx_m); + modname = PyObject_GetAttrString(spec, "name"); + if (unlikely(!modname)) goto bad; + module = PyModule_NewObject(modname); + Py_DECREF(modname); + if (unlikely(!module)) goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + moddict = module; +#else + moddict = PyModule_GetDict(module); + if (unlikely(!moddict)) goto bad; #endif - -/* PyObjectFastCall */ -#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API -static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) { - PyObject *argstuple; - PyObject *result = 0; - size_t i; - argstuple = PyTuple_New((Py_ssize_t)nargs); - if (unlikely(!argstuple)) return NULL; - for (i = 0; i < nargs; i++) { - Py_INCREF(args[i]); - if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad; - } - result = __Pyx_PyObject_Call(func, argstuple, kwargs); - bad: - Py_DECREF(argstuple); - return result; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; + return module; +bad: + Py_XDECREF(module); + return NULL; } + + +static CYTHON_SMALL_CODE int __pyx_pymod_exec_utils(PyObject *__pyx_pyinit_module) #endif -static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) { - Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); -#if CYTHON_COMPILING_IN_CPYTHON - if (nargs == 0 && kwargs == NULL) { - if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS)) - return __Pyx_PyObject_CallMethO(func, NULL); - } - else if (nargs == 1 && kwargs == NULL) { - if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O)) - return __Pyx_PyObject_CallMethO(func, args[0]); - } #endif - #if PY_VERSION_HEX < 0x030800B1 - #if CYTHON_FAST_PYCCALL - if (PyCFunction_Check(func)) { - if (kwargs) { - return _PyCFunction_FastCallDict(func, args, nargs, kwargs); - } else { - return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); - } - } - #if PY_VERSION_HEX >= 0x030700A1 - if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { - return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); - } - #endif - #endif - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); - } - #endif - #endif - if (kwargs == NULL) { - #if CYTHON_VECTORCALL - #if PY_VERSION_HEX < 0x03090000 - vectorcallfunc f = _PyVectorcall_Function(func); - #else - vectorcallfunc f = PyVectorcall_Function(func); - #endif - if (f) { - return f(func, args, (size_t)nargs, NULL); - } - #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL - if (__Pyx_CyFunction_CheckExact(func)) { - __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); - if (f) return f(func, args, (size_t)nargs, NULL); - } - #endif - } - if (nargs == 0) { - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs); - } - #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API - return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs); - #else - return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); - #endif -} - -/* TupleAndListFromArray */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { - PyObject *v; - Py_ssize_t i; - for (i = 0; i < length; i++) { - v = dest[i] = src[i]; - Py_INCREF(v); - } -} -static CYTHON_INLINE PyObject * -__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) -{ - PyObject *res; - if (n <= 0) { - Py_INCREF(__pyx_empty_tuple); - return __pyx_empty_tuple; - } - res = PyTuple_New(n); - if (unlikely(res == NULL)) return NULL; - __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); - return res; -} -static CYTHON_INLINE PyObject * -__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) { - PyObject *res; - if (n <= 0) { - return PyList_New(0); - } - res = PyList_New(n); - if (unlikely(res == NULL)) return NULL; - __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); - return res; + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_PEP489_MULTI_PHASE_INIT + if (__pyx_m) { + if (__pyx_m == __pyx_pyinit_module) return 0; + PyErr_SetString(PyExc_RuntimeError, "Module 'utils' has already been imported. Re-initialisation is not supported."); + return -1; + } + #elif PY_MAJOR_VERSION >= 3 + if (__pyx_m) return __Pyx_NewRef(__pyx_m); + #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_m = __pyx_pyinit_module; + Py_INCREF(__pyx_m); + #else + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4("utils", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #elif CYTHON_USE_MODULE_STATE + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + { + int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "utils" pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #endif + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_d); + __pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_cython_runtime = __Pyx_PyImport_AddModuleRef((const char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if CYTHON_REFNANNY +__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); +if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); } #endif - -/* BytesEquals */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API - return PyObject_RichCompareBool(s1, s2, equals); -#else - if (s1 == s2) { - return (equals == Py_EQ); - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { - const char *ps1, *ps2; - Py_ssize_t length = PyBytes_GET_SIZE(s1); - if (length != PyBytes_GET_SIZE(s2)) - return (equals == Py_NE); - ps1 = PyBytes_AS_STRING(s1); - ps2 = PyBytes_AS_STRING(s2); + __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_utils(void)", 0); + if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < 0) __PYX_ERR(0, 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) + #ifdef __Pyx_CyFunction_USED + if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Coroutine_USED + if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_StopAsyncIteration_USED + if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + PyEval_InitThreads(); + #endif + /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + stringtab_initialized = 1; + if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 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) + #endif + if (__pyx_module_is_main_ssh2__utils) { + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + } + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "ssh2.utils")) { + if (unlikely((PyDict_SetItemString(modules, "ssh2.utils", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #endif + /*--- Builtin init code ---*/ + if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Constants init code ---*/ + if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Global type/function init code ---*/ + (void)__Pyx_modinit_global_init_code(); + (void)__Pyx_modinit_variable_export_code(); + if (unlikely((__Pyx_modinit_function_export_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + 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) + (void)__Pyx_modinit_variable_import_code(); + (void)__Pyx_modinit_function_import_code(); + /*--- Execution code ---*/ + #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + + /* "ssh2/utils.pyx":17 + * # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * from select import select # <<<<<<<<<<<<<< + * from typing import Any, BinaryIO, Iterable, Tuple, Generator + * + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_n_s_select); + __Pyx_GIVEREF(__pyx_n_s_select); + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_select)) __PYX_ERR(0, 17, __pyx_L1_error); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_select, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_select); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_select, __pyx_t_2) < 0) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "ssh2/utils.pyx":18 + * + * from select import select + * from typing import Any, BinaryIO, Iterable, Tuple, Generator # <<<<<<<<<<<<<< + * + * from cpython.version cimport PY_MAJOR_VERSION + */ + __pyx_t_3 = PyList_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_n_s_Any); + __Pyx_GIVEREF(__pyx_n_s_Any); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_Any)) __PYX_ERR(0, 18, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_BinaryIO); + __Pyx_GIVEREF(__pyx_n_s_BinaryIO); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_BinaryIO)) __PYX_ERR(0, 18, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_Iterable); + __Pyx_GIVEREF(__pyx_n_s_Iterable); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 2, __pyx_n_s_Iterable)) __PYX_ERR(0, 18, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_Tuple); + __Pyx_GIVEREF(__pyx_n_s_Tuple); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 3, __pyx_n_s_Tuple)) __PYX_ERR(0, 18, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_Generator); + __Pyx_GIVEREF(__pyx_n_s_Generator); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 4, __pyx_n_s_Generator)) __PYX_ERR(0, 18, __pyx_L1_error); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_typing, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Any); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Any, __pyx_t_3) < 0) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_BinaryIO); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_BinaryIO, __pyx_t_3) < 0) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Iterable); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Iterable, __pyx_t_3) < 0) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Tuple); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Tuple, __pyx_t_3) < 0) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Generator); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Generator, __pyx_t_3) < 0) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "ssh2/utils.pyx":23 + * + * from .session cimport Session + * from . import exceptions # <<<<<<<<<<<<<< + * from . cimport c_ssh2 + * from . cimport error_codes + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_n_s_exceptions); + __Pyx_GIVEREF(__pyx_n_s_exceptions); + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_exceptions)) __PYX_ERR(0, 23, __pyx_L1_error); + __pyx_t_3 = __Pyx_Import(__pyx_n_s__2, __pyx_t_2, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_exceptions, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "ssh2/utils.pyx":28 + * + * + * ENCODING='utf-8' # <<<<<<<<<<<<<< + * + * + */ + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ENCODING, __pyx_kp_u_utf_8) < 0) __PYX_ERR(0, 28, __pyx_L1_error) + + /* "ssh2/utils.pyx":52 + * + * + * cpdef (int, int) find_eol(bytes buf: bytes, Py_ssize_t pos: Py_ssize_t): # <<<<<<<<<<<<<< + * """Find end-of-line in buffer from position and return end position of + * line and where next find_eol should start from. + */ + __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_buf, __pyx_n_s_bytes) < 0) __PYX_ERR(0, 52, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_pos, __pyx_n_s_Py_ssize_t) < 0) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_5utils_1find_eol, 0, __pyx_n_s_find_eol, NULL, __pyx_n_s_ssh2_utils, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_find_eol, __pyx_t_2) < 0) __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "ssh2/utils.pyx":79 + * + * + * def readline(buf: Iterable[bytes]) -> Generator[bytes]: # <<<<<<<<<<<<<< + * """Returns a generator of line by line output in given iterable buffer. + * + */ + __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_buf, __pyx_kp_s_Iterable_bytes) < 0) __PYX_ERR(0, 79, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_kp_s_Generator_bytes) < 0) __PYX_ERR(0, 79, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_5utils_3readline, 0, __pyx_n_s_readline, NULL, __pyx_n_s_ssh2_utils, __pyx_d, ((PyObject *)__pyx_codeobj_)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_readline, __pyx_t_3) < 0) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "ssh2/utils.pyx":113 + * + * + * def version(int required_version=0) -> str: # <<<<<<<<<<<<<< + * """Get libssh2 version string. + * + */ + __pyx_t_3 = __Pyx_PyInt_From_int(((int)0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_s_str) < 0) __PYX_ERR(0, 113, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_5utils_6version, 0, __pyx_n_s_version, NULL, __pyx_n_s_ssh2_utils, __pyx_d, ((PyObject *)__pyx_codeobj__8)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 113, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_2); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_t_4) < 0) __PYX_ERR(0, 113, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "ssh2/utils.pyx":130 + * + * + * def ssh2_exit() -> None: # <<<<<<<<<<<<<< + * """Call libssh2_exit""" + * c_ssh2.libssh2_exit() + */ + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_n_s_None) < 0) __PYX_ERR(0, 130, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_5utils_8ssh2_exit, 0, __pyx_n_s_ssh2_exit, NULL, __pyx_n_s_ssh2_utils, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ssh2_exit, __pyx_t_3) < 0) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "ssh2/utils.pyx":135 + * + * + * def wait_socket(_socket not None: BinaryIO, Session session, timeout: int=1) -> None: # <<<<<<<<<<<<<< + * """Helper function for testing non-blocking mode. + * + */ + __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 135, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_socket, __pyx_n_s_BinaryIO) < 0) __PYX_ERR(0, 135, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_timeout, __pyx_n_s_int) < 0) __PYX_ERR(0, 135, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_s_None) < 0) __PYX_ERR(0, 135, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_5utils_10wait_socket, 0, __pyx_n_s_wait_socket, NULL, __pyx_n_s_ssh2_utils, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 135, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (!__Pyx_CyFunction_InitDefaults(__pyx_t_4, sizeof(__pyx_defaults), 1)) __PYX_ERR(0, 135, __pyx_L1_error) + if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_int_1)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_int_1))) __PYX_ERR(0, 135, __pyx_L1_error) + __Pyx_INCREF(__pyx_int_1); + __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_4)->__pyx_arg_timeout = ((PyObject*)__pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_4, __pyx_pf_4ssh2_5utils_13__defaults__); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_wait_socket, __pyx_t_4) < 0) __PYX_ERR(0, 135, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "ssh2/utils.pyx":151 + * + * + * cpdef int handle_error_codes(int errcode) except -1: # <<<<<<<<<<<<<< + * """Raise appropriate exception for given error code. + * + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4ssh2_5utils_12handle_error_codes, 0, __pyx_n_s_handle_error_codes, NULL, __pyx_n_s_ssh2_utils, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_handle_error_codes, __pyx_t_4) < 0) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "ssh2/utils.pyx":1 + * # This file is part of ssh2-python. # <<<<<<<<<<<<<< + * # Copyright (C) 2017-2020 Panos Kittenis + * # + */ + __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_4) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + if (__pyx_m) { + if (__pyx_d && stringtab_initialized) { + __Pyx_AddTraceback("init ssh2.utils", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + #if !CYTHON_USE_MODULE_STATE + Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init ssh2.utils"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if CYTHON_PEP489_MULTI_PHASE_INIT + return (__pyx_m != NULL) ? 0 : -1; + #elif PY_MAJOR_VERSION >= 3 + return __pyx_m; + #else + return; + #endif +} +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ + +/* --- Runtime support code --- */ +/* Refnanny */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule(modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, "RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif + +/* RaiseUnexpectedTypeError */ +static int +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) +{ + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* PyObjectGetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* PyErrExceptionMatches */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyErrFetchRestore */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); +#else + 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); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *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 +} +#endif + +/* PyObjectGetAttrStrNoError */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d00A1 +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1 + (void) PyObject_GetOptionalAttr(obj, attr_name, &result); + return result; +#else +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +#endif +} + +/* GetBuiltinName */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%.200s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +/* PyDictVersioning */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ + PyObject *result; +#if !CYTHON_AVOID_BORROWED_REFS +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && PY_VERSION_HEX < 0x030d0000 + result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } else if (unlikely(PyErr_Occurred())) { + return NULL; + } +#elif CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + return NULL; + } + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { + return result; + } +#else + result = PyDict_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } +#endif +#else + result = PyObject_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); +} + +/* PyFunctionFastCall */ +#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL +static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, + PyObject *globals) { + PyFrameObject *f; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject **fastlocals; + Py_ssize_t i; + PyObject *result; + assert(globals != NULL); + /* XXX Perhaps we should create a specialized + PyFrame_New() that doesn't take locals, but does + take builtins without sanity checking them. + */ + assert(tstate != NULL); + f = PyFrame_New(tstate, co, globals, NULL); + if (f == NULL) { + return NULL; + } + fastlocals = __Pyx_PyFrame_GetLocalsplus(f); + for (i = 0; i < na; i++) { + Py_INCREF(*args); + fastlocals[i] = *args++; + } + result = PyEval_EvalFrameEx(f,0); + ++tstate->recursion_depth; + Py_DECREF(f); + --tstate->recursion_depth; + return result; +} +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { + PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); + PyObject *globals = PyFunction_GET_GLOBALS(func); + PyObject *argdefs = PyFunction_GET_DEFAULTS(func); + PyObject *closure; +#if PY_MAJOR_VERSION >= 3 + PyObject *kwdefs; +#endif + PyObject *kwtuple, **k; + PyObject **d; + Py_ssize_t nd; + Py_ssize_t nk; + PyObject *result; + assert(kwargs == NULL || PyDict_Check(kwargs)); + nk = kwargs ? PyDict_Size(kwargs) : 0; + #if PY_MAJOR_VERSION < 3 + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) { + return NULL; + } + #else + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) { + return NULL; + } + #endif + if ( +#if PY_MAJOR_VERSION >= 3 + co->co_kwonlyargcount == 0 && +#endif + likely(kwargs == NULL || nk == 0) && + co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { + if (argdefs == NULL && co->co_argcount == nargs) { + result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); + goto done; + } + else if (nargs == 0 && argdefs != NULL + && co->co_argcount == Py_SIZE(argdefs)) { + /* function called with no arguments, but all parameters have + a default value: use default values as arguments .*/ + args = &PyTuple_GET_ITEM(argdefs, 0); + result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); + goto done; + } + } + if (kwargs != NULL) { + Py_ssize_t pos, i; + kwtuple = PyTuple_New(2 * nk); + if (kwtuple == NULL) { + result = NULL; + goto done; + } + k = &PyTuple_GET_ITEM(kwtuple, 0); + pos = i = 0; + while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { + Py_INCREF(k[i]); + Py_INCREF(k[i+1]); + i += 2; + } + nk = i / 2; + } + else { + kwtuple = NULL; + k = NULL; + } + closure = PyFunction_GET_CLOSURE(func); +#if PY_MAJOR_VERSION >= 3 + kwdefs = PyFunction_GET_KW_DEFAULTS(func); +#endif + if (argdefs != NULL) { + d = &PyTuple_GET_ITEM(argdefs, 0); + nd = Py_SIZE(argdefs); + } + else { + d = NULL; + nd = 0; + } +#if PY_MAJOR_VERSION >= 3 + result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, kwdefs, closure); +#else + result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, closure); +#endif + Py_XDECREF(kwtuple); +done: + Py_LeaveRecursiveCall(); + return result; +} +#endif + +/* PyObjectCall */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = Py_TYPE(func)->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + #if PY_MAJOR_VERSION < 3 + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + #else + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + #endif + 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) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func); + self = __Pyx_CyOrPyCFunction_GET_SELF(func); + #if PY_MAJOR_VERSION < 3 + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + #else + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + #endif + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectFastCall */ +#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result = 0; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad; + } + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + bad: + Py_DECREF(argstuple); + return result; +} +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); +#if CYTHON_COMPILING_IN_CPYTHON + if (nargs == 0 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS)) + return __Pyx_PyObject_CallMethO(func, NULL); + } + else if (nargs == 1 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O)) + return __Pyx_PyObject_CallMethO(func, args[0]); + } +#endif + #if PY_VERSION_HEX < 0x030800B1 + #if CYTHON_FAST_PYCCALL + if (PyCFunction_Check(func)) { + if (kwargs) { + return _PyCFunction_FastCallDict(func, args, nargs, kwargs); + } else { + return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); + } + } + #if PY_VERSION_HEX >= 0x030700A1 + if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { + return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); + } + #endif + #endif + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); + } + #endif + #endif + if (kwargs == NULL) { + #if CYTHON_VECTORCALL + #if PY_VERSION_HEX < 0x03090000 + vectorcallfunc f = _PyVectorcall_Function(func); + #else + vectorcallfunc f = PyVectorcall_Function(func); + #endif + if (f) { + return f(func, args, (size_t)nargs, NULL); + } + #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL + if (__Pyx_CyFunction_CheckExact(func)) { + __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); + if (f) return f(func, args, (size_t)nargs, NULL); + } + #endif + } + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs); + } + #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API + return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs); + #else + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); + #endif +} + +/* TupleAndListFromArray */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { + PyObject *v; + Py_ssize_t i; + for (i = 0; i < length; i++) { + v = dest[i] = src[i]; + Py_INCREF(v); + } +} +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + Py_INCREF(__pyx_empty_tuple); + return __pyx_empty_tuple; + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); + return res; +} +static CYTHON_INLINE PyObject * +__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return PyList_New(0); + } + res = PyList_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); + return res; +} +#endif + +/* BytesEquals */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); if (ps1[0] != ps2[0]) { return (equals == Py_NE); } else if (length == 1) { @@ -7375,57 +8654,286 @@ static int __Pyx_ParseOptionalKeywords( goto invalid_keyword; } } - Py_XDECREF(key); - Py_XDECREF(value); - 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: - #if PY_MAJOR_VERSION < 3 - PyErr_Format(PyExc_TypeError, - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); + Py_XDECREF(key); + Py_XDECREF(value); + 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: + #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + Py_XDECREF(key); + Py_XDECREF(value); + return -1; +} + +/* ArgTypeTest */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) +{ + __Pyx_TypeName type_name; + __Pyx_TypeName obj_type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + else if (exact) { + #if PY_MAJOR_VERSION == 2 + if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + #endif + } + else { + if (likely(__Pyx_TypeCheck(obj, type))) return 1; + } + type_name = __Pyx_PyType_GetName(type); + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME + ", got " __Pyx_FMT_TYPENAME ")", name, type_name, obj_type_name); + __Pyx_DECREF_TypeName(type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* SliceObject */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj, + Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, + int has_cstart, int has_cstop, int wraparound) { + __Pyx_TypeName obj_type_name; +#if CYTHON_USE_TYPE_SLOTS + PyMappingMethods* mp; +#if PY_MAJOR_VERSION < 3 + PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence; + if (likely(ms && ms->sq_slice)) { + if (!has_cstart) { + if (_py_start && (*_py_start != Py_None)) { + cstart = __Pyx_PyIndex_AsSsize_t(*_py_start); + if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; + } else + cstart = 0; + } + if (!has_cstop) { + if (_py_stop && (*_py_stop != Py_None)) { + cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop); + if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; + } else + cstop = PY_SSIZE_T_MAX; + } + if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) { + Py_ssize_t l = ms->sq_length(obj); + if (likely(l >= 0)) { + if (cstop < 0) { + cstop += l; + if (cstop < 0) cstop = 0; + } + if (cstart < 0) { + cstart += l; + if (cstart < 0) cstart = 0; + } + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + goto bad; + PyErr_Clear(); + } + } + return ms->sq_slice(obj, cstart, cstop); + } +#else + CYTHON_UNUSED_VAR(wraparound); +#endif + mp = Py_TYPE(obj)->tp_as_mapping; + if (likely(mp && mp->mp_subscript)) +#else + CYTHON_UNUSED_VAR(wraparound); +#endif + { + PyObject* result; + PyObject *py_slice, *py_start, *py_stop; + if (_py_slice) { + py_slice = *_py_slice; + } else { + PyObject* owned_start = NULL; + PyObject* owned_stop = NULL; + if (_py_start) { + py_start = *_py_start; + } else { + if (has_cstart) { + owned_start = py_start = PyInt_FromSsize_t(cstart); + if (unlikely(!py_start)) goto bad; + } else + py_start = Py_None; + } + if (_py_stop) { + py_stop = *_py_stop; + } else { + if (has_cstop) { + owned_stop = py_stop = PyInt_FromSsize_t(cstop); + if (unlikely(!py_stop)) { + Py_XDECREF(owned_start); + goto bad; + } + } else + py_stop = Py_None; + } + py_slice = PySlice_New(py_start, py_stop, Py_None); + Py_XDECREF(owned_start); + Py_XDECREF(owned_stop); + if (unlikely(!py_slice)) goto bad; + } +#if CYTHON_USE_TYPE_SLOTS + result = mp->mp_subscript(obj, py_slice); +#else + result = PyObject_GetItem(obj, py_slice); +#endif + if (!_py_slice) { + Py_DECREF(py_slice); + } + return result; + } + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is unsliceable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); +bad: + return NULL; +} + +/* GetException */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) +#endif +{ + PyObject *local_type = NULL, *local_value, *local_tb = NULL; +#if CYTHON_FAST_THREAD_STATE + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if PY_VERSION_HEX >= 0x030C00A6 + local_value = tstate->current_exception; + tstate->current_exception = 0; + if (likely(local_value)) { + local_type = (PyObject*) Py_TYPE(local_value); + Py_INCREF(local_type); + local_tb = PyException_GetTraceback(local_value); + } + #else + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + #endif +#else + PyErr_Fetch(&local_type, &local_value, &local_tb); +#endif + PyErr_NormalizeException(&local_type, &local_value, &local_tb); +#if CYTHON_FAST_THREAD_STATE && PY_VERSION_HEX >= 0x030C00A6 + if (unlikely(tstate->current_exception)) +#elif CYTHON_FAST_THREAD_STATE + if (unlikely(tstate->curexc_type)) +#else + if (unlikely(PyErr_Occurred())) +#endif + goto bad; + #if PY_MAJOR_VERSION >= 3 + if (local_tb) { + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + } + #endif + Py_XINCREF(local_tb); + Py_XINCREF(local_type); + Py_XINCREF(local_value); + *type = local_type; + *value = local_value; + *tb = local_tb; +#if CYTHON_FAST_THREAD_STATE + #if CYTHON_USE_EXC_INFO_STACK + { + _PyErr_StackItem *exc_info = tstate->exc_info; + #if PY_VERSION_HEX >= 0x030B00a4 + tmp_value = exc_info->exc_value; + exc_info->exc_value = local_value; + tmp_type = NULL; + tmp_tb = NULL; + Py_XDECREF(local_type); + Py_XDECREF(local_tb); + #else + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = local_type; + exc_info->exc_value = local_value; + exc_info->exc_traceback = local_tb; + #endif + } #else - PyErr_Format(PyExc_TypeError, - "%s() got an unexpected keyword argument '%U'", - function_name, key); + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_SetExcInfo(local_type, local_value, local_tb); +#endif + return 0; bad: - Py_XDECREF(key); - Py_XDECREF(value); + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); return -1; } -/* ArgTypeTest */ -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) -{ - __Pyx_TypeName type_name; - __Pyx_TypeName obj_type_name; - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - else if (exact) { - #if PY_MAJOR_VERSION == 2 - if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; +/* pep479 */ +static void __Pyx_Generator_Replace_StopIteration(int in_async_gen) { + PyObject *exc, *val, *tb, *cur_exc; + __Pyx_PyThreadState_declare + #ifdef __Pyx_StopAsyncIteration_USED + int is_async_stopiteration = 0; + #endif + CYTHON_MAYBE_UNUSED_VAR(in_async_gen); + cur_exc = PyErr_Occurred(); + if (likely(!__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopIteration))) { + #ifdef __Pyx_StopAsyncIteration_USED + if (in_async_gen && unlikely(__Pyx_PyErr_GivenExceptionMatches(cur_exc, __Pyx_PyExc_StopAsyncIteration))) { + is_async_stopiteration = 1; + } else #endif + return; } - else { - if (likely(__Pyx_TypeCheck(obj, type))) return 1; - } - type_name = __Pyx_PyType_GetName(type); - obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME - ", got " __Pyx_FMT_TYPENAME ")", name, type_name, obj_type_name); - __Pyx_DECREF_TypeName(type_name); - __Pyx_DECREF_TypeName(obj_type_name); - return 0; + __Pyx_PyThreadState_assign + __Pyx_GetException(&exc, &val, &tb); + Py_XDECREF(exc); + Py_XDECREF(val); + Py_XDECREF(tb); + PyErr_SetString(PyExc_RuntimeError, + #ifdef __Pyx_StopAsyncIteration_USED + is_async_stopiteration ? "async generator raised StopAsyncIteration" : + in_async_gen ? "async generator raised StopIteration" : + #endif + "generator raised StopIteration"); } /* RaiseException */ @@ -7539,61 +9047,472 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject goto bad; } } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - 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 PY_VERSION_HEX >= 0x030C00A6 + PyException_SetTraceback(value, tb); + #elif CYTHON_FAST_THREAD_STATE + 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); + } +#else + 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); +#endif + } +bad: + Py_XDECREF(owned_instance); + return; +} +#endif + +/* FixUpExtensionType */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { +#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED_VAR(spec); + CYTHON_UNUSED_VAR(type); +#else + const PyType_Slot *slot = spec->slots; + while (slot && slot->slot && slot->slot != Py_tp_members) + slot++; + if (slot && slot->slot == Py_tp_members) { + int changed = 0; +#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) + const +#endif + PyMemberDef *memb = (PyMemberDef*) slot->pfunc; + while (memb && memb->name) { + if (memb->name[0] == '_' && memb->name[1] == '_') { +#if PY_VERSION_HEX < 0x030900b1 + if (strcmp(memb->name, "__weaklistoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_weaklistoffset = memb->offset; + changed = 1; + } + else if (strcmp(memb->name, "__dictoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_dictoffset = memb->offset; + changed = 1; + } +#if CYTHON_METH_FASTCALL + else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); +#if PY_VERSION_HEX >= 0x030800b4 + type->tp_vectorcall_offset = memb->offset; +#else + type->tp_print = (printfunc) memb->offset; +#endif + changed = 1; + } +#endif +#else + if ((0)); +#endif +#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON + else if (strcmp(memb->name, "__module__") == 0) { + PyObject *descr; + assert(memb->type == T_OBJECT); + assert(memb->flags == 0 || memb->flags == READONLY); + descr = PyDescr_NewMember(type, memb); + if (unlikely(!descr)) + return -1; + if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { + Py_DECREF(descr); + return -1; + } + Py_DECREF(descr); + changed = 1; + } +#endif + } + memb++; + } + if (changed) + PyType_Modified(type); + } +#endif + return 0; +} +#endif + +/* PyObjectCallNoArg */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { + PyObject *arg[2] = {NULL, NULL}; + return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* PyObjectCallOneArg */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *args[2] = {NULL, arg}; + return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* PyObjectGetMethod */ +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { + PyObject *attr; +#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP + __Pyx_TypeName type_name; + PyTypeObject *tp = Py_TYPE(obj); + PyObject *descr; + descrgetfunc f = NULL; + PyObject **dictptr, *dict; + int meth_found = 0; + assert (*method == NULL); + if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; + } + if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { + return 0; + } + descr = _PyType_Lookup(tp, name); + if (likely(descr != NULL)) { + Py_INCREF(descr); +#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR + if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) +#elif PY_MAJOR_VERSION >= 3 + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) + #endif +#else + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr))) + #endif +#endif + { + meth_found = 1; + } else { + f = Py_TYPE(descr)->tp_descr_get; + if (f != NULL && PyDescr_IsData(descr)) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + } + } + dictptr = _PyObject_GetDictPtr(obj); + if (dictptr != NULL && (dict = *dictptr) != NULL) { + Py_INCREF(dict); + attr = __Pyx_PyDict_GetItemStr(dict, name); + if (attr != NULL) { + Py_INCREF(attr); + Py_DECREF(dict); + Py_XDECREF(descr); + goto try_unpack; + } + Py_DECREF(dict); + } + if (meth_found) { + *method = descr; + return 1; + } + if (f != NULL) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + if (likely(descr != NULL)) { + *method = descr; + return 0; + } + type_name = __Pyx_PyType_GetName(tp); + PyErr_Format(PyExc_AttributeError, +#if PY_MAJOR_VERSION >= 3 + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, name); +#else + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(name)); +#endif + __Pyx_DECREF_TypeName(type_name); + return 0; +#else + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; +#endif +try_unpack: +#if CYTHON_UNPACK_METHODS + if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { + PyObject *function = PyMethod_GET_FUNCTION(attr); + Py_INCREF(function); + Py_DECREF(attr); + *method = function; + return 1; + } +#endif + *method = attr; + return 0; +} + +/* PyObjectCallMethod0 */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { + PyObject *method = NULL, *result = NULL; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_CallOneArg(method, obj); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) goto bad; + result = __Pyx_PyObject_CallNoArg(method); + Py_DECREF(method); +bad: + return result; +} + +/* ValidateBasesTuple */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) { + Py_ssize_t i, n; +#if CYTHON_ASSUME_SAFE_MACROS + n = PyTuple_GET_SIZE(bases); +#else + n = PyTuple_Size(bases); + if (n < 0) return -1; +#endif + for (i = 1; i < n; i++) + { +#if CYTHON_AVOID_BORROWED_REFS + PyObject *b0 = PySequence_GetItem(bases, i); + if (!b0) return -1; +#elif CYTHON_ASSUME_SAFE_MACROS + PyObject *b0 = PyTuple_GET_ITEM(bases, i); +#else + PyObject *b0 = PyTuple_GetItem(bases, i); + if (!b0) return -1; +#endif + PyTypeObject *b; +#if PY_MAJOR_VERSION < 3 + if (PyClass_Check(b0)) + { + PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class", + PyString_AS_STRING(((PyClassObject*)b0)->cl_name)); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } +#endif + b = (PyTypeObject*) b0; + if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); + PyErr_Format(PyExc_TypeError, + "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name); + __Pyx_DECREF_TypeName(b_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } + if (dictoffset == 0) + { + Py_ssize_t b_dictoffset = 0; +#if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + b_dictoffset = b->tp_dictoffset; +#else + PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__"); + if (!py_b_dictoffset) goto dictoffset_return; + b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset); + Py_DECREF(py_b_dictoffset); + if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return; +#endif + if (b_dictoffset) { + { + __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); + PyErr_Format(PyExc_TypeError, + "extension type '%.200s' has no __dict__ slot, " + "but base type '" __Pyx_FMT_TYPENAME "' has: " + "either add 'cdef dict __dict__' to the extension type " + "or add '__slots__ = [...]' to the base type", + type_name, b_name); + __Pyx_DECREF_TypeName(b_name); + } +#if !(CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY) + dictoffset_return: +#endif +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } + } +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif } - 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; + return 0; +} +#endif + +/* PyType_Ready */ +static int __Pyx_PyType_Ready(PyTypeObject *t) { +#if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API) || defined(PYSTON_MAJOR_VERSION) + (void)__Pyx_PyObject_CallMethod0; +#if CYTHON_USE_TYPE_SPECS + (void)__Pyx_validate_bases_tuple; +#endif + return PyType_Ready(t); +#else + int r; + PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); + if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1)) + return -1; +#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) + { + int gc_was_enabled; + #if PY_VERSION_HEX >= 0x030A00b1 + gc_was_enabled = PyGC_Disable(); + (void)__Pyx_PyObject_CallMethod0; + #else + PyObject *ret, *py_status; + PyObject *gc = NULL; + #if PY_VERSION_HEX >= 0x030700a1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) + gc = PyImport_GetModule(__pyx_kp_u_gc); + #endif + if (unlikely(!gc)) gc = PyImport_Import(__pyx_kp_u_gc); + if (unlikely(!gc)) return -1; + py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_isenabled); + if (unlikely(!py_status)) { + Py_DECREF(gc); + return -1; } - PyException_SetCause(value, fixed_cause); - } - PyErr_SetObject(type, value); - if (tb) { - #if PY_VERSION_HEX >= 0x030C00A6 - PyException_SetTraceback(value, tb); - #elif CYTHON_FAST_THREAD_STATE - 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); + gc_was_enabled = __Pyx_PyObject_IsTrue(py_status); + Py_DECREF(py_status); + if (gc_was_enabled > 0) { + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_disable); + if (unlikely(!ret)) { + Py_DECREF(gc); + return -1; + } + Py_DECREF(ret); + } else if (unlikely(gc_was_enabled == -1)) { + Py_DECREF(gc); + return -1; } + #endif + t->tp_flags |= Py_TPFLAGS_HEAPTYPE; +#if PY_VERSION_HEX >= 0x030A0000 + t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE; +#endif #else - 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); + (void)__Pyx_PyObject_CallMethod0; #endif + r = PyType_Ready(t); +#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) + t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE; + #if PY_VERSION_HEX >= 0x030A00b1 + if (gc_was_enabled) + PyGC_Enable(); + #else + if (gc_was_enabled) { + PyObject *tp, *v, *tb; + PyErr_Fetch(&tp, &v, &tb); + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_enable); + if (likely(ret || r == -1)) { + Py_XDECREF(ret); + PyErr_Restore(tp, v, tb); + } else { + Py_XDECREF(tp); + Py_XDECREF(v); + Py_XDECREF(tb); + r = -1; + } + } + Py_DECREF(gc); + #endif } -bad: - Py_XDECREF(owned_instance); - return; +#endif + return r; +#endif +} + +/* PyObject_GenericGetAttrNoDict */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { + __Pyx_TypeName type_name = __Pyx_PyType_GetName(tp); + PyErr_Format(PyExc_AttributeError, +#if PY_MAJOR_VERSION >= 3 + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, attr_name); +#else + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(attr_name)); +#endif + __Pyx_DECREF_TypeName(type_name); + return NULL; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { + PyObject *descr; + PyTypeObject *tp = Py_TYPE(obj); + if (unlikely(!PyString_Check(attr_name))) { + return PyObject_GenericGetAttr(obj, attr_name); + } + assert(!tp->tp_dictoffset); + descr = _PyType_Lookup(tp, attr_name); + if (unlikely(!descr)) { + return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); + } + Py_INCREF(descr); + #if PY_MAJOR_VERSION < 3 + if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) + #endif + { + descrgetfunc f = Py_TYPE(descr)->tp_descr_get; + if (unlikely(f)) { + PyObject *res = f(descr, obj, (PyObject *)tp); + Py_DECREF(descr); + return res; + } + } + return descr; } #endif /* TypeImport */ -#ifndef __PYX_HAVE_RT_ImportType_3_0_11 -#define __PYX_HAVE_RT_ImportType_3_0_11 -static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *module_name, const char *class_name, - size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size) +#ifndef __PYX_HAVE_RT_ImportType_3_0_12 +#define __PYX_HAVE_RT_ImportType_3_0_12 +static PyTypeObject *__Pyx_ImportType_3_0_12(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_12 check_size) { PyObject *result = 0; char warning[200]; @@ -7647,7 +9566,7 @@ static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *modul module_name, class_name, size, basicsize+itemsize); goto bad; } - if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_11 && + if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_12 && ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " @@ -7655,7 +9574,7 @@ static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *modul module_name, class_name, size, basicsize, basicsize+itemsize); goto bad; } - else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_11 && (size_t)basicsize > size) { + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_12 && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", @@ -7740,7 +9659,7 @@ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { if (unlikely(!module_name_str)) { goto modbad; } module_name = PyUnicode_FromString(module_name_str); if (unlikely(!module_name)) { goto modbad; } - module_dot = PyUnicode_Concat(module_name, __pyx_kp_u_); + module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__3); if (unlikely(!module_dot)) { goto modbad; } full_name = PyUnicode_Concat(module_dot, name); if (unlikely(!full_name)) { goto modbad; } @@ -7770,79 +9689,6 @@ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { return value; } -/* FixUpExtensionType */ -#if CYTHON_USE_TYPE_SPECS -static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { -#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API - CYTHON_UNUSED_VAR(spec); - CYTHON_UNUSED_VAR(type); -#else - const PyType_Slot *slot = spec->slots; - while (slot && slot->slot && slot->slot != Py_tp_members) - slot++; - if (slot && slot->slot == Py_tp_members) { - int changed = 0; -#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) - const -#endif - PyMemberDef *memb = (PyMemberDef*) slot->pfunc; - while (memb && memb->name) { - if (memb->name[0] == '_' && memb->name[1] == '_') { -#if PY_VERSION_HEX < 0x030900b1 - if (strcmp(memb->name, "__weaklistoffset__") == 0) { - assert(memb->type == T_PYSSIZET); - assert(memb->flags == READONLY); - type->tp_weaklistoffset = memb->offset; - changed = 1; - } - else if (strcmp(memb->name, "__dictoffset__") == 0) { - assert(memb->type == T_PYSSIZET); - assert(memb->flags == READONLY); - type->tp_dictoffset = memb->offset; - changed = 1; - } -#if CYTHON_METH_FASTCALL - else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { - assert(memb->type == T_PYSSIZET); - assert(memb->flags == READONLY); -#if PY_VERSION_HEX >= 0x030800b4 - type->tp_vectorcall_offset = memb->offset; -#else - type->tp_print = (printfunc) memb->offset; -#endif - changed = 1; - } -#endif -#else - if ((0)); -#endif -#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON - else if (strcmp(memb->name, "__module__") == 0) { - PyObject *descr; - assert(memb->type == T_OBJECT); - assert(memb->flags == 0 || memb->flags == READONLY); - descr = PyDescr_NewMember(type, memb); - if (unlikely(!descr)) - return -1; - if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { - Py_DECREF(descr); - return -1; - } - Py_DECREF(descr); - changed = 1; - } -#endif - } - memb++; - } - if (changed) - PyType_Modified(type); - } -#endif - return 0; -} -#endif - /* FetchSharedCythonModule */ static PyObject *__Pyx_FetchSharedCythonABIModule(void) { return __Pyx_PyImport_AddModuleRef((char*) __PYX_ABI_MODULE_NAME); @@ -9009,388 +10855,831 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, Py m->func_annotations = dict; Py_INCREF(dict); } - -/* CythonFunction */ -static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, - PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { - PyObject *op = __Pyx_CyFunction_Init( - PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), - ml, flags, qualname, closure, module, globals, code - ); - if (likely(op)) { - PyObject_GC_Track(op); + +/* CythonFunction */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + PyObject *op = __Pyx_CyFunction_Init( + PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), + ml, flags, qualname, closure, module, globals, code + ); + if (likely(op)) { + PyObject_GC_Track(op); + } + return op; +} + +/* CLineInTraceback */ +#ifndef CYTHON_CLINE_IN_TRACEBACK +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { + PyObject *use_cline; + PyObject *ptype, *pvalue, *ptraceback; +#if CYTHON_COMPILING_IN_CPYTHON + PyObject **cython_runtime_dict; +#endif + CYTHON_MAYBE_UNUSED_VAR(tstate); + if (unlikely(!__pyx_cython_runtime)) { + return c_line; + } + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); +#if CYTHON_COMPILING_IN_CPYTHON + cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); + if (likely(cython_runtime_dict)) { + __PYX_PY_DICT_LOOKUP_IF_MODIFIED( + use_cline, *cython_runtime_dict, + __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) + } else +#endif + { + PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + if (use_cline_obj) { + use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; + Py_DECREF(use_cline_obj); + } else { + PyErr_Clear(); + use_cline = NULL; + } + } + if (!use_cline) { + c_line = 0; + (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + } + else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { + c_line = 0; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + return c_line; +} +#endif + +/* CodeObjectCache */ +#if !CYTHON_COMPILING_IN_LIMITED_API +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = start + (end - start) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; } - return op; + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); } +#endif -/* CLineInTraceback */ -#ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { - PyObject *use_cline; - PyObject *ptype, *pvalue, *ptraceback; -#if CYTHON_COMPILING_IN_CPYTHON - PyObject **cython_runtime_dict; +/* AddTraceback */ +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" #endif - CYTHON_MAYBE_UNUSED_VAR(tstate); - if (unlikely(!__pyx_cython_runtime)) { - return c_line; +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, + PyObject *firstlineno, PyObject *name) { + PyObject *replace = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; + replace = PyObject_GetAttrString(code, "replace"); + if (likely(replace)) { + PyObject *result; + result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict); + Py_DECREF(replace); + return result; } - __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); -#if CYTHON_COMPILING_IN_CPYTHON - cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); - if (likely(cython_runtime_dict)) { - __PYX_PY_DICT_LOOKUP_IF_MODIFIED( - use_cline, *cython_runtime_dict, - __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) - } else -#endif + PyErr_Clear(); + #if __PYX_LIMITED_VERSION_HEX < 0x030780000 { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); - if (use_cline_obj) { - use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; - Py_DECREF(use_cline_obj); - } else { - PyErr_Clear(); - use_cline = NULL; - } + PyObject *compiled = NULL, *result = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL; + compiled = Py_CompileString( + "out = type(code)(\n" + " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n" + " code.co_flags, code.co_code, code.co_consts, code.co_names,\n" + " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n" + " code.co_lnotab)\n", "", Py_file_input); + if (!compiled) return NULL; + result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict); + Py_DECREF(compiled); + if (!result) PyErr_Print(); + Py_DECREF(result); + result = PyDict_GetItemString(scratch_dict, "out"); + if (result) Py_INCREF(result); + return result; } - if (!use_cline) { - c_line = 0; - (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + #else + return NULL; + #endif +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; + PyObject *replace = NULL, *getframe = NULL, *frame = NULL; + PyObject *exc_type, *exc_value, *exc_traceback; + int success = 0; + if (c_line) { + (void) __pyx_cfilenm; + (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); } - else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { - c_line = 0; + PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); + code_object = Py_CompileString("_getframe()", filename, Py_eval_input); + if (unlikely(!code_object)) goto bad; + py_py_line = PyLong_FromLong(py_line); + if (unlikely(!py_py_line)) goto bad; + py_funcname = PyUnicode_FromString(funcname); + if (unlikely(!py_funcname)) goto bad; + dict = PyDict_New(); + if (unlikely(!dict)) goto bad; + { + PyObject *old_code_object = code_object; + code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); + Py_DECREF(old_code_object); + } + if (unlikely(!code_object)) goto bad; + getframe = PySys_GetObject("_getframe"); + if (unlikely(!getframe)) goto bad; + if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; + frame = PyEval_EvalCode(code_object, dict, dict); + if (unlikely(!frame) || frame == Py_None) goto bad; + success = 1; + bad: + PyErr_Restore(exc_type, exc_value, exc_traceback); + Py_XDECREF(code_object); + Py_XDECREF(py_py_line); + Py_XDECREF(py_funcname); + Py_XDECREF(dict); + Py_XDECREF(replace); + if (success) { + PyTraceBack_Here( + (struct _frame*)frame); + } + Py_XDECREF(frame); +} +#else +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; + #if PY_MAJOR_VERSION < 3 + PyObject *py_srcfile = NULL; + py_srcfile = PyString_FromString(filename); + if (!py_srcfile) goto bad; + #endif + if (c_line) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + if (!py_funcname) goto bad; + #endif + } + #if PY_MAJOR_VERSION < 3 + py_code = __Pyx_PyCode_New( + 0, + 0, + 0, + 0, + 0, + 0, + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + py_line, + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + Py_DECREF(py_srcfile); + #else + py_code = PyCode_NewEmpty(filename, funcname, py_line); + #endif + Py_XDECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_funcname); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_srcfile); + #endif + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject *ptype, *pvalue, *ptraceback; + if (c_line) { + c_line = __Pyx_CLineForTraceback(tstate, c_line); + } + py_code = __pyx_find_code_object(c_line ? -c_line : py_line); + if (!py_code) { + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) { + /* If the code object creation fails, then we should clear the + fetched exception references and propagate the new exception */ + Py_XDECREF(ptype); + Py_XDECREF(pvalue); + Py_XDECREF(ptraceback); + goto bad; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); } - __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); - return c_line; + py_frame = PyFrame_New( + tstate, /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + __pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + __Pyx_PyFrame_SetLineNumber(py_frame, py_line); + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); } #endif -/* CodeObjectCache */ -#if !CYTHON_COMPILING_IN_LIMITED_API -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { - int start = 0, mid = 0, end = count - 1; - if (end >= 0 && code_line > entries[end].code_line) { - return count; - } - while (start < end) { - mid = start + (end - start) / 2; - if (code_line < entries[mid].code_line) { - end = mid; - } else if (code_line > entries[mid].code_line) { - start = mid + 1; - } else { - return mid; - } - } - if (code_line <= entries[mid].code_line) { - return mid; - } else { - return mid + 1; - } -} -static PyCodeObject *__pyx_find_code_object(int code_line) { - PyCodeObject* code_object; - int pos; - if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { - return NULL; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { - return NULL; +/* CIntFromPyVerify */ +#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) +#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) +#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ + {\ + func_type value = func_value;\ + if (sizeof(target_type) < sizeof(func_type)) {\ + if (unlikely(value != (func_type) (target_type) value)) {\ + func_type zero = 0;\ + if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ + return (target_type) -1;\ + if (is_unsigned && unlikely(value < zero))\ + goto raise_neg_overflow;\ + else\ + goto raise_overflow;\ + }\ + }\ + return (target_type) value;\ } - code_object = __pyx_code_cache.entries[pos].code_object; - Py_INCREF(code_object); - return code_object; + +/* ToPyCTupleUtility */ +static PyObject* __pyx_convert__to_py___pyx_ctuple_int__and_int(__pyx_ctuple_int__and_int value) { + PyObject* item = NULL; + PyObject* result = PyTuple_New(2); + if (!result) goto bad; + item = __Pyx_PyInt_From_int(value.f0); + if (!item) goto bad; + PyTuple_SET_ITEM(result, 0, item); + item = __Pyx_PyInt_From_int(value.f1); + if (!item) goto bad; + PyTuple_SET_ITEM(result, 1, item); + return result; +bad: + Py_XDECREF(item); + Py_XDECREF(result); + return NULL; } -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { - int pos, i; - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - if (unlikely(!code_line)) { - return; - } - if (unlikely(!entries)) { - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); - if (likely(entries)) { - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = 64; - __pyx_code_cache.count = 1; - entries[0].code_line = code_line; - entries[0].code_object = code_object; - Py_INCREF(code_object); + +/* CIntFromPy */ +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if ((sizeof(int) < sizeof(long))) { + __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (int) val; } - return; } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { - PyCodeObject* tmp = entries[pos].code_object; - entries[pos].code_object = code_object; +#endif + if (unlikely(!PyLong_Check(x))) { + int val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (int) -1; + val = __Pyx_PyInt_As_int(tmp); Py_DECREF(tmp); - return; + return val; } - if (__pyx_code_cache.count == __pyx_code_cache.max_count) { - int new_max = __pyx_code_cache.max_count + 64; - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); - if (unlikely(!entries)) { - return; + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(int) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + } } - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = new_max; - } - for (i=__pyx_code_cache.count; i>pos; i--) { - entries[i] = entries[i-1]; - } - entries[pos].code_line = code_line; - entries[pos].code_object = code_object; - __pyx_code_cache.count++; - Py_INCREF(code_object); -} #endif - -/* AddTraceback */ -#include "compile.h" -#include "frameobject.h" -#include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API - #ifndef Py_BUILD_CORE - #define Py_BUILD_CORE 1 - #endif - #include "internal/pycore_frame.h" + if ((sizeof(int) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif -#if CYTHON_COMPILING_IN_LIMITED_API -static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, - PyObject *firstlineno, PyObject *name) { - PyObject *replace = NULL; - if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; - if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; - replace = PyObject_GetAttrString(code, "replace"); - if (likely(replace)) { - PyObject *result; - result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict); - Py_DECREF(replace); - return result; - } - PyErr_Clear(); - #if __PYX_LIMITED_VERSION_HEX < 0x030780000 - { - PyObject *compiled = NULL, *result = NULL; - if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL; - if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL; - compiled = Py_CompileString( - "out = type(code)(\n" - " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n" - " code.co_flags, code.co_code, code.co_consts, code.co_names,\n" - " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n" - " code.co_lnotab)\n", "", Py_file_input); - if (!compiled) return NULL; - result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict); - Py_DECREF(compiled); - if (!result) PyErr_Print(); - Py_DECREF(result); - result = PyDict_GetItemString(scratch_dict, "out"); - if (result) Py_INCREF(result); - return result; - } - #else - return NULL; - #endif -} -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; - PyObject *replace = NULL, *getframe = NULL, *frame = NULL; - PyObject *exc_type, *exc_value, *exc_traceback; - int success = 0; - if (c_line) { - (void) __pyx_cfilenm; - (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } } - PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); - code_object = Py_CompileString("_getframe()", filename, Py_eval_input); - if (unlikely(!code_object)) goto bad; - py_py_line = PyLong_FromLong(py_line); - if (unlikely(!py_py_line)) goto bad; - py_funcname = PyUnicode_FromString(funcname); - if (unlikely(!py_funcname)) goto bad; - dict = PyDict_New(); - if (unlikely(!dict)) goto bad; { - PyObject *old_code_object = code_object; - code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); - Py_DECREF(old_code_object); - } - if (unlikely(!code_object)) goto bad; - getframe = PySys_GetObject("_getframe"); - if (unlikely(!getframe)) goto bad; - if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; - frame = PyEval_EvalCode(code_object, dict, dict); - if (unlikely(!frame) || frame == Py_None) goto bad; - success = 1; - bad: - PyErr_Restore(exc_type, exc_value, exc_traceback); - Py_XDECREF(code_object); - Py_XDECREF(py_py_line); - Py_XDECREF(py_funcname); - Py_XDECREF(dict); - Py_XDECREF(replace); - if (success) { - PyTraceBack_Here( - (struct _frame*)frame); - } - Py_XDECREF(frame); -} + int val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); #else -static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( - const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = NULL; - PyObject *py_funcname = NULL; - #if PY_MAJOR_VERSION < 3 - PyObject *py_srcfile = NULL; - py_srcfile = PyString_FromString(filename); - if (!py_srcfile) goto bad; - #endif - if (c_line) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - if (!py_funcname) goto bad; - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - if (!py_funcname) goto bad; - funcname = PyUnicode_AsUTF8(py_funcname); - if (!funcname) goto bad; - #endif - } - else { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromString(funcname); - if (!py_funcname) goto bad; - #endif + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (int) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (int) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = v; + } + v = NULL; + val = (int) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((int) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (int) -1; + return val; } - #if PY_MAJOR_VERSION < 3 - py_code = __Pyx_PyCode_New( - 0, - 0, - 0, - 0, - 0, - 0, - __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ - py_srcfile, /*PyObject *filename,*/ - py_funcname, /*PyObject *name,*/ - py_line, - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - Py_DECREF(py_srcfile); - #else - py_code = PyCode_NewEmpty(filename, funcname, py_line); - #endif - Py_XDECREF(py_funcname); - return py_code; -bad: - Py_XDECREF(py_funcname); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(py_srcfile); - #endif - return NULL; +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int"); + return (int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; } -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject *ptype, *pvalue, *ptraceback; - if (c_line) { - c_line = __Pyx_CLineForTraceback(tstate, c_line); + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(int) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } } - py_code = __pyx_find_code_object(c_line ? -c_line : py_line); - if (!py_code) { - __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); - py_code = __Pyx_CreateCodeObjectForTraceback( - funcname, c_line, py_line, filename); - if (!py_code) { - /* If the code object creation fails, then we should clear the - fetched exception references and propagate the new exception */ - Py_XDECREF(ptype); - Py_XDECREF(pvalue); - Py_XDECREF(ptraceback); - goto bad; + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); } - __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); - __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(int), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + if (!is_unsigned) { + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad; + } + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(arg_tuple); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif } - py_frame = PyFrame_New( - tstate, /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - __Pyx_PyFrame_SetLineNumber(py_frame, py_line); - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_code); - Py_XDECREF(py_frame); +} + +/* FormatTypeName */ +#if CYTHON_COMPILING_IN_LIMITED_API +static __Pyx_TypeName +__Pyx_PyType_GetName(PyTypeObject* tp) +{ + PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_n_s_name); + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { + PyErr_Clear(); + Py_XDECREF(name); + name = __Pyx_NewRef(__pyx_n_s__14); + } + return name; } #endif -/* CIntFromPyVerify */ -#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) -#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) -#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ - {\ - func_type value = func_value;\ - if (sizeof(target_type) < sizeof(func_type)) {\ - if (unlikely(value != (func_type) (target_type) value)) {\ - func_type zero = 0;\ - if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ - return (target_type) -1;\ - if (is_unsigned && unlikely(value < zero))\ - goto raise_neg_overflow;\ - else\ - goto raise_overflow;\ - }\ - }\ - return (target_type) value;\ +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + if (!is_unsigned) { + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad; + } + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(arg_tuple); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif } +} /* CIntFromPy */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif - const int neg_one = (int) -1, const_zero = (int) 0; + const long neg_one = (long) -1, const_zero = (long) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if ((sizeof(int) < sizeof(long))) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) + if ((sizeof(long) < sizeof(long))) { + __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } - return (int) val; + return (long) val; } } #endif if (unlikely(!PyLong_Check(x))) { - int val; + long val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (int) -1; - val = __Pyx_PyInt_As_int(tmp); + if (!tmp) return (long) -1; + val = __Pyx_PyInt_As_long(tmp); Py_DECREF(tmp); return val; } @@ -9399,35 +11688,35 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { if (unlikely(__Pyx_PyLong_IsNeg(x))) { goto raise_neg_overflow; } else if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) } else { const digit* digits = __Pyx_PyLong_Digits(x); assert(__Pyx_PyLong_DigitCount(x) > 1); switch (__Pyx_PyLong_DigitCount(x)) { case 2: - if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; case 3: - if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; case 4: - if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; @@ -9442,93 +11731,93 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) - return (int) -1; + return (long) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif - if ((sizeof(int) <= sizeof(unsigned long))) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) + if ((sizeof(long) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) } else { const digit* digits = __Pyx_PyLong_Digits(x); assert(__Pyx_PyLong_DigitCount(x) > 1); switch (__Pyx_PyLong_SignedDigitCount(x)) { case -2: - if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 2: - if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -3: - if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 3: - if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -4: - if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 4: - if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; } } #endif - if ((sizeof(int) <= sizeof(long))) { - __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) + if ((sizeof(long) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { - int val; + long val; int ret = -1; #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API Py_ssize_t bytes_copied = PyLong_AsNativeBytes( @@ -9554,14 +11843,14 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { v = __Pyx_NewRef(x); } else { v = PyNumber_Long(x); - if (unlikely(!v)) return (int) -1; + if (unlikely(!v)) return (long) -1; assert(PyLong_CheckExact(v)); } { int result = PyObject_RichCompareBool(v, Py_False, Py_LT); if (unlikely(result < 0)) { Py_DECREF(v); - return (int) -1; + return (long) -1; } is_negative = result == 1; } @@ -9572,15 +11861,15 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { stepval = PyNumber_Invert(v); Py_DECREF(v); if (unlikely(!stepval)) - return (int) -1; + return (long) -1; } else { stepval = v; } v = NULL; - val = (int) 0; + val = (long) 0; mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; - for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { PyObject *tmp, *digit; long idigit; digit = PyNumber_And(stepval, mask); @@ -9588,7 +11877,7 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { idigit = PyLong_AsLong(digit); Py_DECREF(digit); if (unlikely(idigit < 0)) goto done; - val |= ((int) idigit) << bits; + val |= ((long) idigit) << bits; tmp = PyNumber_Rshift(stepval, shift); if (unlikely(!tmp)) goto done; Py_DECREF(stepval); stepval = tmp; @@ -9598,13 +11887,13 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { { long idigit = PyLong_AsLong(stepval); if (unlikely(idigit < 0)) goto done; - remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); if (unlikely(idigit >= (1L << remaining_bits))) goto raise_overflow; - val |= ((int) idigit) << bits; + val |= ((long) idigit) << bits; } if (!is_unsigned) { - if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) goto raise_overflow; if (is_negative) val = ~val; @@ -9616,559 +11905,1387 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { Py_XDECREF(stepval); #endif if (unlikely(ret)) - return (int) -1; + return (long) -1; return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, - "value too large to convert to int"); - return (int) -1; + "value too large to convert to long"); + return (long) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; + "can't convert negative value to long"); + return (long) -1; } -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const int neg_one = (int) -1, const_zero = (int) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(int) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif +/* FastTypeChecks */ +#if CYTHON_COMPILING_IN_CPYTHON +static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { + while (a) { + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); + if (a == b) + return 1; + } + return b == &PyBaseObject_Type; +} +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (a == b) return 1; + mro = a->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(a, b); +} +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (cls == a || cls == b) return 1; + mro = cls->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + PyObject *base = PyTuple_GET_ITEM(mro, i); + if (base == (PyObject *)a || base == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); +} +#if PY_MAJOR_VERSION == 2 +static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { + PyObject *exception, *value, *tb; + int res; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&exception, &value, &tb); + res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + if (!res) { + res = PyObject_IsSubclass(err, exc_type2); + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; } + } + __Pyx_ErrRestore(exception, value, tb); + return res; +} +#else +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); } else { - if (sizeof(int) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + } +} #endif - } +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i= 0x030d00A4 - if (is_unsigned) { - return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); +#endif + for (i=0; iexc_info; + while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && + exc_info->previous_item != NULL) + { + exc_info = exc_info->previous_item; } + return exc_info; } +#endif -/* FormatTypeName */ -#if CYTHON_COMPILING_IN_LIMITED_API -static __Pyx_TypeName -__Pyx_PyType_GetName(PyTypeObject* tp) -{ - PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, - __pyx_n_s_name); - if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { - PyErr_Clear(); - Py_XDECREF(name); - name = __Pyx_NewRef(__pyx_n_s__13); +/* SaveResetException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + PyObject *exc_value = exc_info->exc_value; + if (exc_value == NULL || exc_value == Py_None) { + *value = NULL; + *type = NULL; + *tb = NULL; + } else { + *value = exc_value; + Py_INCREF(*value); + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + *tb = PyException_GetTraceback(exc_value); } - return name; + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + *type = exc_info->exc_type; + *value = exc_info->exc_value; + *tb = exc_info->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #else + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #endif +} +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + PyObject *tmp_value = exc_info->exc_value; + exc_info->exc_value = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); + #else + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = type; + exc_info->exc_value = value; + exc_info->exc_traceback = tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); + #endif } #endif -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" +/* SwapException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_value = exc_info->exc_value; + exc_info->exc_value = *value; + if (tmp_value == NULL || tmp_value == Py_None) { + Py_XDECREF(tmp_value); + tmp_value = NULL; + tmp_type = NULL; + tmp_tb = NULL; + } else { + tmp_type = (PyObject*) Py_TYPE(tmp_value); + Py_INCREF(tmp_type); + #if CYTHON_COMPILING_IN_CPYTHON + tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback; + Py_XINCREF(tmp_tb); + #else + tmp_tb = PyException_GetTraceback(tmp_value); + #endif + } + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = *type; + exc_info->exc_value = *value; + exc_info->exc_traceback = *tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = *type; + tstate->exc_value = *value; + tstate->exc_traceback = *tb; + #endif + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); + PyErr_SetExcInfo(*type, *value, *tb); + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} #endif - const long neg_one = (long) -1, const_zero = (long) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop + +/* PyObjectCall2Args */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args[3] = {NULL, arg1, arg2}; + return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* PyObjectCallMethod1 */ +#if !(CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C00A2) +static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { + PyObject *result = __Pyx_PyObject_CallOneArg(method, arg); + Py_DECREF(method); + return result; +} #endif - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { +#if CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C00A2 + PyObject *args[2] = {obj, arg}; + (void) __Pyx_PyObject_GetMethod; + (void) __Pyx_PyObject_CallOneArg; + (void) __Pyx_PyObject_Call2Args; + return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#else + PyObject *method = NULL, *result; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_Call2Args(method, obj, arg); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) return NULL; + return __Pyx__PyObject_CallMethod1(method, arg); +#endif +} + +/* CoroutineBase */ +#include +#if PY_VERSION_HEX >= 0x030b00a6 && !defined(PYPY_VERSION) + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" #endif +#define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom) +static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *__pyx_tstate, PyObject **pvalue) { + PyObject *et, *ev, *tb; + PyObject *value = NULL; + CYTHON_UNUSED_VAR(__pyx_tstate); + __Pyx_ErrFetch(&et, &ev, &tb); + if (!et) { + Py_XDECREF(tb); + Py_XDECREF(ev); + Py_INCREF(Py_None); + *pvalue = Py_None; + return 0; + } + if (likely(et == PyExc_StopIteration)) { + if (!ev) { + Py_INCREF(Py_None); + value = Py_None; } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); +#if PY_VERSION_HEX >= 0x030300A0 + else if (likely(__Pyx_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) { + value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); + Py_DECREF(ev); + } +#endif + else if (unlikely(PyTuple_Check(ev))) { + if (PyTuple_GET_SIZE(ev) >= 1) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + value = PyTuple_GET_ITEM(ev, 0); + Py_INCREF(value); +#else + value = PySequence_ITEM(ev, 0); #endif + } else { + Py_INCREF(Py_None); + value = Py_None; + } + Py_DECREF(ev); + } + else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) { + value = ev; } + if (likely(value)) { + Py_XDECREF(tb); + Py_DECREF(et); + *pvalue = value; + return 0; + } + } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) { + __Pyx_ErrRestore(et, ev, tb); + return -1; } + PyErr_NormalizeException(&et, &ev, &tb); + if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + Py_XDECREF(tb); + Py_DECREF(et); +#if PY_VERSION_HEX >= 0x030300A0 + value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); + Py_DECREF(ev); +#else { - unsigned char *bytes = (unsigned char *)&value; -#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 - if (is_unsigned) { - return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); - } else { - return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args); + Py_DECREF(ev); + if (likely(args)) { + value = PySequence_GetItem(args, 0); + Py_DECREF(args); } -#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 - int one = 1; int little = (int)*(unsigned char *)&one; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); -#else - int one = 1; int little = (int)*(unsigned char *)&one; - PyObject *from_bytes, *result = NULL; - PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; - from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); - if (!from_bytes) return NULL; - py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); - if (!py_bytes) goto limited_bad; - order_str = PyUnicode_FromString(little ? "little" : "big"); - if (!order_str) goto limited_bad; - arg_tuple = PyTuple_Pack(2, py_bytes, order_str); - if (!arg_tuple) goto limited_bad; - if (!is_unsigned) { - kwds = PyDict_New(); - if (!kwds) goto limited_bad; - if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad; + if (unlikely(!value)) { + __Pyx_ErrRestore(NULL, NULL, NULL); + Py_INCREF(Py_None); + value = Py_None; } - result = PyObject_Call(from_bytes, arg_tuple, kwds); - limited_bad: - Py_XDECREF(kwds); - Py_XDECREF(arg_tuple); - Py_XDECREF(order_str); - Py_XDECREF(py_bytes); - Py_XDECREF(from_bytes); - return result; -#endif } +#endif + *pvalue = value; + return 0; } - -/* CIntFromPy */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" +static CYTHON_INLINE +void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) { +#if PY_VERSION_HEX >= 0x030B00a4 + Py_CLEAR(exc_state->exc_value); +#else + PyObject *t, *v, *tb; + t = exc_state->exc_type; + v = exc_state->exc_value; + tb = exc_state->exc_traceback; + exc_state->exc_type = NULL; + exc_state->exc_value = NULL; + exc_state->exc_traceback = NULL; + Py_XDECREF(t); + Py_XDECREF(v); + Py_XDECREF(tb); #endif - const long neg_one = (long) -1, const_zero = (long) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop +} +#define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL) +static void __Pyx__Coroutine_AlreadyRunningError(__pyx_CoroutineObject *gen) { + const char *msg; + CYTHON_MAYBE_UNUSED_VAR(gen); + if ((0)) { + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_Coroutine_Check((PyObject*)gen)) { + msg = "coroutine already executing"; + #endif + #ifdef __Pyx_AsyncGen_USED + } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) { + msg = "async generator already executing"; + #endif + } else { + msg = "generator already executing"; + } + PyErr_SetString(PyExc_ValueError, msg); +} +#define __Pyx_Coroutine_NotStartedError(gen) (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL) +static void __Pyx__Coroutine_NotStartedError(PyObject *gen) { + const char *msg; + CYTHON_MAYBE_UNUSED_VAR(gen); + if ((0)) { + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_Coroutine_Check(gen)) { + msg = "can't send non-None value to a just-started coroutine"; + #endif + #ifdef __Pyx_AsyncGen_USED + } else if (__Pyx_AsyncGen_CheckExact(gen)) { + msg = "can't send non-None value to a just-started async generator"; + #endif + } else { + msg = "can't send non-None value to a just-started generator"; + } + PyErr_SetString(PyExc_TypeError, msg); +} +#define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing) (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL) +static void __Pyx__Coroutine_AlreadyTerminatedError(PyObject *gen, PyObject *value, int closing) { + CYTHON_MAYBE_UNUSED_VAR(gen); + CYTHON_MAYBE_UNUSED_VAR(closing); + #ifdef __Pyx_Coroutine_USED + if (!closing && __Pyx_Coroutine_Check(gen)) { + PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine"); + } else + #endif + if (value) { + #ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(gen)) + PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration); + else + #endif + PyErr_SetNone(PyExc_StopIteration); + } +} +static +PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) { + __Pyx_PyThreadState_declare + PyThreadState *tstate; + __Pyx_ExcInfoStruct *exc_state; + PyObject *retval; + assert(!self->is_running); + if (unlikely(self->resume_label == 0)) { + if (unlikely(value && value != Py_None)) { + return __Pyx_Coroutine_NotStartedError((PyObject*)self); + } + } + if (unlikely(self->resume_label == -1)) { + return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing); + } +#if CYTHON_FAST_THREAD_STATE + __Pyx_PyThreadState_assign + tstate = __pyx_tstate; +#else + tstate = __Pyx_PyThreadState_Current; #endif - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if ((sizeof(long) < sizeof(long))) { - __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (long) val; + exc_state = &self->gi_exc_state; + if (exc_state->exc_value) { + #if CYTHON_COMPILING_IN_PYPY + #else + PyObject *exc_tb; + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON + exc_tb = PyException_GetTraceback(exc_state->exc_value); + #elif PY_VERSION_HEX >= 0x030B00a4 + exc_tb = ((PyBaseExceptionObject*) exc_state->exc_value)->traceback; + #else + exc_tb = exc_state->exc_traceback; + #endif + if (exc_tb) { + PyTracebackObject *tb = (PyTracebackObject *) exc_tb; + PyFrameObject *f = tb->tb_frame; + assert(f->f_back == NULL); + #if PY_VERSION_HEX >= 0x030B00A1 + f->f_back = PyThreadState_GetFrame(tstate); + #else + Py_XINCREF(tstate->frame); + f->f_back = tstate->frame; + #endif + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON + Py_DECREF(exc_tb); + #endif } + #endif + } +#if CYTHON_USE_EXC_INFO_STACK + exc_state->previous_item = tstate->exc_info; + tstate->exc_info = exc_state; +#else + if (exc_state->exc_type) { + __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); + } else { + __Pyx_Coroutine_ExceptionClear(exc_state); + __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); } #endif - if (unlikely(!PyLong_Check(x))) { - long val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (long) -1; - val = __Pyx_PyInt_As_long(tmp); - Py_DECREF(tmp); - return val; + self->is_running = 1; + retval = self->body(self, tstate, value); + self->is_running = 0; +#if CYTHON_USE_EXC_INFO_STACK + exc_state = &self->gi_exc_state; + tstate->exc_info = exc_state->previous_item; + exc_state->previous_item = NULL; + __Pyx_Coroutine_ResetFrameBackpointer(exc_state); +#endif + return retval; +} +static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) { +#if CYTHON_COMPILING_IN_PYPY + CYTHON_UNUSED_VAR(exc_state); +#else + PyObject *exc_tb; + #if PY_VERSION_HEX >= 0x030B00a4 + if (!exc_state->exc_value) return; + exc_tb = PyException_GetTraceback(exc_state->exc_value); + #else + exc_tb = exc_state->exc_traceback; + #endif + if (likely(exc_tb)) { + PyTracebackObject *tb = (PyTracebackObject *) exc_tb; + PyFrameObject *f = tb->tb_frame; + Py_CLEAR(f->f_back); + #if PY_VERSION_HEX >= 0x030B00a4 + Py_DECREF(exc_tb); + #endif } - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - if (unlikely(__Pyx_PyLong_IsNeg(x))) { - goto raise_neg_overflow; - } else if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) - } else { - const digit* digits = __Pyx_PyLong_Digits(x); - assert(__Pyx_PyLong_DigitCount(x) > 1); - switch (__Pyx_PyLong_DigitCount(x)) { - case 2: - if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 3: - if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 4: - if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - } - } #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; +} +static CYTHON_INLINE +PyObject *__Pyx_Coroutine_MethodReturn(PyObject* gen, PyObject *retval) { + CYTHON_MAYBE_UNUSED_VAR(gen); + if (unlikely(!retval)) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (!__Pyx_PyErr_Occurred()) { + PyObject *exc = PyExc_StopIteration; + #ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(gen)) + exc = __Pyx_PyExc_StopAsyncIteration; + #endif + __Pyx_PyErr_SetNone(exc); } + } + return retval; +} +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) +static CYTHON_INLINE +PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) { +#if PY_VERSION_HEX <= 0x030A00A1 + return _PyGen_Send(gen, arg); #else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (long) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; + PyObject *result; + if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) { + if (PyAsyncGen_CheckExact(gen)) { + assert(result == Py_None); + PyErr_SetNone(PyExc_StopAsyncIteration); } -#endif - if ((sizeof(long) <= sizeof(unsigned long))) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif + else if (result == Py_None) { + PyErr_SetNone(PyExc_StopIteration); } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) - } else { - const digit* digits = __Pyx_PyLong_Digits(x); - assert(__Pyx_PyLong_DigitCount(x) > 1); - switch (__Pyx_PyLong_SignedDigitCount(x)) { - case -2: - if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 2: - if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -3: - if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 3: - if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -4: - if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 4: - if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; + else { +#if PY_VERSION_HEX < 0x030d00A1 + _PyGen_SetStopIterationValue(result); +#else + if (!PyTuple_Check(result) && !PyExceptionInstance_Check(result)) { + PyErr_SetObject(PyExc_StopIteration, result); + } else { + PyObject *exc = __Pyx_PyObject_CallOneArg(PyExc_StopIteration, result); + if (likely(exc != NULL)) { + PyErr_SetObject(PyExc_StopIteration, exc); + Py_DECREF(exc); + } } +#endif } + Py_DECREF(result); + result = NULL; + } + return result; #endif - if ((sizeof(long) <= sizeof(long))) { - __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) +} #endif +static CYTHON_INLINE +PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) { + PyObject *ret; + PyObject *val = NULL; + __Pyx_Coroutine_Undelegate(gen); + __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val); + ret = __Pyx_Coroutine_SendEx(gen, val, 0); + Py_XDECREF(val); + return ret; +} +static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) { + PyObject *retval; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + PyObject *yf = gen->yieldfrom; + if (unlikely(gen->is_running)) + return __Pyx_Coroutine_AlreadyRunningError(gen); + if (yf) { + PyObject *ret; + gen->is_running = 1; + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Coroutine_Send(yf, value); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(yf)) { + ret = __Pyx_Coroutine_Send(yf, value); + } else + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_PyAsyncGenASend_CheckExact(yf)) { + ret = __Pyx_async_gen_asend_send(yf, value); + } else + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) + if (PyGen_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); + } else + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) + if (PyCoro_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); + } else + #endif + { + if (value == Py_None) + ret = __Pyx_PyObject_GetIterNextFunc(yf)(yf); + else + ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value); } + gen->is_running = 0; + if (likely(ret)) { + return ret; + } + retval = __Pyx_Coroutine_FinishDelegation(gen); + } else { + retval = __Pyx_Coroutine_SendEx(gen, value, 0); } + return __Pyx_Coroutine_MethodReturn(self, retval); +} +static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) { + PyObject *retval = NULL; + int err = 0; + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + retval = __Pyx_Coroutine_Close(yf); + if (!retval) + return -1; + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(yf)) { + retval = __Pyx_Coroutine_Close(yf); + if (!retval) + return -1; + } else + if (__Pyx_CoroutineAwait_CheckExact(yf)) { + retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL); + if (!retval) + return -1; + } else + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_PyAsyncGenASend_CheckExact(yf)) { + retval = __Pyx_async_gen_asend_close(yf, NULL); + } else + if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) { + retval = __Pyx_async_gen_athrow_close(yf, NULL); + } else + #endif { - long val; - int ret = -1; -#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API - Py_ssize_t bytes_copied = PyLong_AsNativeBytes( - x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); - if (unlikely(bytes_copied == -1)) { - } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { - goto raise_overflow; + PyObject *meth; + gen->is_running = 1; + meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_n_s_close); + if (unlikely(!meth)) { + if (unlikely(PyErr_Occurred())) { + PyErr_WriteUnraisable(yf); + } } else { - ret = 0; + retval = __Pyx_PyObject_CallNoArg(meth); + Py_DECREF(meth); + if (unlikely(!retval)) + err = -1; } -#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - ret = _PyLong_AsByteArray((PyLongObject *)x, - bytes, sizeof(val), - is_little, !is_unsigned); + gen->is_running = 0; + } + Py_XDECREF(retval); + return err; +} +static PyObject *__Pyx_Generator_Next(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + PyObject *yf = gen->yieldfrom; + if (unlikely(gen->is_running)) + return __Pyx_Coroutine_AlreadyRunningError(gen); + if (yf) { + PyObject *ret; + gen->is_running = 1; + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Generator_Next(yf); + } else + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) + if (PyGen_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(yf)) { + ret = __Pyx_Coroutine_Send(yf, Py_None); + } else + #endif + ret = __Pyx_PyObject_GetIterNextFunc(yf)(yf); + gen->is_running = 0; + if (likely(ret)) { + return ret; + } + return __Pyx_Coroutine_FinishDelegation(gen); + } + return __Pyx_Coroutine_SendEx(gen, Py_None, 0); +} +static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, PyObject *arg) { + CYTHON_UNUSED_VAR(arg); + return __Pyx_Coroutine_Close(self); +} +static PyObject *__Pyx_Coroutine_Close(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + PyObject *retval, *raised_exception; + PyObject *yf = gen->yieldfrom; + int err = 0; + if (unlikely(gen->is_running)) + return __Pyx_Coroutine_AlreadyRunningError(gen); + if (yf) { + Py_INCREF(yf); + err = __Pyx_Coroutine_CloseIter(gen, yf); + __Pyx_Coroutine_Undelegate(gen); + Py_DECREF(yf); + } + if (err == 0) + PyErr_SetNone(PyExc_GeneratorExit); + retval = __Pyx_Coroutine_SendEx(gen, NULL, 1); + if (unlikely(retval)) { + const char *msg; + Py_DECREF(retval); + if ((0)) { + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_Coroutine_Check(self)) { + msg = "coroutine ignored GeneratorExit"; + #endif + #ifdef __Pyx_AsyncGen_USED + } else if (__Pyx_AsyncGen_CheckExact(self)) { +#if PY_VERSION_HEX < 0x03060000 + msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)"; #else - PyObject *v; - PyObject *stepval = NULL, *mask = NULL, *shift = NULL; - int bits, remaining_bits, is_negative = 0; - int chunk_size = (sizeof(long) < 8) ? 30 : 62; - if (likely(PyLong_CheckExact(x))) { - v = __Pyx_NewRef(x); + msg = "async generator ignored GeneratorExit"; +#endif + #endif } else { - v = PyNumber_Long(x); - if (unlikely(!v)) return (long) -1; - assert(PyLong_CheckExact(v)); + msg = "generator ignored GeneratorExit"; } - { - int result = PyObject_RichCompareBool(v, Py_False, Py_LT); - if (unlikely(result < 0)) { - Py_DECREF(v); - return (long) -1; - } - is_negative = result == 1; + PyErr_SetString(PyExc_RuntimeError, msg); + return NULL; + } + raised_exception = PyErr_Occurred(); + if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) { + if (raised_exception) PyErr_Clear(); + Py_INCREF(Py_None); + return Py_None; + } + return NULL; +} +static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb, + PyObject *args, int close_on_genexit) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + PyObject *yf = gen->yieldfrom; + if (unlikely(gen->is_running)) + return __Pyx_Coroutine_AlreadyRunningError(gen); + if (yf) { + PyObject *ret; + Py_INCREF(yf); + if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) { + int err = __Pyx_Coroutine_CloseIter(gen, yf); + Py_DECREF(yf); + __Pyx_Coroutine_Undelegate(gen); + if (err < 0) + return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0)); + goto throw_here; } - if (is_unsigned && unlikely(is_negative)) { - Py_DECREF(v); - goto raise_neg_overflow; - } else if (is_negative) { - stepval = PyNumber_Invert(v); - Py_DECREF(v); - if (unlikely(!stepval)) - return (long) -1; + gen->is_running = 1; + if (0 + #ifdef __Pyx_Generator_USED + || __Pyx_Generator_CheckExact(yf) + #endif + #ifdef __Pyx_Coroutine_USED + || __Pyx_Coroutine_Check(yf) + #endif + ) { + ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit); + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_CoroutineAwait_CheckExact(yf)) { + ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit); + #endif } else { - stepval = v; - } - v = NULL; - val = (long) 0; - mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; - shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; - for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { - PyObject *tmp, *digit; - long idigit; - digit = PyNumber_And(stepval, mask); - if (unlikely(!digit)) goto done; - idigit = PyLong_AsLong(digit); - Py_DECREF(digit); - if (unlikely(idigit < 0)) goto done; - val |= ((long) idigit) << bits; - tmp = PyNumber_Rshift(stepval, shift); - if (unlikely(!tmp)) goto done; - Py_DECREF(stepval); stepval = tmp; - } - Py_DECREF(shift); shift = NULL; - Py_DECREF(mask); mask = NULL; - { - long idigit = PyLong_AsLong(stepval); - if (unlikely(idigit < 0)) goto done; - remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); - if (unlikely(idigit >= (1L << remaining_bits))) - goto raise_overflow; - val |= ((long) idigit) << bits; + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_n_s_throw); + if (unlikely(!meth)) { + Py_DECREF(yf); + if (unlikely(PyErr_Occurred())) { + gen->is_running = 0; + return NULL; + } + __Pyx_Coroutine_Undelegate(gen); + gen->is_running = 0; + goto throw_here; + } + if (likely(args)) { + ret = __Pyx_PyObject_Call(meth, args, NULL); + } else { + PyObject *cargs[4] = {NULL, typ, val, tb}; + ret = __Pyx_PyObject_FastCall(meth, cargs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); + } + Py_DECREF(meth); } - if (!is_unsigned) { - if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) - goto raise_overflow; - if (is_negative) - val = ~val; + gen->is_running = 0; + Py_DECREF(yf); + if (!ret) { + ret = __Pyx_Coroutine_FinishDelegation(gen); } - ret = 0; - done: - Py_XDECREF(shift); - Py_XDECREF(mask); - Py_XDECREF(stepval); -#endif - if (unlikely(ret)) - return (long) -1; - return val; + return __Pyx_Coroutine_MethodReturn(self, ret); } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to long"); - return (long) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; +throw_here: + __Pyx_Raise(typ, val, tb, NULL); + return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0)); } - -/* FastTypeChecks */ -#if CYTHON_COMPILING_IN_CPYTHON -static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { - while (a) { - a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); - if (a == b) - return 1; - } - return b == &PyBaseObject_Type; +static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) { + PyObject *typ; + PyObject *val = NULL; + PyObject *tb = NULL; + if (unlikely(!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))) + return NULL; + return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1); } -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { - PyObject *mro; - if (a == b) return 1; - mro = a->tp_mro; - if (likely(mro)) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(mro); - for (i = 0; i < n; i++) { - if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) - return 1; - } - return 0; - } - return __Pyx_InBases(a, b); +static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) { +#if PY_VERSION_HEX >= 0x030B00a4 + Py_VISIT(exc_state->exc_value); +#else + Py_VISIT(exc_state->exc_type); + Py_VISIT(exc_state->exc_value); + Py_VISIT(exc_state->exc_traceback); +#endif + return 0; +} +static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) { + Py_VISIT(gen->closure); + Py_VISIT(gen->classobj); + Py_VISIT(gen->yieldfrom); + return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg); +} +static int __Pyx_Coroutine_clear(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + Py_CLEAR(gen->closure); + Py_CLEAR(gen->classobj); + Py_CLEAR(gen->yieldfrom); + __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state); +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer); + } +#endif + Py_CLEAR(gen->gi_code); + Py_CLEAR(gen->gi_frame); + Py_CLEAR(gen->gi_name); + Py_CLEAR(gen->gi_qualname); + Py_CLEAR(gen->gi_modulename); + return 0; } -static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { - PyObject *mro; - if (cls == a || cls == b) return 1; - mro = cls->tp_mro; - if (likely(mro)) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(mro); - for (i = 0; i < n; i++) { - PyObject *base = PyTuple_GET_ITEM(mro, i); - if (base == (PyObject *)a || base == (PyObject *)b) - return 1; +static void __Pyx_Coroutine_dealloc(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + PyObject_GC_UnTrack(gen); + if (gen->gi_weakreflist != NULL) + PyObject_ClearWeakRefs(self); + if (gen->resume_label >= 0) { + PyObject_GC_Track(self); +#if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE + if (unlikely(PyObject_CallFinalizerFromDealloc(self))) +#else + Py_TYPE(gen)->tp_del(self); + if (unlikely(Py_REFCNT(self) > 0)) +#endif + { + return; } - return 0; + PyObject_GC_UnTrack(self); } - return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + /* We have to handle this case for asynchronous generators + right here, because this code has to be between UNTRACK + and GC_Del. */ + Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer); + } +#endif + __Pyx_Coroutine_clear(self); + __Pyx_PyHeapTypeObject_GC_Del(gen); } -#if PY_MAJOR_VERSION == 2 -static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { - PyObject *exception, *value, *tb; - int res; +static void __Pyx_Coroutine_del(PyObject *self) { + PyObject *error_type, *error_value, *error_traceback; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; __Pyx_PyThreadState_declare + if (gen->resume_label < 0) { + return; + } +#if !CYTHON_USE_TP_FINALIZE + assert(self->ob_refcnt == 0); + __Pyx_SET_REFCNT(self, 1); +#endif __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&exception, &value, &tb); - res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; + __Pyx_ErrFetch(&error_type, &error_value, &error_traceback); +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self; + PyObject *finalizer = agen->ag_finalizer; + if (finalizer && !agen->ag_closed) { + PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self); + if (unlikely(!res)) { + PyErr_WriteUnraisable(self); + } else { + Py_DECREF(res); + } + __Pyx_ErrRestore(error_type, error_value, error_traceback); + return; + } } - if (!res) { - res = PyObject_IsSubclass(err, exc_type2); - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; +#endif + if (unlikely(gen->resume_label == 0 && !error_value)) { +#ifdef __Pyx_Coroutine_USED +#ifdef __Pyx_Generator_USED + if (!__Pyx_Generator_CheckExact(self)) +#endif + { + PyObject_GC_UnTrack(self); +#if PY_MAJOR_VERSION >= 3 || defined(PyErr_WarnFormat) + if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0)) + PyErr_WriteUnraisable(self); +#else + {PyObject *msg; + char *cmsg; + #if CYTHON_COMPILING_IN_PYPY + msg = NULL; + cmsg = (char*) "coroutine was never awaited"; + #else + char *cname; + PyObject *qualname; + qualname = gen->gi_qualname; + cname = PyString_AS_STRING(qualname); + msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname); + if (unlikely(!msg)) { + PyErr_Clear(); + cmsg = (char*) "coroutine was never awaited"; + } else { + cmsg = PyString_AS_STRING(msg); + } + #endif + if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0)) + PyErr_WriteUnraisable(self); + Py_XDECREF(msg);} +#endif + PyObject_GC_Track(self); + } +#endif + } else { + PyObject *res = __Pyx_Coroutine_Close(self); + if (unlikely(!res)) { + if (PyErr_Occurred()) + PyErr_WriteUnraisable(self); + } else { + Py_DECREF(res); } } - __Pyx_ErrRestore(exception, value, tb); - return res; + __Pyx_ErrRestore(error_type, error_value, error_traceback); +#if !CYTHON_USE_TP_FINALIZE + assert(Py_REFCNT(self) > 0); + if (likely(--self->ob_refcnt == 0)) { + return; + } + { + Py_ssize_t refcnt = Py_REFCNT(self); + _Py_NewReference(self); + __Pyx_SET_REFCNT(self, refcnt); + } +#if CYTHON_COMPILING_IN_CPYTHON + assert(PyType_IS_GC(Py_TYPE(self)) && + _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED); + _Py_DEC_REFTOTAL; +#endif +#ifdef COUNT_ALLOCS + --Py_TYPE(self)->tp_frees; + --Py_TYPE(self)->tp_allocs; +#endif +#endif } +static PyObject * +__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, void *context) +{ + PyObject *name = self->gi_name; + CYTHON_UNUSED_VAR(context); + if (unlikely(!name)) name = Py_None; + Py_INCREF(name); + return name; +} +static int +__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) #else -static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { - if (exc_type1) { - return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); - } else { - return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + if (unlikely(value == NULL || !PyString_Check(value))) +#endif + { + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(self->gi_name, value); + return 0; } -#endif -static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - assert(PyExceptionClass_Check(exc_type)); - n = PyTuple_GET_SIZE(tuple); +static PyObject * +__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, void *context) +{ + PyObject *name = self->gi_qualname; + CYTHON_UNUSED_VAR(context); + if (unlikely(!name)) name = Py_None; + Py_INCREF(name); + return name; +} +static int +__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); #if PY_MAJOR_VERSION >= 3 - for (i=0; igi_qualname, value); return 0; } -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) { - if (likely(err == exc_type)) return 1; - if (likely(PyExceptionClass_Check(err))) { - if (likely(PyExceptionClass_Check(exc_type))) { - return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type); - } else if (likely(PyTuple_Check(exc_type))) { - return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type); - } else { +static PyObject * +__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, void *context) +{ + PyObject *frame = self->gi_frame; + CYTHON_UNUSED_VAR(context); + if (!frame) { + if (unlikely(!self->gi_code)) { + Py_RETURN_NONE; } + frame = (PyObject *) PyFrame_New( + PyThreadState_Get(), /*PyThreadState *tstate,*/ + (PyCodeObject*) self->gi_code, /*PyCodeObject *code,*/ + __pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (unlikely(!frame)) + return NULL; + self->gi_frame = frame; } - return PyErr_GivenExceptionMatches(err, exc_type); + Py_INCREF(frame); + return frame; } -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) { - assert(PyExceptionClass_Check(exc_type1)); - assert(PyExceptionClass_Check(exc_type2)); - if (likely(err == exc_type1 || err == exc_type2)) return 1; - if (likely(PyExceptionClass_Check(err))) { - return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2); +static __pyx_CoroutineObject *__Pyx__Coroutine_New( + PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name) { + __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type); + if (unlikely(!gen)) + return NULL; + return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name); +} +static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( + __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name) { + gen->body = body; + gen->closure = closure; + Py_XINCREF(closure); + gen->is_running = 0; + gen->resume_label = 0; + gen->classobj = NULL; + gen->yieldfrom = NULL; + #if PY_VERSION_HEX >= 0x030B00a4 + gen->gi_exc_state.exc_value = NULL; + #else + gen->gi_exc_state.exc_type = NULL; + gen->gi_exc_state.exc_value = NULL; + gen->gi_exc_state.exc_traceback = NULL; + #endif +#if CYTHON_USE_EXC_INFO_STACK + gen->gi_exc_state.previous_item = NULL; +#endif + gen->gi_weakreflist = NULL; + Py_XINCREF(qualname); + gen->gi_qualname = qualname; + Py_XINCREF(name); + gen->gi_name = name; + Py_XINCREF(module_name); + gen->gi_modulename = module_name; + Py_XINCREF(code); + gen->gi_code = code; + gen->gi_frame = NULL; + PyObject_GC_Track(gen); + return gen; +} + +/* PatchModuleWithCoroutine */ +static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) { +#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + int result; + PyObject *globals, *result_obj; + globals = PyDict_New(); if (unlikely(!globals)) goto ignore; + result = PyDict_SetItemString(globals, "_cython_coroutine_type", + #ifdef __Pyx_Coroutine_USED + (PyObject*)__pyx_CoroutineType); + #else + Py_None); + #endif + if (unlikely(result < 0)) goto ignore; + result = PyDict_SetItemString(globals, "_cython_generator_type", + #ifdef __Pyx_Generator_USED + (PyObject*)__pyx_GeneratorType); + #else + Py_None); + #endif + if (unlikely(result < 0)) goto ignore; + if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore; + if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore; + result_obj = PyRun_String(py_code, Py_file_input, globals, globals); + if (unlikely(!result_obj)) goto ignore; + Py_DECREF(result_obj); + Py_DECREF(globals); + return module; +ignore: + Py_XDECREF(globals); + PyErr_WriteUnraisable(module); + if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) { + Py_DECREF(module); + module = NULL; } - return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2)); +#else + py_code++; +#endif + return module; +} + +/* PatchGeneratorABC */ +#ifndef CYTHON_REGISTER_ABCS +#define CYTHON_REGISTER_ABCS 1 +#endif +#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) +static PyObject* __Pyx_patch_abc_module(PyObject *module); +static PyObject* __Pyx_patch_abc_module(PyObject *module) { + module = __Pyx_Coroutine_patch_module( + module, "" +"if _cython_generator_type is not None:\n" +" try: Generator = _module.Generator\n" +" except AttributeError: pass\n" +" else: Generator.register(_cython_generator_type)\n" +"if _cython_coroutine_type is not None:\n" +" try: Coroutine = _module.Coroutine\n" +" except AttributeError: pass\n" +" else: Coroutine.register(_cython_coroutine_type)\n" + ); + return module; +} +#endif +static int __Pyx_patch_abc(void) { +#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + static int abc_patched = 0; + if (CYTHON_REGISTER_ABCS && !abc_patched) { + PyObject *module; + module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections"); + if (unlikely(!module)) { + PyErr_WriteUnraisable(NULL); + if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, + ((PY_MAJOR_VERSION >= 3) ? + "Cython module failed to register with collections.abc module" : + "Cython module failed to register with collections module"), 1) < 0)) { + return -1; + } + } else { + module = __Pyx_patch_abc_module(module); + abc_patched = 1; + if (unlikely(!module)) + return -1; + Py_DECREF(module); + } + module = PyImport_ImportModule("backports_abc"); + if (module) { + module = __Pyx_patch_abc_module(module); + Py_XDECREF(module); + } + if (!module) { + PyErr_Clear(); + } + } +#else + if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL); +#endif + return 0; } + +/* Generator */ +static PyMethodDef __pyx_Generator_methods[] = { + {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O, + (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")}, + {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS, + (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")}, + {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS, + (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")}, + {0, 0, 0, 0} +}; +static PyMemberDef __pyx_Generator_memberlist[] = { + {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL}, + {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY, + (char*) PyDoc_STR("object being iterated by 'yield from', or None")}, + {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL}, + {(char *) "__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0}, +#if CYTHON_USE_TYPE_SPECS + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0}, +#endif + {0, 0, 0, 0, 0} +}; +static PyGetSetDef __pyx_Generator_getsets[] = { + {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name, + (char*) PyDoc_STR("name of the generator"), 0}, + {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname, + (char*) PyDoc_STR("qualified name of the generator"), 0}, + {(char *) "gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL, + (char*) PyDoc_STR("Frame of the generator"), 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_GeneratorType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc}, + {Py_tp_traverse, (void *)__Pyx_Coroutine_traverse}, + {Py_tp_iter, (void *)PyObject_SelfIter}, + {Py_tp_iternext, (void *)__Pyx_Generator_Next}, + {Py_tp_methods, (void *)__pyx_Generator_methods}, + {Py_tp_members, (void *)__pyx_Generator_memberlist}, + {Py_tp_getset, (void *)__pyx_Generator_getsets}, + {Py_tp_getattro, (void *) __Pyx_PyObject_GenericGetAttrNoDict}, +#if CYTHON_USE_TP_FINALIZE + {Py_tp_finalize, (void *)__Pyx_Coroutine_del}, +#endif + {0, 0}, +}; +static PyType_Spec __pyx_GeneratorType_spec = { + __PYX_TYPE_MODULE_PREFIX "generator", + sizeof(__pyx_CoroutineObject), + 0, + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, + __pyx_GeneratorType_slots +}; +#else +static PyTypeObject __pyx_GeneratorType_type = { + PyVarObject_HEAD_INIT(0, 0) + __PYX_TYPE_MODULE_PREFIX "generator", + sizeof(__pyx_CoroutineObject), + 0, + (destructor) __Pyx_Coroutine_dealloc, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, + 0, + (traverseproc) __Pyx_Coroutine_traverse, + 0, + 0, + offsetof(__pyx_CoroutineObject, gi_weakreflist), + 0, + (iternextfunc) __Pyx_Generator_Next, + __pyx_Generator_methods, + __pyx_Generator_memberlist, + __pyx_Generator_getsets, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +#if CYTHON_USE_TP_FINALIZE + 0, +#else + __Pyx_Coroutine_del, +#endif + 0, +#if CYTHON_USE_TP_FINALIZE + __Pyx_Coroutine_del, +#elif PY_VERSION_HEX >= 0x030400a1 + 0, +#endif +#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, +#endif +#if __PYX_NEED_TP_PRINT_SLOT + 0, +#endif +#if PY_VERSION_HEX >= 0x030C0000 + 0, #endif +#if PY_VERSION_HEX >= 0x030d00A4 + 0, +#endif +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, +#endif +}; +#endif +static int __pyx_Generator_init(PyObject *module) { +#if CYTHON_USE_TYPE_SPECS + __pyx_GeneratorType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_GeneratorType_spec, NULL); +#else + CYTHON_UNUSED_VAR(module); + __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter; + __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type); +#endif + if (unlikely(!__pyx_GeneratorType)) { + return -1; + } + return 0; +} /* CheckBinaryVersion */ static unsigned long __Pyx_get_runtime_version(void) { diff --git a/ssh2/utils.pxd b/ssh2/utils.pxd index 7209be8f..03bae2b1 100644 --- a/ssh2/utils.pxd +++ b/ssh2/utils.pxd @@ -14,9 +14,11 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + cdef extern from "ext/find_eol.h" nogil: int c_find_eol "find_eol" (char* data, int* new_pos) cdef bytes to_bytes(_str) cdef object to_str(char *c_str) cdef object to_str_len(char *c_str, int length) cpdef int handle_error_codes(int errcode) except -1 +cpdef (int, int) find_eol(bytes buf: bytes, Py_ssize_t pos: Py_ssize_t) diff --git a/ssh2/utils.pyi b/ssh2/utils.pyi new file mode 100644 index 00000000..1f8b27fc --- /dev/null +++ b/ssh2/utils.pyi @@ -0,0 +1,26 @@ +# This file is part of ssh2-python. +# Copyright (C) 2017-2025 Panos Kittenis +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation, version 2.1. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +from typing import BinaryIO, Iterable, Generator, Tuple + +from ssh2.session import Session + +def find_eol(buf: bytes, pos: int) -> Tuple[int, int]: ... +def readline(buf: Iterable[bytes]) -> Generator[bytes]: ... +def version(required_version: int = 0) -> str: ... +def ssh2_exit() -> None: ... +def wait_socket(_socket: BinaryIO, session: Session, timeout: int=1) -> None: ... +def handle_error_codes(errcode: int) -> int: ... diff --git a/ssh2/utils.pyx b/ssh2/utils.pyx index 23483e6e..de8622e7 100644 --- a/ssh2/utils.pyx +++ b/ssh2/utils.pyx @@ -15,6 +15,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA from select import select +from typing import Any, BinaryIO, Iterable, Tuple, Generator from cpython.version cimport PY_MAJOR_VERSION @@ -48,7 +49,7 @@ cdef object to_str_len(char *c_str, int length): return c_str[:length].decode(ENCODING) -def find_eol(bytes buf, Py_ssize_t pos): +cpdef (int, int) find_eol(bytes buf: bytes, Py_ssize_t pos: Py_ssize_t): """Find end-of-line in buffer from position and return end position of line and where next find_eol should start from. @@ -75,7 +76,41 @@ def find_eol(bytes buf, Py_ssize_t pos): return index, new_pos -def version(int required_version=0): +def readline(buf: Iterable[bytes]) -> Generator[bytes]: + """Returns a generator of line by line output in given iterable buffer. + + :param buf: The iterable buffer to read from. Should yield a block of data per iteration. + """ + cdef size_t pos + cdef Py_ssize_t size + cdef bytes remainder = b"" + cdef size_t remainder_len = 0 + cdef int linesep + cdef int new_line_pos + for data in buf: + pos = 0 + size = len(data) + while pos < size: + linesep, new_line_pos = find_eol(data, pos) + if linesep == -1: + remainder += data[pos:] + remainder_len = len(remainder) + break + end_of_line = pos + linesep + if remainder_len > 0: + line = remainder + data[pos:end_of_line] + remainder = b"" + remainder_len = 0 + else: + line = data[pos:end_of_line] + yield line + pos += linesep + new_line_pos + if remainder_len > 0: + # Finished reading without finding ending linesep + yield remainder + + +def version(int required_version=0) -> str: """Get libssh2 version string. Passing in a non-zero required_version causes the function to return @@ -89,15 +124,15 @@ def version(int required_version=0): version = c_ssh2.libssh2_version(required_version) if version is NULL: return - return version + return to_str(version) -def ssh2_exit(): +def ssh2_exit() -> None: """Call libssh2_exit""" c_ssh2.libssh2_exit() -def wait_socket(_socket not None, Session session, timeout=1): +def wait_socket(_socket not None: BinaryIO, Session session, timeout: int=1) -> None: """Helper function for testing non-blocking mode. This function blocks the calling thread for seconds - diff --git a/tests/test_extras.py b/tests/test_extras.py new file mode 100644 index 00000000..c3b54726 --- /dev/null +++ b/tests/test_extras.py @@ -0,0 +1,62 @@ +from unittest import TestCase +from unittest.mock import MagicMock + +from ssh2.error_codes import LIBSSH2_ERROR_EAGAIN +from ssh2.extras import eagain_errcode, eagain_write_errcode + + +class ExtrasTest(TestCase): + + def test_eagain_no_args(self): + poller = MagicMock() + my_func = MagicMock() + my_func.side_effect = [LIBSSH2_ERROR_EAGAIN, 1] + eagain_errcode(my_func, poller) + poller.assert_called_once() + + def test_eagain_no_args_no_call(self): + poller = MagicMock() + my_func = MagicMock() + my_func.return_value = 1 + eagain_errcode(my_func, poller) + poller.assert_not_called() + + def test_eagain_with_args(self): + poller = MagicMock() + my_func = MagicMock() + args = ('arg1', 'arg2') + kwargs = {'kwarg1': "value", 'kwarg2': "other value"} + expected_rc = 99 + my_func.side_effect = [LIBSSH2_ERROR_EAGAIN, expected_rc] + rc = eagain_errcode(my_func, poller, *args, **kwargs) + poller.assert_called_once() + self.assertEqual(rc, expected_rc) + my_func.assert_called_with(*args, **kwargs) + + def test_eagain_write(self): + some_data = b'some data' + my_write_func = MagicMock() + offset = 1 + my_write_func.side_effect = [ + (LIBSSH2_ERROR_EAGAIN, offset), + (0, len(some_data) - offset), + ] + poller = MagicMock() + rc = eagain_write_errcode(my_write_func, poller, some_data) + poller.assert_called_once() + self.assertIsNone(rc) + self.assertEqual(my_write_func.call_count, 2) + my_write_func.assert_called_with(some_data[offset:]) + + def test_eagain_write_no_call(self): + some_data = b'some data' + my_write_func = MagicMock() + my_write_func.side_effect = [ + (len(some_data), len(some_data)), + ] + poller = MagicMock() + rc = eagain_write_errcode(my_write_func, poller, some_data) + poller.assert_not_called() + self.assertIsNone(rc) + self.assertEqual(my_write_func.call_count, 1) + my_write_func.assert_called_once_with(some_data) diff --git a/tests/test_utils.py b/tests/test_utils.py index 176090d7..3724a1c5 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,6 +1,7 @@ import unittest +from unittest.mock import MagicMock -from ssh2.utils import find_eol +from ssh2.utils import find_eol, readline class UtilsTest(unittest.TestCase): @@ -70,3 +71,16 @@ def test_read_line_bad_data(self): linesep, new_line_pos = find_eol(b"\r", 0) self.assertEqual(linesep, -1) self.assertEqual(new_line_pos, 0) + + def test_read_line_gen(self): + lines = [b'a line', b'another line', b'third'] + lines_data = [b'a lin', b'e\nanother', b' line\nthird'] + + class MyBuf: + def __iter__(self): + for data in lines_data: + yield data + + lines_buf = MyBuf() + out_data = [line for line in readline(lines_buf)] + self.assertListEqual(lines, out_data)