diff --git a/Changelog.rst b/Changelog.rst index 68462251..abae63ae 100644 --- a/Changelog.rst +++ b/Changelog.rst @@ -1,6 +1,14 @@ Change Log ============= +0.26.0 +++++++ + +Changes +------- + +* Enabled ``ssh2.fileinfo.FileInfo`` attributes on Windows builds - #131. + 0.25.0 ++++++ diff --git a/ssh2/agent.c b/ssh2/agent.c index 1aeb50bb..f75de63f 100644 --- a/ssh2/agent.c +++ b/ssh2/agent.c @@ -607,7 +607,6 @@ static CYTHON_INLINE float __PYX_NAN() { /* Early includes */ #include #include -#include #include #include "libssh2.h" #include "find_eol.h" @@ -839,6 +838,7 @@ static const char *__pyx_f[] = { /*--- Type declarations ---*/ struct __pyx_obj_4ssh2_7session_Session; +struct __pyx_obj_4ssh2_7session_MethodType; struct __pyx_obj_4ssh2_4pkey_PublicKey; struct __pyx_obj_4ssh2_5agent_Agent; @@ -858,6 +858,18 @@ struct __pyx_obj_4ssh2_7session_Session { }; +/* "session.pxd":26 + * + * + * cdef class MethodType: # <<<<<<<<<<<<<< + * cdef int value + */ +struct __pyx_obj_4ssh2_7session_MethodType { + PyObject_HEAD + int value; +}; + + /* "pkey.pxd":23 * * @@ -1240,14 +1252,13 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'libc.time' */ -/* Module declarations from 'posix.types' */ - /* Module declarations from 'ssh2.c_stat' */ /* Module declarations from 'ssh2.c_ssh2' */ /* Module declarations from 'ssh2.session' */ static PyTypeObject *__pyx_ptype_4ssh2_7session_Session = 0; +static PyTypeObject *__pyx_ptype_4ssh2_7session_MethodType = 0; /* Module declarations from 'ssh2.pkey' */ static PyTypeObject *__pyx_ptype_4ssh2_4pkey_PublicKey = 0; @@ -4218,6 +4229,8 @@ static int __Pyx_modinit_type_import_code(void) { __Pyx_GOTREF(__pyx_t_1); __pyx_ptype_4ssh2_7session_Session = __Pyx_ImportType(__pyx_t_1, "ssh2.session", "Session", sizeof(struct __pyx_obj_4ssh2_7session_Session), __Pyx_ImportType_CheckSize_Warn); if (!__pyx_ptype_4ssh2_7session_Session) __PYX_ERR(2, 19, __pyx_L1_error) + __pyx_ptype_4ssh2_7session_MethodType = __Pyx_ImportType(__pyx_t_1, "ssh2.session", "MethodType", sizeof(struct __pyx_obj_4ssh2_7session_MethodType), __Pyx_ImportType_CheckSize_Warn); + if (!__pyx_ptype_4ssh2_7session_MethodType) __PYX_ERR(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); diff --git a/ssh2/c_ssh2.pxd b/ssh2/c_ssh2.pxd index 6f316f30..c4eac2c7 100644 --- a/ssh2/c_ssh2.pxd +++ b/ssh2/c_ssh2.pxd @@ -15,9 +15,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA from libc.time cimport time_t -from posix.types cimport blkcnt_t, blksize_t, dev_t, gid_t, ino_t, \ - nlink_t, time_t, uid_t - from c_stat cimport struct_stat @@ -57,21 +54,7 @@ cdef extern from "libssh2.h" nogil: LIBSSH2_METHOD_LANG_CS LIBSSH2_METHOD_LANG_SC - # ctypedef libssh2_uint64_t libssh2_struct_stat_size - ctypedef struct libssh2_struct_stat: - dev_t st_dev - ino_t st_ino - unsigned long st_mode - nlink_t st_nlink - uid_t st_uid - gid_t st_gid - dev_t st_rdev - libssh2_uint64_t st_size - blksize_t st_blksize - blkcnt_t st_blocks - time_t st_atime - time_t st_mtime - time_t st_ctime + ctypedef struct_stat libssh2_struct_stat ctypedef struct LIBSSH2_USERAUTH_KBDINT_PROMPT: char *text unsigned int length diff --git a/ssh2/c_stat.pxd b/ssh2/c_stat.pxd index c4cbf984..8a62ff7c 100644 --- a/ssh2/c_stat.pxd +++ b/ssh2/c_stat.pxd @@ -1,36 +1,34 @@ # This file is part of ssh2-python. # Copyright (C) 2017 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 libc.time cimport time_t -from posix.types cimport blkcnt_t, blksize_t, dev_t, gid_t, ino_t, \ - nlink_t, off_t, time_t, uid_t, mode_t cdef extern from "" nogil: cdef struct struct_stat "stat": - dev_t st_dev - ino_t st_ino - mode_t st_mode - nlink_t st_nlink - uid_t st_uid - gid_t st_gid - dev_t st_rdev - off_t st_size - blksize_t st_blksize - blkcnt_t st_blocks + long st_dev + unsigned long st_ino + unsigned long st_mode + long st_nlink + long st_uid + long st_gid + long st_rdev + unsigned long long st_size + long st_blksize + long st_blocks time_t st_atime time_t st_mtime time_t st_ctime diff --git a/ssh2/channel.c b/ssh2/channel.c index b5aa6a0e..ef6ac65a 100644 --- a/ssh2/channel.c +++ b/ssh2/channel.c @@ -607,7 +607,6 @@ static CYTHON_INLINE float __PYX_NAN() { /* Early includes */ #include #include -#include #include #include "libssh2.h" #include @@ -842,6 +841,7 @@ static const char *__pyx_f[] = { /*--- Type declarations ---*/ struct __pyx_obj_4ssh2_7session_Session; +struct __pyx_obj_4ssh2_7session_MethodType; struct __pyx_obj_4ssh2_4sftp_SFTP; struct __pyx_obj_4ssh2_7channel_Channel; @@ -861,6 +861,18 @@ struct __pyx_obj_4ssh2_7session_Session { }; +/* "session.pxd":26 + * + * + * cdef class MethodType: # <<<<<<<<<<<<<< + * cdef int value + */ +struct __pyx_obj_4ssh2_7session_MethodType { + PyObject_HEAD + int value; +}; + + /* "sftp.pxd":26 * * @@ -1204,14 +1216,13 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'libc.time' */ -/* Module declarations from 'posix.types' */ - /* Module declarations from 'ssh2.c_stat' */ /* Module declarations from 'ssh2.c_ssh2' */ /* Module declarations from 'ssh2.session' */ static PyTypeObject *__pyx_ptype_4ssh2_7session_Session = 0; +static PyTypeObject *__pyx_ptype_4ssh2_7session_MethodType = 0; /* Module declarations from 'libc.string' */ @@ -8123,6 +8134,8 @@ static int __Pyx_modinit_type_import_code(void) { __Pyx_GOTREF(__pyx_t_1); __pyx_ptype_4ssh2_7session_Session = __Pyx_ImportType(__pyx_t_1, "ssh2.session", "Session", sizeof(struct __pyx_obj_4ssh2_7session_Session), __Pyx_ImportType_CheckSize_Warn); if (!__pyx_ptype_4ssh2_7session_Session) __PYX_ERR(2, 19, __pyx_L1_error) + __pyx_ptype_4ssh2_7session_MethodType = __Pyx_ImportType(__pyx_t_1, "ssh2.session", "MethodType", sizeof(struct __pyx_obj_4ssh2_7session_MethodType), __Pyx_ImportType_CheckSize_Warn); + if (!__pyx_ptype_4ssh2_7session_MethodType) __PYX_ERR(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); diff --git a/ssh2/error_codes.c b/ssh2/error_codes.c index 0e53482a..7e31dd54 100644 --- a/ssh2/error_codes.c +++ b/ssh2/error_codes.c @@ -608,7 +608,6 @@ static CYTHON_INLINE float __PYX_NAN() { #include "libssh2.h" #include #include -#include #include #ifdef _OPENMP #include @@ -1018,8 +1017,6 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'libc.time' */ -/* Module declarations from 'posix.types' */ - /* Module declarations from 'ssh2.c_stat' */ /* Module declarations from 'ssh2.c_ssh2' */ diff --git a/ssh2/fileinfo.c b/ssh2/fileinfo.c index 0d33f5a1..6efc2080 100644 --- a/ssh2/fileinfo.c +++ b/ssh2/fileinfo.c @@ -607,7 +607,6 @@ static CYTHON_INLINE float __PYX_NAN() { /* Early includes */ #include #include -#include #include #include "libssh2.h" #include @@ -823,18 +822,6 @@ static const char *__pyx_f[] = { "ssh2/fileinfo.pyx", "stringsource", }; -/* NoFastGil.proto */ -#define __Pyx_PyGILState_Ensure PyGILState_Ensure -#define __Pyx_PyGILState_Release PyGILState_Release -#define __Pyx_FastGIL_Remember() -#define __Pyx_FastGIL_Forget() -#define __Pyx_FastGilFuncInit() - -/* ForceInitThreads.proto */ -#ifndef __PYX_FORCE_INIT_THREADS - #define __PYX_FORCE_INIT_THREADS 0 -#endif - /*--- Type declarations ---*/ struct __pyx_obj_4ssh2_8fileinfo_FileInfo; @@ -1060,38 +1047,17 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_libssh2_uint64_t(libssh2_uint64_t value); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_PY_LONG_LONG(unsigned PY_LONG_LONG value); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_long(unsigned long value); /* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_ino_t(ino_t value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_nlink_t(nlink_t value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uid_t(uid_t value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_gid_t(gid_t value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_dev_t(dev_t value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_blksize_t(blksize_t value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_blkcnt_t(blkcnt_t value); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_time_t(time_t value); -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); @@ -1122,8 +1088,6 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'libc.time' */ -/* Module declarations from 'posix.types' */ - /* Module declarations from 'ssh2.c_stat' */ /* Module declarations from 'ssh2.c_ssh2' */ @@ -1195,8 +1159,8 @@ static PyObject *__pyx_tuple__2; * """Representation of stat structure - libssh2 >= 1.7""" * * def __cinit__(self): # <<<<<<<<<<<<<< - * with nogil: - * self._stat = malloc( + * self._stat = malloc( + * sizeof(c_ssh2.libssh2_struct_stat)) */ /* Python wrapper */ @@ -1227,119 +1191,46 @@ static int __pyx_pf_4ssh2_8fileinfo_8FileInfo___cinit__(struct __pyx_obj_4ssh2_8 /* "ssh2/fileinfo.pyx":29 * * def __cinit__(self): - * with nogil: # <<<<<<<<<<<<<< - * self._stat = malloc( - * sizeof(c_ssh2.libssh2_struct_stat)) - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - - /* "ssh2/fileinfo.pyx":30 - * def __cinit__(self): - * with nogil: - * self._stat = malloc( # <<<<<<<<<<<<<< - * sizeof(c_ssh2.libssh2_struct_stat)) - * if self._stat is NULL: + * self._stat = malloc( # <<<<<<<<<<<<<< + * sizeof(c_ssh2.libssh2_struct_stat)) + * if self._stat is NULL: */ - __pyx_v_self->_stat = ((libssh2_struct_stat *)malloc((sizeof(libssh2_struct_stat)))); - - /* "ssh2/fileinfo.pyx":32 - * self._stat = malloc( - * sizeof(c_ssh2.libssh2_struct_stat)) - * if self._stat is NULL: # <<<<<<<<<<<<<< - * with gil: - * raise MemoryError - */ - __pyx_t_1 = ((__pyx_v_self->_stat == NULL) != 0); - if (__pyx_t_1) { - - /* "ssh2/fileinfo.pyx":33 - * sizeof(c_ssh2.libssh2_struct_stat)) - * if self._stat is NULL: - * with gil: # <<<<<<<<<<<<<< - * raise MemoryError + __pyx_v_self->_stat = ((libssh2_struct_stat *)malloc((sizeof(libssh2_struct_stat)))); + + /* "ssh2/fileinfo.pyx":31 + * self._stat = malloc( + * sizeof(c_ssh2.libssh2_struct_stat)) + * if self._stat is NULL: # <<<<<<<<<<<<<< + * raise MemoryError * */ - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - /*try:*/ { - - /* "ssh2/fileinfo.pyx":34 - * if self._stat is NULL: - * with gil: - * raise MemoryError # <<<<<<<<<<<<<< + __pyx_t_1 = ((__pyx_v_self->_stat == NULL) != 0); + if (unlikely(__pyx_t_1)) { + + /* "ssh2/fileinfo.pyx":32 + * sizeof(c_ssh2.libssh2_struct_stat)) + * if self._stat is NULL: + * raise MemoryError # <<<<<<<<<<<<<< * * def __dealloc__(self): */ - PyErr_NoMemory(); __PYX_ERR(0, 34, __pyx_L8_error) - } - - /* "ssh2/fileinfo.pyx":33 - * sizeof(c_ssh2.libssh2_struct_stat)) - * if self._stat is NULL: - * with gil: # <<<<<<<<<<<<<< - * raise MemoryError - * - */ - /*finally:*/ { - __pyx_L8_error: { - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - goto __pyx_L4_error; - } - } - } - - /* "ssh2/fileinfo.pyx":32 - * self._stat = malloc( - * sizeof(c_ssh2.libssh2_struct_stat)) - * if self._stat is NULL: # <<<<<<<<<<<<<< - * with gil: - * raise MemoryError - */ - } - } + PyErr_NoMemory(); __PYX_ERR(0, 32, __pyx_L1_error) - /* "ssh2/fileinfo.pyx":29 + /* "ssh2/fileinfo.pyx":31 + * self._stat = malloc( + * sizeof(c_ssh2.libssh2_struct_stat)) + * if self._stat is NULL: # <<<<<<<<<<<<<< + * raise MemoryError * - * def __cinit__(self): - * with nogil: # <<<<<<<<<<<<<< - * self._stat = malloc( - * sizeof(c_ssh2.libssh2_struct_stat)) */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L4_error: { - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L1_error; - } - __pyx_L5:; - } } /* "ssh2/fileinfo.pyx":28 * """Representation of stat structure - libssh2 >= 1.7""" * * def __cinit__(self): # <<<<<<<<<<<<<< - * with nogil: - * self._stat = malloc( + * self._stat = malloc( + * sizeof(c_ssh2.libssh2_struct_stat)) */ /* function exit code */ @@ -1353,8 +1244,8 @@ static int __pyx_pf_4ssh2_8fileinfo_8FileInfo___cinit__(struct __pyx_obj_4ssh2_8 return __pyx_r; } -/* "ssh2/fileinfo.pyx":36 - * raise MemoryError +/* "ssh2/fileinfo.pyx":34 + * raise MemoryError * * def __dealloc__(self): # <<<<<<<<<<<<<< * free(self._stat) @@ -1376,7 +1267,7 @@ static void __pyx_pf_4ssh2_8fileinfo_8FileInfo_2__dealloc__(struct __pyx_obj_4ss __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "ssh2/fileinfo.pyx":37 + /* "ssh2/fileinfo.pyx":35 * * def __dealloc__(self): * free(self._stat) # <<<<<<<<<<<<<< @@ -1385,8 +1276,8 @@ static void __pyx_pf_4ssh2_8fileinfo_8FileInfo_2__dealloc__(struct __pyx_obj_4ss */ free(__pyx_v_self->_stat); - /* "ssh2/fileinfo.pyx":36 - * raise MemoryError + /* "ssh2/fileinfo.pyx":34 + * raise MemoryError * * def __dealloc__(self): # <<<<<<<<<<<<<< * free(self._stat) @@ -1397,7 +1288,7 @@ static void __pyx_pf_4ssh2_8fileinfo_8FileInfo_2__dealloc__(struct __pyx_obj_4ss __Pyx_RefNannyFinishContext(); } -/* "ssh2/fileinfo.pyx":40 +/* "ssh2/fileinfo.pyx":38 * * @property * def st_size(self): # <<<<<<<<<<<<<< @@ -1427,7 +1318,7 @@ static PyObject *__pyx_pf_4ssh2_8fileinfo_8FileInfo_7st_size___get__(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "ssh2/fileinfo.pyx":41 + /* "ssh2/fileinfo.pyx":39 * @property * def st_size(self): * return self._stat.st_size # <<<<<<<<<<<<<< @@ -1435,13 +1326,13 @@ static PyObject *__pyx_pf_4ssh2_8fileinfo_8FileInfo_7st_size___get__(struct __py * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_libssh2_uint64_t(__pyx_v_self->_stat->st_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_self->_stat->st_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/fileinfo.pyx":40 + /* "ssh2/fileinfo.pyx":38 * * @property * def st_size(self): # <<<<<<<<<<<<<< @@ -1460,7 +1351,7 @@ static PyObject *__pyx_pf_4ssh2_8fileinfo_8FileInfo_7st_size___get__(struct __py return __pyx_r; } -/* "ssh2/fileinfo.pyx":44 +/* "ssh2/fileinfo.pyx":42 * * @property * def st_mode(self): # <<<<<<<<<<<<<< @@ -1490,21 +1381,21 @@ static PyObject *__pyx_pf_4ssh2_8fileinfo_8FileInfo_7st_mode___get__(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "ssh2/fileinfo.pyx":45 + /* "ssh2/fileinfo.pyx":43 * @property * def st_mode(self): * return self._stat.st_mode # <<<<<<<<<<<<<< * - * IF UNAME_SYSNAME != "Windows": + * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->_stat->st_mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->_stat->st_mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/fileinfo.pyx":44 + /* "ssh2/fileinfo.pyx":42 * * @property * def st_mode(self): # <<<<<<<<<<<<<< @@ -1523,11 +1414,11 @@ static PyObject *__pyx_pf_4ssh2_8fileinfo_8FileInfo_7st_mode___get__(struct __py return __pyx_r; } -/* "ssh2/fileinfo.pyx":49 - * IF UNAME_SYSNAME != "Windows": - * @property - * def st_ino(self): # <<<<<<<<<<<<<< - * return self._stat.st_ino +/* "ssh2/fileinfo.pyx":46 + * + * @property + * def st_ino(self): # <<<<<<<<<<<<<< + * return self._stat.st_ino * */ @@ -1553,25 +1444,25 @@ static PyObject *__pyx_pf_4ssh2_8fileinfo_8FileInfo_6st_ino___get__(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "ssh2/fileinfo.pyx":50 - * @property - * def st_ino(self): - * return self._stat.st_ino # <<<<<<<<<<<<<< + /* "ssh2/fileinfo.pyx":47 + * @property + * def st_ino(self): + * return self._stat.st_ino # <<<<<<<<<<<<<< * - * @property + * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_ino_t(__pyx_v_self->_stat->st_ino); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->_stat->st_ino); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/fileinfo.pyx":49 - * IF UNAME_SYSNAME != "Windows": - * @property - * def st_ino(self): # <<<<<<<<<<<<<< - * return self._stat.st_ino + /* "ssh2/fileinfo.pyx":46 + * + * @property + * def st_ino(self): # <<<<<<<<<<<<<< + * return self._stat.st_ino * */ @@ -1586,11 +1477,11 @@ static PyObject *__pyx_pf_4ssh2_8fileinfo_8FileInfo_6st_ino___get__(struct __pyx return __pyx_r; } -/* "ssh2/fileinfo.pyx":53 +/* "ssh2/fileinfo.pyx":50 * - * @property - * def st_nlink(self): # <<<<<<<<<<<<<< - * return self._stat.st_nlink + * @property + * def st_nlink(self): # <<<<<<<<<<<<<< + * return self._stat.st_nlink * */ @@ -1616,25 +1507,25 @@ static PyObject *__pyx_pf_4ssh2_8fileinfo_8FileInfo_8st_nlink___get__(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "ssh2/fileinfo.pyx":54 - * @property - * def st_nlink(self): - * return self._stat.st_nlink # <<<<<<<<<<<<<< + /* "ssh2/fileinfo.pyx":51 + * @property + * def st_nlink(self): + * return self._stat.st_nlink # <<<<<<<<<<<<<< * - * @property + * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_nlink_t(__pyx_v_self->_stat->st_nlink); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_self->_stat->st_nlink); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/fileinfo.pyx":53 + /* "ssh2/fileinfo.pyx":50 * - * @property - * def st_nlink(self): # <<<<<<<<<<<<<< - * return self._stat.st_nlink + * @property + * def st_nlink(self): # <<<<<<<<<<<<<< + * return self._stat.st_nlink * */ @@ -1649,11 +1540,11 @@ static PyObject *__pyx_pf_4ssh2_8fileinfo_8FileInfo_8st_nlink___get__(struct __p return __pyx_r; } -/* "ssh2/fileinfo.pyx":57 +/* "ssh2/fileinfo.pyx":54 * - * @property - * def st_uid(self): # <<<<<<<<<<<<<< - * return self._stat.st_uid + * @property + * def st_uid(self): # <<<<<<<<<<<<<< + * return self._stat.st_uid * */ @@ -1679,25 +1570,25 @@ static PyObject *__pyx_pf_4ssh2_8fileinfo_8FileInfo_6st_uid___get__(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "ssh2/fileinfo.pyx":58 - * @property - * def st_uid(self): - * return self._stat.st_uid # <<<<<<<<<<<<<< + /* "ssh2/fileinfo.pyx":55 + * @property + * def st_uid(self): + * return self._stat.st_uid # <<<<<<<<<<<<<< * - * @property + * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_uid_t(__pyx_v_self->_stat->st_uid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_self->_stat->st_uid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/fileinfo.pyx":57 + /* "ssh2/fileinfo.pyx":54 * - * @property - * def st_uid(self): # <<<<<<<<<<<<<< - * return self._stat.st_uid + * @property + * def st_uid(self): # <<<<<<<<<<<<<< + * return self._stat.st_uid * */ @@ -1712,11 +1603,11 @@ static PyObject *__pyx_pf_4ssh2_8fileinfo_8FileInfo_6st_uid___get__(struct __pyx return __pyx_r; } -/* "ssh2/fileinfo.pyx":61 +/* "ssh2/fileinfo.pyx":58 * - * @property - * def st_gid(self): # <<<<<<<<<<<<<< - * return self._stat.st_gid + * @property + * def st_gid(self): # <<<<<<<<<<<<<< + * return self._stat.st_gid * */ @@ -1742,25 +1633,25 @@ static PyObject *__pyx_pf_4ssh2_8fileinfo_8FileInfo_6st_gid___get__(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "ssh2/fileinfo.pyx":62 - * @property - * def st_gid(self): - * return self._stat.st_gid # <<<<<<<<<<<<<< + /* "ssh2/fileinfo.pyx":59 + * @property + * def st_gid(self): + * return self._stat.st_gid # <<<<<<<<<<<<<< * - * @property + * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_gid_t(__pyx_v_self->_stat->st_gid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_self->_stat->st_gid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/fileinfo.pyx":61 + /* "ssh2/fileinfo.pyx":58 * - * @property - * def st_gid(self): # <<<<<<<<<<<<<< - * return self._stat.st_gid + * @property + * def st_gid(self): # <<<<<<<<<<<<<< + * return self._stat.st_gid * */ @@ -1775,11 +1666,11 @@ static PyObject *__pyx_pf_4ssh2_8fileinfo_8FileInfo_6st_gid___get__(struct __pyx return __pyx_r; } -/* "ssh2/fileinfo.pyx":65 +/* "ssh2/fileinfo.pyx":62 * - * @property - * def st_rdev(self): # <<<<<<<<<<<<<< - * return self._stat.st_rdev + * @property + * def st_rdev(self): # <<<<<<<<<<<<<< + * return self._stat.st_rdev * */ @@ -1805,25 +1696,25 @@ static PyObject *__pyx_pf_4ssh2_8fileinfo_8FileInfo_7st_rdev___get__(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "ssh2/fileinfo.pyx":66 - * @property - * def st_rdev(self): - * return self._stat.st_rdev # <<<<<<<<<<<<<< + /* "ssh2/fileinfo.pyx":63 + * @property + * def st_rdev(self): + * return self._stat.st_rdev # <<<<<<<<<<<<<< * - * @property + * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_dev_t(__pyx_v_self->_stat->st_rdev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_self->_stat->st_rdev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/fileinfo.pyx":65 + /* "ssh2/fileinfo.pyx":62 * - * @property - * def st_rdev(self): # <<<<<<<<<<<<<< - * return self._stat.st_rdev + * @property + * def st_rdev(self): # <<<<<<<<<<<<<< + * return self._stat.st_rdev * */ @@ -1838,12 +1729,12 @@ static PyObject *__pyx_pf_4ssh2_8fileinfo_8FileInfo_7st_rdev___get__(struct __py return __pyx_r; } -/* "ssh2/fileinfo.pyx":69 +/* "ssh2/fileinfo.pyx":66 * - * @property - * def st_blksize(self): # <<<<<<<<<<<<<< + * @property + * def st_blksize(self): # <<<<<<<<<<<<<< + * IF UNAME_SYSNAME != 'Windows': * return self._stat.st_blksize - * */ /* Python wrapper */ @@ -1868,26 +1759,26 @@ static PyObject *__pyx_pf_4ssh2_8fileinfo_8FileInfo_10st_blksize___get__(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "ssh2/fileinfo.pyx":70 - * @property - * def st_blksize(self): + /* "ssh2/fileinfo.pyx":68 + * def st_blksize(self): + * IF UNAME_SYSNAME != 'Windows': * return self._stat.st_blksize # <<<<<<<<<<<<<< - * - * @property + * ELSE: + * return None */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_blksize_t(__pyx_v_self->_stat->st_blksize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_self->_stat->st_blksize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/fileinfo.pyx":69 + /* "ssh2/fileinfo.pyx":66 * - * @property - * def st_blksize(self): # <<<<<<<<<<<<<< + * @property + * def st_blksize(self): # <<<<<<<<<<<<<< + * IF UNAME_SYSNAME != 'Windows': * return self._stat.st_blksize - * */ /* function exit code */ @@ -1903,10 +1794,10 @@ static PyObject *__pyx_pf_4ssh2_8fileinfo_8FileInfo_10st_blksize___get__(struct /* "ssh2/fileinfo.pyx":73 * - * @property - * def st_blocks(self): # <<<<<<<<<<<<<< + * @property + * def st_blocks(self): # <<<<<<<<<<<<<< + * IF UNAME_SYSNAME != 'Windows': * return self._stat.st_blocks - * */ /* Python wrapper */ @@ -1931,15 +1822,15 @@ static PyObject *__pyx_pf_4ssh2_8fileinfo_8FileInfo_9st_blocks___get__(struct __ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "ssh2/fileinfo.pyx":74 - * @property - * def st_blocks(self): + /* "ssh2/fileinfo.pyx":75 + * def st_blocks(self): + * IF UNAME_SYSNAME != 'Windows': * return self._stat.st_blocks # <<<<<<<<<<<<<< - * - * @property + * ELSE: + * return None */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_blkcnt_t(__pyx_v_self->_stat->st_blocks); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_self->_stat->st_blocks); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1947,10 +1838,10 @@ static PyObject *__pyx_pf_4ssh2_8fileinfo_8FileInfo_9st_blocks___get__(struct __ /* "ssh2/fileinfo.pyx":73 * - * @property - * def st_blocks(self): # <<<<<<<<<<<<<< + * @property + * def st_blocks(self): # <<<<<<<<<<<<<< + * IF UNAME_SYSNAME != 'Windows': * return self._stat.st_blocks - * */ /* function exit code */ @@ -1964,11 +1855,11 @@ static PyObject *__pyx_pf_4ssh2_8fileinfo_8FileInfo_9st_blocks___get__(struct __ return __pyx_r; } -/* "ssh2/fileinfo.pyx":77 +/* "ssh2/fileinfo.pyx":80 * - * @property - * def st_atime(self): # <<<<<<<<<<<<<< - * return self._stat.st_atime + * @property + * def st_atime(self): # <<<<<<<<<<<<<< + * return self._stat.st_atime * */ @@ -1994,25 +1885,25 @@ static PyObject *__pyx_pf_4ssh2_8fileinfo_8FileInfo_8st_atime___get__(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "ssh2/fileinfo.pyx":78 - * @property - * def st_atime(self): - * return self._stat.st_atime # <<<<<<<<<<<<<< + /* "ssh2/fileinfo.pyx":81 + * @property + * def st_atime(self): + * return self._stat.st_atime # <<<<<<<<<<<<<< * - * @property + * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_time_t(__pyx_v_self->_stat->st_atime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_time_t(__pyx_v_self->_stat->st_atime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/fileinfo.pyx":77 + /* "ssh2/fileinfo.pyx":80 * - * @property - * def st_atime(self): # <<<<<<<<<<<<<< - * return self._stat.st_atime + * @property + * def st_atime(self): # <<<<<<<<<<<<<< + * return self._stat.st_atime * */ @@ -2027,11 +1918,11 @@ static PyObject *__pyx_pf_4ssh2_8fileinfo_8FileInfo_8st_atime___get__(struct __p return __pyx_r; } -/* "ssh2/fileinfo.pyx":81 +/* "ssh2/fileinfo.pyx":84 * - * @property - * def st_mtime(self): # <<<<<<<<<<<<<< - * return self._stat.st_mtime + * @property + * def st_mtime(self): # <<<<<<<<<<<<<< + * return self._stat.st_mtime * */ @@ -2057,25 +1948,25 @@ static PyObject *__pyx_pf_4ssh2_8fileinfo_8FileInfo_8st_mtime___get__(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "ssh2/fileinfo.pyx":82 - * @property - * def st_mtime(self): - * return self._stat.st_mtime # <<<<<<<<<<<<<< + /* "ssh2/fileinfo.pyx":85 + * @property + * def st_mtime(self): + * return self._stat.st_mtime # <<<<<<<<<<<<<< * - * @property + * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_time_t(__pyx_v_self->_stat->st_mtime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_time_t(__pyx_v_self->_stat->st_mtime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/fileinfo.pyx":81 + /* "ssh2/fileinfo.pyx":84 * - * @property - * def st_mtime(self): # <<<<<<<<<<<<<< - * return self._stat.st_mtime + * @property + * def st_mtime(self): # <<<<<<<<<<<<<< + * return self._stat.st_mtime * */ @@ -2090,11 +1981,11 @@ static PyObject *__pyx_pf_4ssh2_8fileinfo_8FileInfo_8st_mtime___get__(struct __p return __pyx_r; } -/* "ssh2/fileinfo.pyx":85 +/* "ssh2/fileinfo.pyx":88 * - * @property - * def st_ctime(self): # <<<<<<<<<<<<<< - * return self._stat.st_ctime + * @property + * def st_ctime(self): # <<<<<<<<<<<<<< + * return self._stat.st_ctime */ /* Python wrapper */ @@ -2119,23 +2010,23 @@ static PyObject *__pyx_pf_4ssh2_8fileinfo_8FileInfo_8st_ctime___get__(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "ssh2/fileinfo.pyx":86 - * @property - * def st_ctime(self): - * return self._stat.st_ctime # <<<<<<<<<<<<<< + /* "ssh2/fileinfo.pyx":89 + * @property + * def st_ctime(self): + * return self._stat.st_ctime # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_time_t(__pyx_v_self->_stat->st_ctime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_time_t(__pyx_v_self->_stat->st_ctime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/fileinfo.pyx":85 + /* "ssh2/fileinfo.pyx":88 * - * @property - * def st_ctime(self): # <<<<<<<<<<<<<< - * return self._stat.st_ctime + * @property + * def st_ctime(self): # <<<<<<<<<<<<<< + * return self._stat.st_ctime */ /* function exit code */ @@ -2498,7 +2389,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 34, __pyx_L1_error) + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 32, __pyx_L1_error) __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error) return 0; __pyx_L1_error:; @@ -3587,24 +3478,24 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_libssh2_uint64_t(libssh2_uint64_t value) { - const libssh2_uint64_t neg_one = (libssh2_uint64_t) ((libssh2_uint64_t) 0 - (libssh2_uint64_t) 1), const_zero = (libssh2_uint64_t) 0; +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_PY_LONG_LONG(unsigned PY_LONG_LONG value) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG) ((unsigned PY_LONG_LONG) 0 - (unsigned PY_LONG_LONG) 1), const_zero = (unsigned PY_LONG_LONG) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { - if (sizeof(libssh2_uint64_t) < sizeof(long)) { + if (sizeof(unsigned PY_LONG_LONG) < sizeof(long)) { return PyInt_FromLong((long) value); - } else if (sizeof(libssh2_uint64_t) <= sizeof(unsigned long)) { + } else if (sizeof(unsigned PY_LONG_LONG) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(libssh2_uint64_t) <= sizeof(unsigned PY_LONG_LONG)) { + } else if (sizeof(unsigned PY_LONG_LONG) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { - if (sizeof(libssh2_uint64_t) <= sizeof(long)) { + if (sizeof(unsigned PY_LONG_LONG) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(libssh2_uint64_t) <= sizeof(PY_LONG_LONG)) { + } else if (sizeof(unsigned PY_LONG_LONG) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } @@ -3612,7 +3503,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_libssh2_uint64_t(libssh2_uint64_ { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(libssh2_uint64_t), + return _PyLong_FromByteArray(bytes, sizeof(unsigned PY_LONG_LONG), little, !is_unsigned); } } @@ -3649,210 +3540,24 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_long(unsigned long valu } /* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_ino_t(ino_t value) { - const ino_t neg_one = (ino_t) ((ino_t) 0 - (ino_t) 1), const_zero = (ino_t) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(ino_t) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(ino_t) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(ino_t) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(ino_t) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(ino_t) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(ino_t), - little, !is_unsigned); - } -} - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_nlink_t(nlink_t value) { - const nlink_t neg_one = (nlink_t) ((nlink_t) 0 - (nlink_t) 1), const_zero = (nlink_t) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(nlink_t) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(nlink_t) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(nlink_t) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(nlink_t) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(nlink_t) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(nlink_t), - little, !is_unsigned); - } -} - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uid_t(uid_t value) { - const uid_t neg_one = (uid_t) ((uid_t) 0 - (uid_t) 1), const_zero = (uid_t) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(uid_t) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(uid_t) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(uid_t) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(uid_t) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(uid_t) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(uid_t), - little, !is_unsigned); - } -} - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_gid_t(gid_t value) { - const gid_t neg_one = (gid_t) ((gid_t) 0 - (gid_t) 1), const_zero = (gid_t) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(gid_t) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(gid_t) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(gid_t) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(gid_t) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(gid_t) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(gid_t), - little, !is_unsigned); - } -} - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_dev_t(dev_t value) { - const dev_t neg_one = (dev_t) ((dev_t) 0 - (dev_t) 1), const_zero = (dev_t) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(dev_t) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(dev_t) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(dev_t) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(dev_t) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(dev_t) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(dev_t), - little, !is_unsigned); - } -} - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_blksize_t(blksize_t value) { - const blksize_t neg_one = (blksize_t) ((blksize_t) 0 - (blksize_t) 1), const_zero = (blksize_t) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(blksize_t) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(blksize_t) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(blksize_t) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(blksize_t) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(blksize_t) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(blksize_t), - little, !is_unsigned); - } -} - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_blkcnt_t(blkcnt_t value) { - const blkcnt_t neg_one = (blkcnt_t) ((blkcnt_t) 0 - (blkcnt_t) 1), const_zero = (blkcnt_t) 0; +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { + const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { - if (sizeof(blkcnt_t) < sizeof(long)) { + if (sizeof(long) < sizeof(long)) { return PyInt_FromLong((long) value); - } else if (sizeof(blkcnt_t) <= sizeof(unsigned long)) { + } else if (sizeof(long) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(blkcnt_t) <= sizeof(unsigned PY_LONG_LONG)) { + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { - if (sizeof(blkcnt_t) <= sizeof(long)) { + if (sizeof(long) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(blkcnt_t) <= sizeof(PY_LONG_LONG)) { + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } @@ -3860,7 +3565,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_blkcnt_t(blkcnt_t value) { { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(blkcnt_t), + return _PyLong_FromByteArray(bytes, sizeof(long), little, !is_unsigned); } } @@ -3896,37 +3601,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_time_t(time_t value) { } } -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; - 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 - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); - } -} - /* CIntFromPyVerify */ #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) diff --git a/ssh2/fileinfo.pyx b/ssh2/fileinfo.pyx index 6288b46c..61053794 100644 --- a/ssh2/fileinfo.pyx +++ b/ssh2/fileinfo.pyx @@ -26,12 +26,10 @@ IF EMBEDDED_LIB: """Representation of stat structure - libssh2 >= 1.7""" def __cinit__(self): - with nogil: - self._stat = malloc( - sizeof(c_ssh2.libssh2_struct_stat)) - if self._stat is NULL: - with gil: - raise MemoryError + self._stat = malloc( + sizeof(c_ssh2.libssh2_struct_stat)) + if self._stat is NULL: + raise MemoryError def __dealloc__(self): free(self._stat) @@ -44,43 +42,48 @@ IF EMBEDDED_LIB: def st_mode(self): return self._stat.st_mode - IF UNAME_SYSNAME != "Windows": - @property - def st_ino(self): - return self._stat.st_ino + @property + def st_ino(self): + return self._stat.st_ino - @property - def st_nlink(self): - return self._stat.st_nlink + @property + def st_nlink(self): + return self._stat.st_nlink - @property - def st_uid(self): - return self._stat.st_uid + @property + def st_uid(self): + return self._stat.st_uid - @property - def st_gid(self): - return self._stat.st_gid + @property + def st_gid(self): + return self._stat.st_gid - @property - def st_rdev(self): - return self._stat.st_rdev + @property + def st_rdev(self): + return self._stat.st_rdev - @property - def st_blksize(self): + @property + def st_blksize(self): + IF UNAME_SYSNAME != 'Windows': return self._stat.st_blksize + ELSE: + return None - @property - def st_blocks(self): + @property + def st_blocks(self): + IF UNAME_SYSNAME != 'Windows': return self._stat.st_blocks + ELSE: + return None - @property - def st_atime(self): - return self._stat.st_atime + @property + def st_atime(self): + return self._stat.st_atime - @property - def st_mtime(self): - return self._stat.st_mtime + @property + def st_mtime(self): + return self._stat.st_mtime - @property - def st_ctime(self): - return self._stat.st_ctime + @property + def st_ctime(self): + return self._stat.st_ctime diff --git a/ssh2/knownhost.c b/ssh2/knownhost.c index cfeb20c1..ab50b495 100644 --- a/ssh2/knownhost.c +++ b/ssh2/knownhost.c @@ -607,7 +607,6 @@ static CYTHON_INLINE float __PYX_NAN() { /* Early includes */ #include #include -#include #include #include "libssh2.h" #include @@ -840,6 +839,7 @@ static const char *__pyx_f[] = { /*--- Type declarations ---*/ struct __pyx_obj_4ssh2_7session_Session; +struct __pyx_obj_4ssh2_7session_MethodType; struct __pyx_obj_4ssh2_9knownhost_KnownHostEntry; struct __pyx_obj_4ssh2_9knownhost_KnownHost; @@ -859,6 +859,18 @@ struct __pyx_obj_4ssh2_7session_Session { }; +/* "session.pxd":26 + * + * + * cdef class MethodType: # <<<<<<<<<<<<<< + * cdef int value + */ +struct __pyx_obj_4ssh2_7session_MethodType { + PyObject_HEAD + int value; +}; + + /* "ssh2/knownhost.pxd":24 * * @@ -1287,14 +1299,13 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'libc.time' */ -/* Module declarations from 'posix.types' */ - /* Module declarations from 'ssh2.c_stat' */ /* Module declarations from 'ssh2.c_ssh2' */ /* Module declarations from 'ssh2.session' */ static PyTypeObject *__pyx_ptype_4ssh2_7session_Session = 0; +static PyTypeObject *__pyx_ptype_4ssh2_7session_MethodType = 0; /* Module declarations from 'libc.string' */ @@ -6750,6 +6761,8 @@ static int __Pyx_modinit_type_import_code(void) { __Pyx_GOTREF(__pyx_t_1); __pyx_ptype_4ssh2_7session_Session = __Pyx_ImportType(__pyx_t_1, "ssh2.session", "Session", sizeof(struct __pyx_obj_4ssh2_7session_Session), __Pyx_ImportType_CheckSize_Warn); if (!__pyx_ptype_4ssh2_7session_Session) __PYX_ERR(2, 19, __pyx_L1_error) + __pyx_ptype_4ssh2_7session_MethodType = __Pyx_ImportType(__pyx_t_1, "ssh2.session", "MethodType", sizeof(struct __pyx_obj_4ssh2_7session_MethodType), __Pyx_ImportType_CheckSize_Warn); + if (!__pyx_ptype_4ssh2_7session_MethodType) __PYX_ERR(2, 26, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; diff --git a/ssh2/listener.c b/ssh2/listener.c index 6f353a48..9c460001 100644 --- a/ssh2/listener.c +++ b/ssh2/listener.c @@ -607,7 +607,6 @@ static CYTHON_INLINE float __PYX_NAN() { /* Early includes */ #include #include -#include #include #include "libssh2.h" #include "find_eol.h" @@ -839,6 +838,7 @@ static const char *__pyx_f[] = { /*--- Type declarations ---*/ struct __pyx_obj_4ssh2_7session_Session; +struct __pyx_obj_4ssh2_7session_MethodType; struct __pyx_obj_4ssh2_7channel_Channel; struct __pyx_obj_4ssh2_8listener_Listener; @@ -858,6 +858,18 @@ struct __pyx_obj_4ssh2_7session_Session { }; +/* "session.pxd":26 + * + * + * cdef class MethodType: # <<<<<<<<<<<<<< + * cdef int value + */ +struct __pyx_obj_4ssh2_7session_MethodType { + PyObject_HEAD + int value; +}; + + /* "channel.pxd":24 * * @@ -1154,14 +1166,13 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'libc.time' */ -/* Module declarations from 'posix.types' */ - /* Module declarations from 'ssh2.c_stat' */ /* Module declarations from 'ssh2.c_ssh2' */ /* Module declarations from 'ssh2.session' */ static PyTypeObject *__pyx_ptype_4ssh2_7session_Session = 0; +static PyTypeObject *__pyx_ptype_4ssh2_7session_MethodType = 0; /* Module declarations from 'ssh2.channel' */ static PyTypeObject *__pyx_ptype_4ssh2_7channel_Channel = 0; @@ -2105,6 +2116,8 @@ static int __Pyx_modinit_type_import_code(void) { __Pyx_GOTREF(__pyx_t_1); __pyx_ptype_4ssh2_7session_Session = __Pyx_ImportType(__pyx_t_1, "ssh2.session", "Session", sizeof(struct __pyx_obj_4ssh2_7session_Session), __Pyx_ImportType_CheckSize_Warn); if (!__pyx_ptype_4ssh2_7session_Session) __PYX_ERR(2, 19, __pyx_L1_error) + __pyx_ptype_4ssh2_7session_MethodType = __Pyx_ImportType(__pyx_t_1, "ssh2.session", "MethodType", sizeof(struct __pyx_obj_4ssh2_7session_MethodType), __Pyx_ImportType_CheckSize_Warn); + if (!__pyx_ptype_4ssh2_7session_MethodType) __PYX_ERR(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); diff --git a/ssh2/pkey.c b/ssh2/pkey.c index 0d5e6e1d..d7f5edf5 100644 --- a/ssh2/pkey.c +++ b/ssh2/pkey.c @@ -607,7 +607,6 @@ static CYTHON_INLINE float __PYX_NAN() { /* Early includes */ #include #include -#include #include #include "libssh2.h" #ifdef _OPENMP @@ -1083,8 +1082,6 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'libc.time' */ -/* Module declarations from 'posix.types' */ - /* Module declarations from 'ssh2.c_stat' */ /* Module declarations from 'ssh2.c_ssh2' */ diff --git a/ssh2/publickey.c b/ssh2/publickey.c index 64c42fbc..79089fb8 100644 --- a/ssh2/publickey.c +++ b/ssh2/publickey.c @@ -607,7 +607,6 @@ static CYTHON_INLINE float __PYX_NAN() { /* Early includes */ #include #include -#include #include #include "libssh2.h" #include "libssh2_publickey.h" @@ -841,6 +840,7 @@ static const char *__pyx_f[] = { /*--- Type declarations ---*/ struct __pyx_obj_4ssh2_7session_Session; +struct __pyx_obj_4ssh2_7session_MethodType; struct __pyx_obj_4ssh2_9publickey_PublicKeyList; struct __pyx_obj_4ssh2_9publickey_PublicKeyAttribute; struct __pyx_obj_4ssh2_9publickey_PublicKeySystem; @@ -861,6 +861,18 @@ struct __pyx_obj_4ssh2_7session_Session { }; +/* "session.pxd":26 + * + * + * cdef class MethodType: # <<<<<<<<<<<<<< + * cdef int value + */ +struct __pyx_obj_4ssh2_7session_MethodType { + PyObject_HEAD + int value; +}; + + /* "ssh2/publickey.pyx":30 * * @@ -1245,14 +1257,13 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'libc.time' */ -/* Module declarations from 'posix.types' */ - /* Module declarations from 'ssh2.c_stat' */ /* Module declarations from 'ssh2.c_ssh2' */ /* Module declarations from 'ssh2.session' */ static PyTypeObject *__pyx_ptype_4ssh2_7session_Session = 0; +static PyTypeObject *__pyx_ptype_4ssh2_7session_MethodType = 0; /* Module declarations from 'ssh2.c_pkey' */ @@ -5652,6 +5663,8 @@ static int __Pyx_modinit_type_import_code(void) { __Pyx_GOTREF(__pyx_t_1); __pyx_ptype_4ssh2_7session_Session = __Pyx_ImportType(__pyx_t_1, "ssh2.session", "Session", sizeof(struct __pyx_obj_4ssh2_7session_Session), __Pyx_ImportType_CheckSize_Warn); if (!__pyx_ptype_4ssh2_7session_Session) __PYX_ERR(2, 19, __pyx_L1_error) + __pyx_ptype_4ssh2_7session_MethodType = __Pyx_ImportType(__pyx_t_1, "ssh2.session", "MethodType", sizeof(struct __pyx_obj_4ssh2_7session_MethodType), __Pyx_ImportType_CheckSize_Warn); + if (!__pyx_ptype_4ssh2_7session_MethodType) __PYX_ERR(2, 26, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; diff --git a/ssh2/session.c b/ssh2/session.c index 601aa4bc..e2f5483f 100644 --- a/ssh2/session.c +++ b/ssh2/session.c @@ -607,7 +607,6 @@ static CYTHON_INLINE float __PYX_NAN() { /* Early includes */ #include #include -#include #include #include "libssh2.h" #include @@ -1507,8 +1506,6 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'libc.time' */ -/* Module declarations from 'posix.types' */ - /* Module declarations from 'ssh2.c_stat' */ /* Module declarations from 'ssh2.c_ssh2' */ diff --git a/ssh2/sftp.c b/ssh2/sftp.c index 8a3f2179..ba0b31d9 100644 --- a/ssh2/sftp.c +++ b/ssh2/sftp.c @@ -607,7 +607,6 @@ static CYTHON_INLINE float __PYX_NAN() { /* Early includes */ #include #include -#include #include #include "libssh2.h" #include "libssh2_sftp.h" @@ -843,6 +842,7 @@ static const char *__pyx_f[] = { /*--- Type declarations ---*/ struct __pyx_obj_4ssh2_7session_Session; +struct __pyx_obj_4ssh2_7session_MethodType; struct __pyx_obj_4ssh2_7channel_Channel; struct __pyx_obj_4ssh2_11sftp_handle_SFTPHandle; struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes; @@ -865,6 +865,18 @@ struct __pyx_obj_4ssh2_7session_Session { }; +/* "session.pxd":26 + * + * + * cdef class MethodType: # <<<<<<<<<<<<<< + * cdef int value + */ +struct __pyx_obj_4ssh2_7session_MethodType { + PyObject_HEAD + int value; +}; + + /* "channel.pxd":24 * * @@ -1298,14 +1310,13 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'libc.time' */ -/* Module declarations from 'posix.types' */ - /* Module declarations from 'ssh2.c_stat' */ /* Module declarations from 'ssh2.c_ssh2' */ /* Module declarations from 'ssh2.session' */ static PyTypeObject *__pyx_ptype_4ssh2_7session_Session = 0; +static PyTypeObject *__pyx_ptype_4ssh2_7session_MethodType = 0; /* Module declarations from 'ssh2.c_sftp' */ @@ -5585,6 +5596,8 @@ static int __Pyx_modinit_type_import_code(void) { __Pyx_GOTREF(__pyx_t_1); __pyx_ptype_4ssh2_7session_Session = __Pyx_ImportType(__pyx_t_1, "ssh2.session", "Session", sizeof(struct __pyx_obj_4ssh2_7session_Session), __Pyx_ImportType_CheckSize_Warn); if (!__pyx_ptype_4ssh2_7session_Session) __PYX_ERR(2, 19, __pyx_L1_error) + __pyx_ptype_4ssh2_7session_MethodType = __Pyx_ImportType(__pyx_t_1, "ssh2.session", "MethodType", sizeof(struct __pyx_obj_4ssh2_7session_MethodType), __Pyx_ImportType_CheckSize_Warn); + if (!__pyx_ptype_4ssh2_7session_MethodType) __PYX_ERR(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); diff --git a/ssh2/sftp_handle.c b/ssh2/sftp_handle.c index 9bee4bc0..20fae208 100644 --- a/ssh2/sftp_handle.c +++ b/ssh2/sftp_handle.c @@ -607,7 +607,6 @@ static CYTHON_INLINE float __PYX_NAN() { /* Early includes */ #include #include -#include #include #include "libssh2.h" #include "libssh2_sftp.h" @@ -842,6 +841,7 @@ static const char *__pyx_f[] = { /*--- Type declarations ---*/ struct __pyx_obj_4ssh2_7session_Session; +struct __pyx_obj_4ssh2_7session_MethodType; struct __pyx_obj_4ssh2_4sftp_SFTP; struct __pyx_obj_4ssh2_11sftp_handle_SFTPHandle; struct __pyx_obj_4ssh2_11sftp_handle_SFTPAttributes; @@ -865,6 +865,18 @@ struct __pyx_obj_4ssh2_7session_Session { }; +/* "session.pxd":26 + * + * + * cdef class MethodType: # <<<<<<<<<<<<<< + * cdef int value + */ +struct __pyx_obj_4ssh2_7session_MethodType { + PyObject_HEAD + int value; +}; + + /* "sftp.pxd":26 * * @@ -1429,14 +1441,13 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'libc.time' */ -/* Module declarations from 'posix.types' */ - /* Module declarations from 'ssh2.c_stat' */ /* Module declarations from 'ssh2.c_ssh2' */ /* Module declarations from 'ssh2.session' */ static PyTypeObject *__pyx_ptype_4ssh2_7session_Session = 0; +static PyTypeObject *__pyx_ptype_4ssh2_7session_MethodType = 0; /* Module declarations from 'ssh2.c_sftp' */ @@ -9821,6 +9832,8 @@ static int __Pyx_modinit_type_import_code(void) { __Pyx_GOTREF(__pyx_t_1); __pyx_ptype_4ssh2_7session_Session = __Pyx_ImportType(__pyx_t_1, "ssh2.session", "Session", sizeof(struct __pyx_obj_4ssh2_7session_Session), __Pyx_ImportType_CheckSize_Warn); if (!__pyx_ptype_4ssh2_7session_Session) __PYX_ERR(2, 19, __pyx_L1_error) + __pyx_ptype_4ssh2_7session_MethodType = __Pyx_ImportType(__pyx_t_1, "ssh2.session", "MethodType", sizeof(struct __pyx_obj_4ssh2_7session_MethodType), __Pyx_ImportType_CheckSize_Warn); + if (!__pyx_ptype_4ssh2_7session_MethodType) __PYX_ERR(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); diff --git a/ssh2/statinfo.c b/ssh2/statinfo.c index 3104f979..57add5b0 100644 --- a/ssh2/statinfo.c +++ b/ssh2/statinfo.c @@ -607,7 +607,6 @@ static CYTHON_INLINE float __PYX_NAN() { /* Early includes */ #include #include -#include #include #include #include @@ -822,18 +821,6 @@ static const char *__pyx_f[] = { "ssh2/statinfo.pyx", "stringsource", }; -/* NoFastGil.proto */ -#define __Pyx_PyGILState_Ensure PyGILState_Ensure -#define __Pyx_PyGILState_Release PyGILState_Release -#define __Pyx_FastGIL_Remember() -#define __Pyx_FastGIL_Forget() -#define __Pyx_FastGilFuncInit() - -/* ForceInitThreads.proto */ -#ifndef __PYX_FORCE_INIT_THREADS - #define __PYX_FORCE_INIT_THREADS 0 -#endif - /*--- Type declarations ---*/ struct __pyx_obj_4ssh2_8statinfo_StatInfo; @@ -1059,38 +1046,17 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_off_t(off_t value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_ino_t(ino_t value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_mode_t(mode_t value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_nlink_t(nlink_t value); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_PY_LONG_LONG(unsigned PY_LONG_LONG value); /* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uid_t(uid_t value); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_long(unsigned long value); /* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_gid_t(gid_t value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_dev_t(dev_t value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_blksize_t(blksize_t value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_blkcnt_t(blkcnt_t value); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_time_t(time_t value); -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); @@ -1121,8 +1087,6 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'libc.time' */ -/* Module declarations from 'posix.types' */ - /* Module declarations from 'ssh2.c_stat' */ /* Module declarations from 'libc.string' */ @@ -1191,8 +1155,8 @@ static PyObject *__pyx_tuple__2; * """Representation of stat structure - libssh2 <1.7 version""" * * def __cinit__(self): # <<<<<<<<<<<<<< - * with nogil: - * self._stat = malloc( + * self._stat = malloc( + * sizeof(struct_stat)) */ /* Python wrapper */ @@ -1223,119 +1187,46 @@ static int __pyx_pf_4ssh2_8statinfo_8StatInfo___cinit__(struct __pyx_obj_4ssh2_8 /* "ssh2/statinfo.pyx":25 * * def __cinit__(self): - * with nogil: # <<<<<<<<<<<<<< - * self._stat = malloc( - * sizeof(struct_stat)) - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - - /* "ssh2/statinfo.pyx":26 - * def __cinit__(self): - * with nogil: - * self._stat = malloc( # <<<<<<<<<<<<<< - * sizeof(struct_stat)) - * if self._stat is NULL: + * self._stat = malloc( # <<<<<<<<<<<<<< + * sizeof(struct_stat)) + * if self._stat is NULL: */ - __pyx_v_self->_stat = ((struct stat *)malloc((sizeof(struct stat)))); - - /* "ssh2/statinfo.pyx":28 - * self._stat = malloc( - * sizeof(struct_stat)) - * if self._stat is NULL: # <<<<<<<<<<<<<< - * with gil: - * raise MemoryError - */ - __pyx_t_1 = ((__pyx_v_self->_stat == NULL) != 0); - if (__pyx_t_1) { - - /* "ssh2/statinfo.pyx":29 - * sizeof(struct_stat)) - * if self._stat is NULL: - * with gil: # <<<<<<<<<<<<<< - * raise MemoryError + __pyx_v_self->_stat = ((struct stat *)malloc((sizeof(struct stat)))); + + /* "ssh2/statinfo.pyx":27 + * self._stat = malloc( + * sizeof(struct_stat)) + * if self._stat is NULL: # <<<<<<<<<<<<<< + * raise MemoryError * */ - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - /*try:*/ { - - /* "ssh2/statinfo.pyx":30 - * if self._stat is NULL: - * with gil: - * raise MemoryError # <<<<<<<<<<<<<< + __pyx_t_1 = ((__pyx_v_self->_stat == NULL) != 0); + if (unlikely(__pyx_t_1)) { + + /* "ssh2/statinfo.pyx":28 + * sizeof(struct_stat)) + * if self._stat is NULL: + * raise MemoryError # <<<<<<<<<<<<<< * * def __dealloc__(self): */ - PyErr_NoMemory(); __PYX_ERR(0, 30, __pyx_L8_error) - } - - /* "ssh2/statinfo.pyx":29 - * sizeof(struct_stat)) - * if self._stat is NULL: - * with gil: # <<<<<<<<<<<<<< - * raise MemoryError - * - */ - /*finally:*/ { - __pyx_L8_error: { - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - goto __pyx_L4_error; - } - } - } - - /* "ssh2/statinfo.pyx":28 - * self._stat = malloc( - * sizeof(struct_stat)) - * if self._stat is NULL: # <<<<<<<<<<<<<< - * with gil: - * raise MemoryError - */ - } - } + PyErr_NoMemory(); __PYX_ERR(0, 28, __pyx_L1_error) - /* "ssh2/statinfo.pyx":25 + /* "ssh2/statinfo.pyx":27 + * self._stat = malloc( + * sizeof(struct_stat)) + * if self._stat is NULL: # <<<<<<<<<<<<<< + * raise MemoryError * - * def __cinit__(self): - * with nogil: # <<<<<<<<<<<<<< - * self._stat = malloc( - * sizeof(struct_stat)) */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L4_error: { - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L1_error; - } - __pyx_L5:; - } } /* "ssh2/statinfo.pyx":24 * """Representation of stat structure - libssh2 <1.7 version""" * * def __cinit__(self): # <<<<<<<<<<<<<< - * with nogil: - * self._stat = malloc( + * self._stat = malloc( + * sizeof(struct_stat)) */ /* function exit code */ @@ -1349,8 +1240,8 @@ static int __pyx_pf_4ssh2_8statinfo_8StatInfo___cinit__(struct __pyx_obj_4ssh2_8 return __pyx_r; } -/* "ssh2/statinfo.pyx":32 - * raise MemoryError +/* "ssh2/statinfo.pyx":30 + * raise MemoryError * * def __dealloc__(self): # <<<<<<<<<<<<<< * free(self._stat) @@ -1372,7 +1263,7 @@ static void __pyx_pf_4ssh2_8statinfo_8StatInfo_2__dealloc__(struct __pyx_obj_4ss __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "ssh2/statinfo.pyx":33 + /* "ssh2/statinfo.pyx":31 * * def __dealloc__(self): * free(self._stat) # <<<<<<<<<<<<<< @@ -1381,8 +1272,8 @@ static void __pyx_pf_4ssh2_8statinfo_8StatInfo_2__dealloc__(struct __pyx_obj_4ss */ free(__pyx_v_self->_stat); - /* "ssh2/statinfo.pyx":32 - * raise MemoryError + /* "ssh2/statinfo.pyx":30 + * raise MemoryError * * def __dealloc__(self): # <<<<<<<<<<<<<< * free(self._stat) @@ -1393,7 +1284,7 @@ static void __pyx_pf_4ssh2_8statinfo_8StatInfo_2__dealloc__(struct __pyx_obj_4ss __Pyx_RefNannyFinishContext(); } -/* "ssh2/statinfo.pyx":36 +/* "ssh2/statinfo.pyx":34 * * @property * def st_size(self): # <<<<<<<<<<<<<< @@ -1423,21 +1314,21 @@ static PyObject *__pyx_pf_4ssh2_8statinfo_8StatInfo_7st_size___get__(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "ssh2/statinfo.pyx":37 + /* "ssh2/statinfo.pyx":35 * @property * def st_size(self): * return self._stat.st_size # <<<<<<<<<<<<<< * - * IF UNAME_SYSNAME != "Windows": + * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_off_t(__pyx_v_self->_stat->st_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_self->_stat->st_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/statinfo.pyx":36 + /* "ssh2/statinfo.pyx":34 * * @property * def st_size(self): # <<<<<<<<<<<<<< @@ -1456,11 +1347,11 @@ static PyObject *__pyx_pf_4ssh2_8statinfo_8StatInfo_7st_size___get__(struct __py return __pyx_r; } -/* "ssh2/statinfo.pyx":41 - * IF UNAME_SYSNAME != "Windows": - * @property - * def st_ino(self): # <<<<<<<<<<<<<< - * return self._stat.st_ino +/* "ssh2/statinfo.pyx":38 + * + * @property + * def st_ino(self): # <<<<<<<<<<<<<< + * return self._stat.st_ino * */ @@ -1486,25 +1377,25 @@ static PyObject *__pyx_pf_4ssh2_8statinfo_8StatInfo_6st_ino___get__(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "ssh2/statinfo.pyx":42 - * @property - * def st_ino(self): - * return self._stat.st_ino # <<<<<<<<<<<<<< + /* "ssh2/statinfo.pyx":39 + * @property + * def st_ino(self): + * return self._stat.st_ino # <<<<<<<<<<<<<< * - * @property + * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_ino_t(__pyx_v_self->_stat->st_ino); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->_stat->st_ino); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/statinfo.pyx":41 - * IF UNAME_SYSNAME != "Windows": - * @property - * def st_ino(self): # <<<<<<<<<<<<<< - * return self._stat.st_ino + /* "ssh2/statinfo.pyx":38 + * + * @property + * def st_ino(self): # <<<<<<<<<<<<<< + * return self._stat.st_ino * */ @@ -1519,11 +1410,11 @@ static PyObject *__pyx_pf_4ssh2_8statinfo_8StatInfo_6st_ino___get__(struct __pyx return __pyx_r; } -/* "ssh2/statinfo.pyx":45 +/* "ssh2/statinfo.pyx":42 * - * @property - * def st_mode(self): # <<<<<<<<<<<<<< - * return self._stat.st_mode + * @property + * def st_mode(self): # <<<<<<<<<<<<<< + * return self._stat.st_mode * */ @@ -1549,25 +1440,25 @@ static PyObject *__pyx_pf_4ssh2_8statinfo_8StatInfo_7st_mode___get__(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "ssh2/statinfo.pyx":46 - * @property - * def st_mode(self): - * return self._stat.st_mode # <<<<<<<<<<<<<< + /* "ssh2/statinfo.pyx":43 + * @property + * def st_mode(self): + * return self._stat.st_mode # <<<<<<<<<<<<<< * - * @property + * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_mode_t(__pyx_v_self->_stat->st_mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->_stat->st_mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/statinfo.pyx":45 + /* "ssh2/statinfo.pyx":42 * - * @property - * def st_mode(self): # <<<<<<<<<<<<<< - * return self._stat.st_mode + * @property + * def st_mode(self): # <<<<<<<<<<<<<< + * return self._stat.st_mode * */ @@ -1582,11 +1473,11 @@ static PyObject *__pyx_pf_4ssh2_8statinfo_8StatInfo_7st_mode___get__(struct __py return __pyx_r; } -/* "ssh2/statinfo.pyx":49 +/* "ssh2/statinfo.pyx":46 * - * @property - * def st_nlink(self): # <<<<<<<<<<<<<< - * return self._stat.st_nlink + * @property + * def st_nlink(self): # <<<<<<<<<<<<<< + * return self._stat.st_nlink * */ @@ -1612,25 +1503,25 @@ static PyObject *__pyx_pf_4ssh2_8statinfo_8StatInfo_8st_nlink___get__(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "ssh2/statinfo.pyx":50 - * @property - * def st_nlink(self): - * return self._stat.st_nlink # <<<<<<<<<<<<<< + /* "ssh2/statinfo.pyx":47 + * @property + * def st_nlink(self): + * return self._stat.st_nlink # <<<<<<<<<<<<<< * - * @property + * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_nlink_t(__pyx_v_self->_stat->st_nlink); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_self->_stat->st_nlink); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/statinfo.pyx":49 + /* "ssh2/statinfo.pyx":46 * - * @property - * def st_nlink(self): # <<<<<<<<<<<<<< - * return self._stat.st_nlink + * @property + * def st_nlink(self): # <<<<<<<<<<<<<< + * return self._stat.st_nlink * */ @@ -1645,11 +1536,11 @@ static PyObject *__pyx_pf_4ssh2_8statinfo_8StatInfo_8st_nlink___get__(struct __p return __pyx_r; } -/* "ssh2/statinfo.pyx":53 +/* "ssh2/statinfo.pyx":50 * - * @property - * def st_uid(self): # <<<<<<<<<<<<<< - * return self._stat.st_uid + * @property + * def st_uid(self): # <<<<<<<<<<<<<< + * return self._stat.st_uid * */ @@ -1675,25 +1566,25 @@ static PyObject *__pyx_pf_4ssh2_8statinfo_8StatInfo_6st_uid___get__(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "ssh2/statinfo.pyx":54 - * @property - * def st_uid(self): - * return self._stat.st_uid # <<<<<<<<<<<<<< + /* "ssh2/statinfo.pyx":51 + * @property + * def st_uid(self): + * return self._stat.st_uid # <<<<<<<<<<<<<< * - * @property + * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_uid_t(__pyx_v_self->_stat->st_uid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_self->_stat->st_uid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/statinfo.pyx":53 + /* "ssh2/statinfo.pyx":50 * - * @property - * def st_uid(self): # <<<<<<<<<<<<<< - * return self._stat.st_uid + * @property + * def st_uid(self): # <<<<<<<<<<<<<< + * return self._stat.st_uid * */ @@ -1708,11 +1599,11 @@ static PyObject *__pyx_pf_4ssh2_8statinfo_8StatInfo_6st_uid___get__(struct __pyx return __pyx_r; } -/* "ssh2/statinfo.pyx":57 +/* "ssh2/statinfo.pyx":54 * - * @property - * def st_gid(self): # <<<<<<<<<<<<<< - * return self._stat.st_gid + * @property + * def st_gid(self): # <<<<<<<<<<<<<< + * return self._stat.st_gid * */ @@ -1738,25 +1629,25 @@ static PyObject *__pyx_pf_4ssh2_8statinfo_8StatInfo_6st_gid___get__(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "ssh2/statinfo.pyx":58 - * @property - * def st_gid(self): - * return self._stat.st_gid # <<<<<<<<<<<<<< + /* "ssh2/statinfo.pyx":55 + * @property + * def st_gid(self): + * return self._stat.st_gid # <<<<<<<<<<<<<< * - * @property + * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_gid_t(__pyx_v_self->_stat->st_gid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_self->_stat->st_gid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/statinfo.pyx":57 + /* "ssh2/statinfo.pyx":54 * - * @property - * def st_gid(self): # <<<<<<<<<<<<<< - * return self._stat.st_gid + * @property + * def st_gid(self): # <<<<<<<<<<<<<< + * return self._stat.st_gid * */ @@ -1771,11 +1662,11 @@ static PyObject *__pyx_pf_4ssh2_8statinfo_8StatInfo_6st_gid___get__(struct __pyx return __pyx_r; } -/* "ssh2/statinfo.pyx":61 +/* "ssh2/statinfo.pyx":58 * - * @property - * def st_rdev(self): # <<<<<<<<<<<<<< - * return self._stat.st_rdev + * @property + * def st_rdev(self): # <<<<<<<<<<<<<< + * return self._stat.st_rdev * */ @@ -1801,25 +1692,25 @@ static PyObject *__pyx_pf_4ssh2_8statinfo_8StatInfo_7st_rdev___get__(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "ssh2/statinfo.pyx":62 - * @property - * def st_rdev(self): - * return self._stat.st_rdev # <<<<<<<<<<<<<< + /* "ssh2/statinfo.pyx":59 + * @property + * def st_rdev(self): + * return self._stat.st_rdev # <<<<<<<<<<<<<< * - * @property + * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_dev_t(__pyx_v_self->_stat->st_rdev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_self->_stat->st_rdev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/statinfo.pyx":61 + /* "ssh2/statinfo.pyx":58 * - * @property - * def st_rdev(self): # <<<<<<<<<<<<<< - * return self._stat.st_rdev + * @property + * def st_rdev(self): # <<<<<<<<<<<<<< + * return self._stat.st_rdev * */ @@ -1834,12 +1725,12 @@ static PyObject *__pyx_pf_4ssh2_8statinfo_8StatInfo_7st_rdev___get__(struct __py return __pyx_r; } -/* "ssh2/statinfo.pyx":65 +/* "ssh2/statinfo.pyx":62 * - * @property - * def st_blksize(self): # <<<<<<<<<<<<<< + * @property + * def st_blksize(self): # <<<<<<<<<<<<<< + * IF UNAME_SYSNAME != 'Windows': * return self._stat.st_blksize - * */ /* Python wrapper */ @@ -1864,26 +1755,26 @@ static PyObject *__pyx_pf_4ssh2_8statinfo_8StatInfo_10st_blksize___get__(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "ssh2/statinfo.pyx":66 - * @property - * def st_blksize(self): + /* "ssh2/statinfo.pyx":64 + * def st_blksize(self): + * IF UNAME_SYSNAME != 'Windows': * return self._stat.st_blksize # <<<<<<<<<<<<<< - * - * @property + * ELSE: + * return None */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_blksize_t(__pyx_v_self->_stat->st_blksize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_self->_stat->st_blksize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/statinfo.pyx":65 + /* "ssh2/statinfo.pyx":62 * - * @property - * def st_blksize(self): # <<<<<<<<<<<<<< + * @property + * def st_blksize(self): # <<<<<<<<<<<<<< + * IF UNAME_SYSNAME != 'Windows': * return self._stat.st_blksize - * */ /* function exit code */ @@ -1899,10 +1790,10 @@ static PyObject *__pyx_pf_4ssh2_8statinfo_8StatInfo_10st_blksize___get__(struct /* "ssh2/statinfo.pyx":69 * - * @property - * def st_blocks(self): # <<<<<<<<<<<<<< + * @property + * def st_blocks(self): # <<<<<<<<<<<<<< + * IF UNAME_SYSNAME != 'Windows': * return self._stat.st_blocks - * */ /* Python wrapper */ @@ -1927,15 +1818,15 @@ static PyObject *__pyx_pf_4ssh2_8statinfo_8StatInfo_9st_blocks___get__(struct __ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "ssh2/statinfo.pyx":70 - * @property - * def st_blocks(self): + /* "ssh2/statinfo.pyx":71 + * def st_blocks(self): + * IF UNAME_SYSNAME != 'Windows': * return self._stat.st_blocks # <<<<<<<<<<<<<< - * - * @property + * ELSE: + * return None */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_blkcnt_t(__pyx_v_self->_stat->st_blocks); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_self->_stat->st_blocks); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1943,10 +1834,10 @@ static PyObject *__pyx_pf_4ssh2_8statinfo_8StatInfo_9st_blocks___get__(struct __ /* "ssh2/statinfo.pyx":69 * - * @property - * def st_blocks(self): # <<<<<<<<<<<<<< + * @property + * def st_blocks(self): # <<<<<<<<<<<<<< + * IF UNAME_SYSNAME != 'Windows': * return self._stat.st_blocks - * */ /* function exit code */ @@ -1960,11 +1851,11 @@ static PyObject *__pyx_pf_4ssh2_8statinfo_8StatInfo_9st_blocks___get__(struct __ return __pyx_r; } -/* "ssh2/statinfo.pyx":73 +/* "ssh2/statinfo.pyx":76 * - * @property - * def st_atime(self): # <<<<<<<<<<<<<< - * return self._stat.st_atime + * @property + * def st_atime(self): # <<<<<<<<<<<<<< + * return self._stat.st_atime * */ @@ -1990,25 +1881,25 @@ static PyObject *__pyx_pf_4ssh2_8statinfo_8StatInfo_8st_atime___get__(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "ssh2/statinfo.pyx":74 - * @property - * def st_atime(self): - * return self._stat.st_atime # <<<<<<<<<<<<<< + /* "ssh2/statinfo.pyx":77 + * @property + * def st_atime(self): + * return self._stat.st_atime # <<<<<<<<<<<<<< * - * @property + * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_time_t(__pyx_v_self->_stat->st_atime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_time_t(__pyx_v_self->_stat->st_atime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/statinfo.pyx":73 + /* "ssh2/statinfo.pyx":76 * - * @property - * def st_atime(self): # <<<<<<<<<<<<<< - * return self._stat.st_atime + * @property + * def st_atime(self): # <<<<<<<<<<<<<< + * return self._stat.st_atime * */ @@ -2023,11 +1914,11 @@ static PyObject *__pyx_pf_4ssh2_8statinfo_8StatInfo_8st_atime___get__(struct __p return __pyx_r; } -/* "ssh2/statinfo.pyx":77 +/* "ssh2/statinfo.pyx":80 * - * @property - * def st_mtime(self): # <<<<<<<<<<<<<< - * return self._stat.st_mtime + * @property + * def st_mtime(self): # <<<<<<<<<<<<<< + * return self._stat.st_mtime * */ @@ -2053,25 +1944,25 @@ static PyObject *__pyx_pf_4ssh2_8statinfo_8StatInfo_8st_mtime___get__(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "ssh2/statinfo.pyx":78 - * @property - * def st_mtime(self): - * return self._stat.st_mtime # <<<<<<<<<<<<<< + /* "ssh2/statinfo.pyx":81 + * @property + * def st_mtime(self): + * return self._stat.st_mtime # <<<<<<<<<<<<<< * - * @property + * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_time_t(__pyx_v_self->_stat->st_mtime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_time_t(__pyx_v_self->_stat->st_mtime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/statinfo.pyx":77 + /* "ssh2/statinfo.pyx":80 * - * @property - * def st_mtime(self): # <<<<<<<<<<<<<< - * return self._stat.st_mtime + * @property + * def st_mtime(self): # <<<<<<<<<<<<<< + * return self._stat.st_mtime * */ @@ -2086,11 +1977,11 @@ static PyObject *__pyx_pf_4ssh2_8statinfo_8StatInfo_8st_mtime___get__(struct __p return __pyx_r; } -/* "ssh2/statinfo.pyx":81 +/* "ssh2/statinfo.pyx":84 * - * @property - * def st_ctime(self): # <<<<<<<<<<<<<< - * return self._stat.st_ctime + * @property + * def st_ctime(self): # <<<<<<<<<<<<<< + * return self._stat.st_ctime */ /* Python wrapper */ @@ -2115,23 +2006,23 @@ static PyObject *__pyx_pf_4ssh2_8statinfo_8StatInfo_8st_ctime___get__(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "ssh2/statinfo.pyx":82 - * @property - * def st_ctime(self): - * return self._stat.st_ctime # <<<<<<<<<<<<<< + /* "ssh2/statinfo.pyx":85 + * @property + * def st_ctime(self): + * return self._stat.st_ctime # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_time_t(__pyx_v_self->_stat->st_ctime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_time_t(__pyx_v_self->_stat->st_ctime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "ssh2/statinfo.pyx":81 + /* "ssh2/statinfo.pyx":84 * - * @property - * def st_ctime(self): # <<<<<<<<<<<<<< - * return self._stat.st_ctime + * @property + * def st_ctime(self): # <<<<<<<<<<<<<< + * return self._stat.st_ctime */ /* function exit code */ @@ -2494,7 +2385,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 30, __pyx_L1_error) + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 28, __pyx_L1_error) __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error) return 0; __pyx_L1_error:; @@ -3583,55 +3474,24 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_off_t(off_t value) { - const off_t neg_one = (off_t) ((off_t) 0 - (off_t) 1), const_zero = (off_t) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(off_t) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(off_t) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(off_t) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(off_t) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(off_t) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(off_t), - little, !is_unsigned); - } -} - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_ino_t(ino_t value) { - const ino_t neg_one = (ino_t) ((ino_t) 0 - (ino_t) 1), const_zero = (ino_t) 0; +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_PY_LONG_LONG(unsigned PY_LONG_LONG value) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG) ((unsigned PY_LONG_LONG) 0 - (unsigned PY_LONG_LONG) 1), const_zero = (unsigned PY_LONG_LONG) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { - if (sizeof(ino_t) < sizeof(long)) { + if (sizeof(unsigned PY_LONG_LONG) < sizeof(long)) { return PyInt_FromLong((long) value); - } else if (sizeof(ino_t) <= sizeof(unsigned long)) { + } else if (sizeof(unsigned PY_LONG_LONG) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(ino_t) <= sizeof(unsigned PY_LONG_LONG)) { + } else if (sizeof(unsigned PY_LONG_LONG) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { - if (sizeof(ino_t) <= sizeof(long)) { + if (sizeof(unsigned PY_LONG_LONG) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(ino_t) <= sizeof(PY_LONG_LONG)) { + } else if (sizeof(unsigned PY_LONG_LONG) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } @@ -3639,30 +3499,30 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_ino_t(ino_t value) { { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(ino_t), + return _PyLong_FromByteArray(bytes, sizeof(unsigned PY_LONG_LONG), little, !is_unsigned); } } /* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_mode_t(mode_t value) { - const mode_t neg_one = (mode_t) ((mode_t) 0 - (mode_t) 1), const_zero = (mode_t) 0; +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_long(unsigned long value) { + const unsigned long neg_one = (unsigned long) ((unsigned long) 0 - (unsigned long) 1), const_zero = (unsigned long) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { - if (sizeof(mode_t) < sizeof(long)) { + if (sizeof(unsigned long) < sizeof(long)) { return PyInt_FromLong((long) value); - } else if (sizeof(mode_t) <= sizeof(unsigned long)) { + } else if (sizeof(unsigned long) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(mode_t) <= sizeof(unsigned PY_LONG_LONG)) { + } else if (sizeof(unsigned long) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { - if (sizeof(mode_t) <= sizeof(long)) { + if (sizeof(unsigned long) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(mode_t) <= sizeof(PY_LONG_LONG)) { + } else if (sizeof(unsigned long) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } @@ -3670,185 +3530,30 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_mode_t(mode_t value) { { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(mode_t), + return _PyLong_FromByteArray(bytes, sizeof(unsigned long), little, !is_unsigned); } } /* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_nlink_t(nlink_t value) { - const nlink_t neg_one = (nlink_t) ((nlink_t) 0 - (nlink_t) 1), const_zero = (nlink_t) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(nlink_t) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(nlink_t) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(nlink_t) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(nlink_t) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(nlink_t) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(nlink_t), - little, !is_unsigned); - } -} - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uid_t(uid_t value) { - const uid_t neg_one = (uid_t) ((uid_t) 0 - (uid_t) 1), const_zero = (uid_t) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(uid_t) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(uid_t) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(uid_t) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(uid_t) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(uid_t) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(uid_t), - little, !is_unsigned); - } -} - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_gid_t(gid_t value) { - const gid_t neg_one = (gid_t) ((gid_t) 0 - (gid_t) 1), const_zero = (gid_t) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(gid_t) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(gid_t) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(gid_t) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(gid_t) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(gid_t) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(gid_t), - little, !is_unsigned); - } -} - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_dev_t(dev_t value) { - const dev_t neg_one = (dev_t) ((dev_t) 0 - (dev_t) 1), const_zero = (dev_t) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(dev_t) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(dev_t) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(dev_t) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(dev_t) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(dev_t) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(dev_t), - little, !is_unsigned); - } -} - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_blksize_t(blksize_t value) { - const blksize_t neg_one = (blksize_t) ((blksize_t) 0 - (blksize_t) 1), const_zero = (blksize_t) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(blksize_t) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(blksize_t) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(blksize_t) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(blksize_t) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(blksize_t) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(blksize_t), - little, !is_unsigned); - } -} - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_blkcnt_t(blkcnt_t value) { - const blkcnt_t neg_one = (blkcnt_t) ((blkcnt_t) 0 - (blkcnt_t) 1), const_zero = (blkcnt_t) 0; +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { + const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { - if (sizeof(blkcnt_t) < sizeof(long)) { + if (sizeof(long) < sizeof(long)) { return PyInt_FromLong((long) value); - } else if (sizeof(blkcnt_t) <= sizeof(unsigned long)) { + } else if (sizeof(long) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(blkcnt_t) <= sizeof(unsigned PY_LONG_LONG)) { + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { - if (sizeof(blkcnt_t) <= sizeof(long)) { + if (sizeof(long) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(blkcnt_t) <= sizeof(PY_LONG_LONG)) { + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } @@ -3856,7 +3561,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_blkcnt_t(blkcnt_t value) { { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(blkcnt_t), + return _PyLong_FromByteArray(bytes, sizeof(long), little, !is_unsigned); } } @@ -3892,37 +3597,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_time_t(time_t value) { } } -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; - 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 - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); - } -} - /* CIntFromPyVerify */ #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) diff --git a/ssh2/statinfo.pyx b/ssh2/statinfo.pyx index 3541c40c..c2d0b7d6 100644 --- a/ssh2/statinfo.pyx +++ b/ssh2/statinfo.pyx @@ -22,12 +22,10 @@ cdef class StatInfo: """Representation of stat structure - libssh2 <1.7 version""" def __cinit__(self): - with nogil: - self._stat = malloc( - sizeof(struct_stat)) - if self._stat is NULL: - with gil: - raise MemoryError + self._stat = malloc( + sizeof(struct_stat)) + if self._stat is NULL: + raise MemoryError def __dealloc__(self): free(self._stat) @@ -36,47 +34,52 @@ cdef class StatInfo: def st_size(self): return self._stat.st_size - IF UNAME_SYSNAME != "Windows": - @property - def st_ino(self): - return self._stat.st_ino + @property + def st_ino(self): + return self._stat.st_ino - @property - def st_mode(self): - return self._stat.st_mode + @property + def st_mode(self): + return self._stat.st_mode - @property - def st_nlink(self): - return self._stat.st_nlink + @property + def st_nlink(self): + return self._stat.st_nlink - @property - def st_uid(self): - return self._stat.st_uid + @property + def st_uid(self): + return self._stat.st_uid - @property - def st_gid(self): - return self._stat.st_gid + @property + def st_gid(self): + return self._stat.st_gid - @property - def st_rdev(self): - return self._stat.st_rdev + @property + def st_rdev(self): + return self._stat.st_rdev - @property - def st_blksize(self): + @property + def st_blksize(self): + IF UNAME_SYSNAME != 'Windows': return self._stat.st_blksize + ELSE: + return None - @property - def st_blocks(self): + @property + def st_blocks(self): + IF UNAME_SYSNAME != 'Windows': return self._stat.st_blocks + ELSE: + return None - @property - def st_atime(self): - return self._stat.st_atime + @property + def st_atime(self): + return self._stat.st_atime - @property - def st_mtime(self): - return self._stat.st_mtime + @property + def st_mtime(self): + return self._stat.st_mtime - @property - def st_ctime(self): - return self._stat.st_ctime + @property + def st_ctime(self): + return self._stat.st_ctime diff --git a/ssh2/utils.c b/ssh2/utils.c index 0d7696b4..de6b0ccd 100644 --- a/ssh2/utils.c +++ b/ssh2/utils.c @@ -608,7 +608,6 @@ static CYTHON_INLINE float __PYX_NAN() { #include "find_eol.h" #include #include -#include #include #include "libssh2.h" #ifdef _OPENMP @@ -1187,8 +1186,6 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'libc.time' */ -/* Module declarations from 'posix.types' */ - /* Module declarations from 'ssh2.c_stat' */ /* Module declarations from 'ssh2.c_ssh2' */