diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 2121dc3..0964bcc 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -12,21 +12,14 @@ jobs: runs-on: ${{ matrix.platform }} strategy: matrix: - platform: ["ubuntu-20.04"] - python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"] - include: - - platform: "ubuntu-18.04" - python-version: "2.7" -# - platform: "ubuntu-18.04" -# python-version: "3.4" - - platform: "ubuntu-18.04" - python-version: "3.6" + platform: ["ubuntu-22.04"] + python-version: ["3.8", "3.9", "3.10", "3.11"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} @@ -36,8 +29,9 @@ jobs: - name: Install dependencies run: | + python --version python -m pip install --upgrade pip setuptools wheel - pip install coverage[toml] virtualenv tox tox-gh-actions + pip install coverage[toml] virtualenv tox tox-gh-actions cython - name: Test with tox run: tox @@ -46,7 +40,7 @@ jobs: # from https://github.com/codecov/codecov-action - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v3 with: files: ./coverage.xml fail_ci_if_error: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e7b0b28..aa3be6d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,14 +12,14 @@ jobs: runs-on: ${{ matrix.platform }} strategy: matrix: - platform: [ubuntu-latest] - python-version: ["2.7", "3.6", "3.10"] + platform: ["ubuntu-22.04"] + python-version: ["3.8", "3.11"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} @@ -29,8 +29,9 @@ jobs: - name: Install dependencies run: | + python --version python -m pip install --upgrade pip setuptools wheel - pip install virtualenv tox tox-gh-actions + pip install virtualenv tox tox-gh-actions cython - name: Test Lint run: tox -e lint,radon diff --git a/.gitignore b/.gitignore index bee5ab2..2df0619 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,13 @@ MANIFEST *.egg-info *.swp *~ + +# autogenerated cython files +**/_*.c + +# htmlcov +htmlcov +.coverage +coverage.xml + +.idea diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f5afaec --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM quay.io/pypa/manylinux_2_28_x86_64 + +RUN yum install -y keyutils-libs-devel +RUN <<-EOF + python_versions=("38" "39" "310" "311") + for version in "${python_versions[@]}"; do + PYBIN="/opt/python/cp$version-cp$version/bin" + "${PYBIN}/pip" install cython + done +EOF + +COPY buildwheels.sh /bin/ +ENTRYPOINT ["/bin/buildwheels.sh"] +CMD ["manylinux_2_28_x86_64"] diff --git a/MANIFEST.in b/MANIFEST.in index 3ebad3e..ed0e0e5 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,2 @@ include AUTHORS ChangeLog INSTALL LICENSE README.rst TODO -include keyutils/_keyutils.c +include keyutils/_keyutils.c keyutils/_keyutils.pyx diff --git a/buildwheels.sh b/buildwheels.sh new file mode 100755 index 0000000..3ce4510 --- /dev/null +++ b/buildwheels.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -e -u -x +python_versions=("38" "39" "310" "311") +PLAT="$1" + +function repair_wheel { + wheel="$1" + if ! auditwheel show "$wheel"; then + echo "Skipping non-platform wheel $wheel" + else + auditwheel repair "$wheel" --plat "$PLAT" -w /io/dist/ + fi +} + +# Compile wheels +for version in "${python_versions[@]}"; do + PYBIN="/opt/python/cp$version-cp$version/bin" + "${PYBIN}/pip" wheel /io/ --no-deps -w dist/ + repair_wheel dist/*-cp$version-cp$version*whl +done diff --git a/keyutils/_keyutils.c b/keyutils/_keyutils.c deleted file mode 100644 index 2ad5f4a..0000000 --- a/keyutils/_keyutils.c +++ /dev/null @@ -1,6933 +0,0 @@ -/* Generated by Cython 0.29.3 */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#ifndef Py_PYTHON_H - #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) - #error Cython requires Python 2.6+ or Python 3.3+. -#else -#define CYTHON_ABI "0_29_3" -#define CYTHON_HEX_VERSION 0x001D03F0 -#define CYTHON_FUTURE_DIVISION 0 -#include -#ifndef offsetof - #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) -#endif -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif -#endif -#ifndef DL_IMPORT - #define DL_IMPORT(t) t -#endif -#ifndef DL_EXPORT - #define DL_EXPORT(t) t -#endif -#define __PYX_COMMA , -#ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x02070000 - #define HAVE_LONG_LONG - #endif -#endif -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG -#endif -#ifndef Py_HUGE_VAL - #define Py_HUGE_VAL HUGE_VAL -#endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #undef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 0 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #if PY_VERSION_HEX < 0x03050000 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #undef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 1 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 -#elif defined(PYSTON_VERSION) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 -#else - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 1 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) - #define CYTHON_USE_PYTYPE_LOOKUP 1 - #endif - #if PY_MAJOR_VERSION < 3 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) - #define CYTHON_USE_PYLONG_INTERNALS 1 - #endif - #ifndef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 1 - #endif - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #if PY_VERSION_HEX < 0x030300F0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #elif !defined(CYTHON_USE_UNICODE_WRITER) - #define CYTHON_USE_UNICODE_WRITER 1 - #endif - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #ifndef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 1 - #endif - #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 - #endif - #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) - #endif - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) - #endif - #ifndef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1) - #endif - #ifndef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) - #endif -#endif -#if !defined(CYTHON_FAST_PYCCALL) -#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) -#endif -#if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" - #undef SHIFT - #undef BASE - #undef MASK - #ifdef SIZEOF_VOID_P - enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; - #endif -#endif -#ifndef __has_attribute - #define __has_attribute(x) 0 -#endif -#ifndef __has_cpp_attribute - #define __has_cpp_attribute(x) 0 -#endif -#ifndef CYTHON_RESTRICT - #if defined(__GNUC__) - #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) && _MSC_VER >= 1400 - #define CYTHON_RESTRICT __restrict - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_RESTRICT restrict - #else - #define CYTHON_RESTRICT - #endif -#endif -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif -#ifndef CYTHON_MAYBE_UNUSED_VAR -# if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } -# else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) -# endif -#endif -#ifndef CYTHON_NCP_UNUSED -# if CYTHON_COMPILING_IN_CPYTHON -# define CYTHON_NCP_UNUSED -# else -# define CYTHON_NCP_UNUSED CYTHON_UNUSED -# endif -#endif -#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) -#ifdef _MSC_VER - #ifndef _MSC_STDINT_H_ - #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned int uint32_t; - #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int32 uint32_t; - #endif - #endif -#else - #include -#endif -#ifndef CYTHON_FALLTHROUGH - #if defined(__cplusplus) && __cplusplus >= 201103L - #if __has_cpp_attribute(fallthrough) - #define CYTHON_FALLTHROUGH [[fallthrough]] - #elif __has_cpp_attribute(clang::fallthrough) - #define CYTHON_FALLTHROUGH [[clang::fallthrough]] - #elif __has_cpp_attribute(gnu::fallthrough) - #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] - #endif - #endif - #ifndef CYTHON_FALLTHROUGH - #if __has_attribute(fallthrough) - #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) - #else - #define CYTHON_FALLTHROUGH - #endif - #endif - #if defined(__clang__ ) && defined(__apple_build_version__) - #if __apple_build_version__ < 7000000 - #undef CYTHON_FALLTHROUGH - #define CYTHON_FALLTHROUGH - #endif - #endif -#endif - -#ifndef CYTHON_INLINE - #if defined(__clang__) - #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) - #elif defined(__GNUC__) - #define CYTHON_INLINE __inline__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_INLINE inline - #else - #define CYTHON_INLINE - #endif -#endif - -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif -#define __PYX_BUILD_PY_SSIZE_T "n" -#define CYTHON_FORMAT_SSIZE_T "z" -#if PY_MAJOR_VERSION < 3 - #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyClass_Type -#else - #define __Pyx_BUILTIN_MODULE_NAME "builtins" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyType_Type -#endif -#ifndef Py_TPFLAGS_CHECKTYPES - #define Py_TPFLAGS_CHECKTYPES 0 -#endif -#ifndef Py_TPFLAGS_HAVE_INDEX - #define Py_TPFLAGS_HAVE_INDEX 0 -#endif -#ifndef Py_TPFLAGS_HAVE_NEWBUFFER - #define Py_TPFLAGS_HAVE_NEWBUFFER 0 -#endif -#ifndef Py_TPFLAGS_HAVE_FINALIZE - #define Py_TPFLAGS_HAVE_FINALIZE 0 -#endif -#ifndef METH_STACKLESS - #define METH_STACKLESS 0 -#endif -#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) - #ifndef METH_FASTCALL - #define METH_FASTCALL 0x80 - #endif - typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); - typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, - Py_ssize_t nargs, PyObject *kwnames); -#else - #define __Pyx_PyCFunctionFast _PyCFunctionFast - #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords -#endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) -#else -#define __Pyx_PyFastCFunction_Check(func) 0 -#endif -#if CYTHON_USE_DICT_VERSIONS -#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ - (version_var) = __PYX_GET_DICT_VERSION(dict);\ - (cache_var) = (value); -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ - (VAR) = __pyx_dict_cached_value;\ - } else {\ - (VAR) = __pyx_dict_cached_value = (LOOKUP);\ - __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ - }\ - } -#else -#define __PYX_GET_DICT_VERSION(dict) (0) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) - #define PyObject_Malloc(s) PyMem_Malloc(s) - #define PyObject_Free(p) PyMem_Free(p) - #define PyObject_Realloc(p) PyMem_Realloc(p) -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 - #define PyMem_RawMalloc(n) PyMem_Malloc(n) - #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) - #define PyMem_RawFree(p) PyMem_Free(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) -#else - #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) -#endif -#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 - #define __Pyx_PyThreadState_Current PyThreadState_GET() -#elif PY_VERSION_HEX >= 0x03060000 - #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() -#elif PY_VERSION_HEX >= 0x03000000 - #define __Pyx_PyThreadState_Current PyThreadState_GET() -#else - #define __Pyx_PyThreadState_Current _PyThreadState_Current -#endif -#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) -#include "pythread.h" -#define Py_tss_NEEDS_INIT 0 -typedef int Py_tss_t; -static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { - *key = PyThread_create_key(); - return 0; -} -static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { - Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); - *key = Py_tss_NEEDS_INIT; - return key; -} -static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { - PyObject_Free(key); -} -static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { - return *key != Py_tss_NEEDS_INIT; -} -static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { - PyThread_delete_key(*key); - *key = Py_tss_NEEDS_INIT; -} -static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { - return PyThread_set_key_value(*key, value); -} -static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { - return PyThread_get_key_value(*key); -} -#endif -#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) -#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) -#else -#define __Pyx_PyDict_NewPresized(n) PyDict_New() -#endif -#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS -#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) -#else -#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) -#endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) - #define CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) - #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) - #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) -#else - #define CYTHON_PEP393_ENABLED 0 - #define PyUnicode_1BYTE_KIND 1 - #define PyUnicode_2BYTE_KIND 2 - #define PyUnicode_4BYTE_KIND 4 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) - #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) - #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) -#endif -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) -#else - #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ - PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) -#endif -#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) -#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) -#else - #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) -#endif -#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) - #define PyObject_ASCII(o) PyObject_Repr(o) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBaseString_Type PyUnicode_Type - #define PyStringObject PyUnicodeObject - #define PyString_Type PyUnicode_Type - #define PyString_Check PyUnicode_Check - #define PyString_CheckExact PyUnicode_CheckExact - #define PyObject_Unicode PyObject_Str -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) - #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) -#else - #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) - #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) -#endif -#ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) -#endif -#if CYTHON_ASSUME_SAFE_MACROS - #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) -#else - #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyIntObject PyLongObject - #define PyInt_Type PyLong_Type - #define PyInt_Check(op) PyLong_Check(op) - #define PyInt_CheckExact(op) PyLong_CheckExact(op) - #define PyInt_FromString PyLong_FromString - #define PyInt_FromUnicode PyLong_FromUnicode - #define PyInt_FromLong PyLong_FromLong - #define PyInt_FromSize_t PyLong_FromSize_t - #define PyInt_FromSsize_t PyLong_FromSsize_t - #define PyInt_AsLong PyLong_AsLong - #define PyInt_AS_LONG PyLong_AS_LONG - #define PyInt_AsSsize_t PyLong_AsSsize_t - #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask - #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define PyNumber_Int PyNumber_Long -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject -#endif -#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY - #ifndef PyUnicode_InternFromString - #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) - #endif -#endif -#if PY_VERSION_HEX < 0x030200A4 - typedef long Py_hash_t; - #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong -#else - #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif -#if CYTHON_USE_ASYNC_SLOTS - #if PY_VERSION_HEX >= 0x030500B1 - #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods - #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) - #else - #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) - #endif -#else - #define __Pyx_PyType_AsAsync(obj) NULL -#endif -#ifndef __Pyx_PyAsyncMethodsStruct - typedef struct { - unaryfunc am_await; - unaryfunc am_aiter; - unaryfunc am_anext; - } __Pyx_PyAsyncMethodsStruct; -#endif - -#if defined(WIN32) || defined(MS_WINDOWS) - #define _USE_MATH_DEFINES -#endif -#include -#ifdef NAN -#define __PYX_NAN() ((float) NAN) -#else -static CYTHON_INLINE float __PYX_NAN() { - float value; - memset(&value, 0xFF, sizeof(value)); - return value; -} -#endif -#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) -#define __Pyx_truncl trunc -#else -#define __Pyx_truncl truncl -#endif - - -#define __PYX_ERR(f_index, lineno, Ln_error) \ -{ \ - __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ -} - -#ifndef __PYX_EXTERN_C - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif -#endif - -#define __PYX_HAVE__keyutils___keyutils -#define __PYX_HAVE_API__keyutils___keyutils -/* Early includes */ -#include -#include -#include "keyutils.h" -#ifdef _OPENMP -#include -#endif /* _OPENMP */ - -#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) -#define CYTHON_WITHOUT_ASSERTIONS -#endif - -typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; - const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; - -#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 -#define __PYX_DEFAULT_STRING_ENCODING "" -#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString -#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#define __Pyx_uchar_cast(c) ((unsigned char)c) -#define __Pyx_long_cast(x) ((long)x) -#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ - (sizeof(type) < sizeof(Py_ssize_t)) ||\ - (sizeof(type) > sizeof(Py_ssize_t) &&\ - likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX) &&\ - (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ - v == (type)PY_SSIZE_T_MIN))) ||\ - (sizeof(type) == sizeof(Py_ssize_t) &&\ - (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX))) ) -static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { - return (size_t) i < (size_t) limit; -} -#if defined (__cplusplus) && __cplusplus >= 201103L - #include - #define __Pyx_sst_abs(value) std::abs(value) -#elif SIZEOF_INT >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) abs(value) -#elif SIZEOF_LONG >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) labs(value) -#elif defined (_MSC_VER) - #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) -#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define __Pyx_sst_abs(value) llabs(value) -#elif defined (__GNUC__) - #define __Pyx_sst_abs(value) __builtin_llabs(value) -#else - #define __Pyx_sst_abs(value) ((value<0) ? -value : value) -#endif -static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); -static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); -#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) -#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#else - #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize -#endif -#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) -#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) -#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) -#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) -#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { - const Py_UNICODE *u_end = u; - while (*u_end++) ; - return (size_t)(u_end - u - 1); -} -#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) -#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode -#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode -#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) -#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); -#define __Pyx_PySequence_Tuple(obj)\ - (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -#if CYTHON_ASSUME_SAFE_MACROS -#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) -#else -#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) -#endif -#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) -#else -#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) -#endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII -static int __Pyx_sys_getdefaultencoding_not_ascii; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - PyObject* ascii_chars_u = NULL; - PyObject* ascii_chars_b = NULL; - const char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - if (strcmp(default_encoding_c, "ascii") == 0) { - __Pyx_sys_getdefaultencoding_not_ascii = 0; - } else { - char ascii_chars[128]; - int c; - for (c = 0; c < 128; c++) { - ascii_chars[c] = c; - } - __Pyx_sys_getdefaultencoding_not_ascii = 1; - ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); - if (!ascii_chars_u) goto bad; - ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); - if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { - PyErr_Format( - PyExc_ValueError, - "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", - default_encoding_c); - goto bad; - } - Py_DECREF(ascii_chars_u); - Py_DECREF(ascii_chars_b); - } - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - Py_XDECREF(ascii_chars_u); - Py_XDECREF(ascii_chars_b); - return -1; -} -#endif -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) -#else -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -static char* __PYX_DEFAULT_STRING_ENCODING; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1); - if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; - strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - return -1; -} -#endif -#endif - - -/* Test for GCC > 2.95 */ -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) -#else /* !__GNUC__ or GCC < 2.95 */ - #define likely(x) (x) - #define unlikely(x) (x) -#endif /* __GNUC__ */ -static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } - -static PyObject *__pyx_m = NULL; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_cython_runtime = NULL; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; -static const char *__pyx_filename; - - -static const char *__pyx_f[] = { - "keyutils/_keyutils.pyx", -}; -/* 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 ---*/ - -/* --- Runtime support code (head) --- */ -/* Refnanny.proto */ -#ifndef CYTHON_REFNANNY - #define CYTHON_REFNANNY 0 -#endif -#if CYTHON_REFNANNY - typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); - void (*FinishContext)(void**); - } __Pyx_RefNannyAPIStruct; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); - #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; -#ifdef WITH_THREAD - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - if (acquire_gil) {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - PyGILState_Release(__pyx_gilstate_save);\ - } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - } -#else - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) -#endif - #define __Pyx_RefNannyFinishContext()\ - __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) -#else - #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name, acquire_gil) - #define __Pyx_RefNannyFinishContext() - #define __Pyx_INCREF(r) Py_INCREF(r) - #define __Pyx_DECREF(r) Py_DECREF(r) - #define __Pyx_GOTREF(r) - #define __Pyx_GIVEREF(r) - #define __Pyx_XINCREF(r) Py_XINCREF(r) - #define __Pyx_XDECREF(r) Py_XDECREF(r) - #define __Pyx_XGOTREF(r) - #define __Pyx_XGIVEREF(r) -#endif -#define __Pyx_XDECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_XDECREF(tmp);\ - } while (0) -#define __Pyx_DECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_DECREF(tmp);\ - } while (0) -#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) -#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) - -/* RaiseArgTupleInvalid.proto */ -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ - const char* function_name); - -/* ArgTypeTest.proto */ -#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ - ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ - __Pyx__ArgTypeTest(obj, type, name, exact)) -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); - -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* GetModuleGlobalName.proto */ -#if CYTHON_USE_DICT_VERSIONS -#define __Pyx_GetModuleGlobalName(var, name) {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ - (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ - __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} -#define __Pyx_GetModuleGlobalNameUncached(var, name) {\ - PY_UINT64_T __pyx_dict_version;\ - PyObject *__pyx_dict_cached_value;\ - (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); -#else -#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) -#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); -#endif - -/* CalculateMetaclass.proto */ -static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); - -/* Py3ClassCreate.proto */ -static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, - PyObject *mkw, PyObject *modname, PyObject *doc); -static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, - PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass); - -/* SetNameInClass.proto */ -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 -#define __Pyx_SetNameInClass(ns, name, value)\ - (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value)) -#elif CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_SetNameInClass(ns, name, value)\ - (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value)) -#else -#define __Pyx_SetNameInClass(ns, name, value) PyObject_SetItem(ns, name, value) -#endif - -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() PyErr_Occurred() -#endif - -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) -#else -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#endif -#else -#define __Pyx_PyErr_Clear() PyErr_Clear() -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - -/* CLineInTraceback.proto */ -#ifdef CYTHON_CLINE_IN_TRACEBACK -#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) -#else -static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); -#endif - -/* CodeObjectCache.proto */ -typedef struct { - PyCodeObject* code_object; - int code_line; -} __Pyx_CodeObjectCacheEntry; -struct __Pyx_CodeObjectCache { - int count; - int max_count; - __Pyx_CodeObjectCacheEntry* entries; -}; -static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); -static PyCodeObject *__pyx_find_code_object(int code_line); -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); - -/* AddTraceback.proto */ -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_int(int value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); - -/* FastTypeChecks.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); -#else -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) -#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) -#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) -#endif -#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) - -/* CheckBinaryVersion.proto */ -static int __Pyx_check_binary_version(void); - -/* InitStrings.proto */ -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); - - -/* Module declarations from 'libc' */ - -/* Module declarations from 'libc.string' */ - -/* Module declarations from 'libc.stdlib' */ - -/* Module declarations from 'keyutils._keyutils' */ -#define __Pyx_MODULE_NAME "keyutils._keyutils" -extern int __pyx_module_is_main_keyutils___keyutils; -int __pyx_module_is_main_keyutils___keyutils = 0; - -/* Implementation of 'keyutils._keyutils' */ -static const char __pyx_k_rc[] = "rc"; -static const char __pyx_k_doc[] = "__doc__"; -static const char __pyx_k_key[] = "key"; -static const char __pyx_k_obj[] = "obj"; -static const char __pyx_k_ptr[] = "ptr"; -static const char __pyx_k_link[] = "link"; -static const char __pyx_k_main[] = "__main__"; -static const char __pyx_k_name[] = "__name__"; -static const char __pyx_k_perm[] = "perm"; -static const char __pyx_k_size[] = "size"; -static const char __pyx_k_test[] = "__test__"; -static const char __pyx_k_clear[] = "clear"; -static const char __pyx_k_error[] = "error"; -static const char __pyx_k_ENOKEY[] = "ENOKEY"; -static const char __pyx_k_desc_p[] = "desc_p"; -static const char __pyx_k_module[] = "__module__"; -static const char __pyx_k_name_2[] = "name"; -static const char __pyx_k_name_p[] = "name_p"; -static const char __pyx_k_revoke[] = "revoke"; -static const char __pyx_k_search[] = "search"; -static const char __pyx_k_unlink[] = "unlink"; -static const char __pyx_k_add_key[] = "add_key"; -static const char __pyx_k_keyperm[] = "keyperm"; -static const char __pyx_k_keyring[] = "keyring"; -static const char __pyx_k_payload[] = "payload"; -static const char __pyx_k_prepare[] = "__prepare__"; -static const char __pyx_k_timeout[] = "timeout"; -static const char __pyx_k_key_type[] = "key_type"; -static const char __pyx_k_qualname[] = "__qualname__"; -static const char __pyx_k_read_key[] = "read_key"; -static const char __pyx_k_set_perm[] = "set_perm"; -static const char __pyx_k_callout_p[] = "callout_p"; -static const char __pyx_k_constants[] = "constants"; -static const char __pyx_k_metaclass[] = "__metaclass__"; -static const char __pyx_k_payload_p[] = "payload_p"; -static const char __pyx_k_key_type_p[] = "key_type_p"; -static const char __pyx_k_update_key[] = "update_key"; -static const char __pyx_k_EKEYEXPIRED[] = "EKEYEXPIRED"; -static const char __pyx_k_EKEYREVOKED[] = "EKEYREVOKED"; -static const char __pyx_k_KEY_GRP_ALL[] = "KEY_GRP_ALL"; -static const char __pyx_k_KEY_OTH_ALL[] = "KEY_OTH_ALL"; -static const char __pyx_k_KEY_POS_ALL[] = "KEY_POS_ALL"; -static const char __pyx_k_KEY_USR_ALL[] = "KEY_USR_ALL"; -static const char __pyx_k_description[] = "description"; -static const char __pyx_k_destination[] = "destination"; -static const char __pyx_k_payload_len[] = "payload_len"; -static const char __pyx_k_request_key[] = "request_key"; -static const char __pyx_k_set_timeout[] = "set_timeout"; -static const char __pyx_k_EKEYREJECTED[] = "EKEYREJECTED"; -static const char __pyx_k_KEY_GRP_LINK[] = "KEY_GRP_LINK"; -static const char __pyx_k_KEY_GRP_READ[] = "KEY_GRP_READ"; -static const char __pyx_k_KEY_GRP_VIEW[] = "KEY_GRP_VIEW"; -static const char __pyx_k_KEY_OTH_LINK[] = "KEY_OTH_LINK"; -static const char __pyx_k_KEY_OTH_READ[] = "KEY_OTH_READ"; -static const char __pyx_k_KEY_OTH_VIEW[] = "KEY_OTH_VIEW"; -static const char __pyx_k_KEY_POS_LINK[] = "KEY_POS_LINK"; -static const char __pyx_k_KEY_POS_READ[] = "KEY_POS_READ"; -static const char __pyx_k_KEY_POS_VIEW[] = "KEY_POS_VIEW"; -static const char __pyx_k_KEY_USR_LINK[] = "KEY_USR_LINK"; -static const char __pyx_k_KEY_USR_READ[] = "KEY_USR_READ"; -static const char __pyx_k_KEY_USR_VIEW[] = "KEY_USR_VIEW"; -static const char __pyx_k_callout_info[] = "callout_info"; -static const char __pyx_k_describe_key[] = "describe_key"; -static const char __pyx_k_KEY_GRP_WRITE[] = "KEY_GRP_WRITE"; -static const char __pyx_k_KEY_OTH_WRITE[] = "KEY_OTH_WRITE"; -static const char __pyx_k_KEY_POS_WRITE[] = "KEY_POS_WRITE"; -static const char __pyx_k_KEY_USR_WRITE[] = "KEY_USR_WRITE"; -static const char __pyx_k_KEY_GRP_SEARCH[] = "KEY_GRP_SEARCH"; -static const char __pyx_k_KEY_OTH_SEARCH[] = "KEY_OTH_SEARCH"; -static const char __pyx_k_KEY_POS_SEARCH[] = "KEY_POS_SEARCH"; -static const char __pyx_k_KEY_USR_SEARCH[] = "KEY_USR_SEARCH"; -static const char __pyx_k_KEY_GRP_SETATTR[] = "KEY_GRP_SETATTR"; -static const char __pyx_k_KEY_OTH_SETATTR[] = "KEY_OTH_SETATTR"; -static const char __pyx_k_KEY_POS_SETATTR[] = "KEY_POS_SETATTR"; -static const char __pyx_k_KEY_USR_SETATTR[] = "KEY_USR_SETATTR"; -static const char __pyx_k_session_to_parent[] = "session_to_parent"; -static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; -static const char __pyx_k_keyutils__keyutils[] = "keyutils._keyutils"; -static const char __pyx_k_join_session_keyring[] = "join_session_keyring"; -static const char __pyx_k_KEY_SPEC_USER_KEYRING[] = "KEY_SPEC_USER_KEYRING"; -static const char __pyx_k_keyutils__keyutils_pyx[] = "keyutils/_keyutils.pyx"; -static const char __pyx_k_KEY_SPEC_THREAD_KEYRING[] = "KEY_SPEC_THREAD_KEYRING"; -static const char __pyx_k_KEY_SPEC_PROCESS_KEYRING[] = "KEY_SPEC_PROCESS_KEYRING"; -static const char __pyx_k_KEY_SPEC_SESSION_KEYRING[] = "KEY_SPEC_SESSION_KEYRING"; -static const char __pyx_k_KEY_SPEC_USER_SESSION_KEYRING[] = "KEY_SPEC_USER_SESSION_KEYRING"; -static PyObject *__pyx_n_s_EKEYEXPIRED; -static PyObject *__pyx_n_s_EKEYREJECTED; -static PyObject *__pyx_n_s_EKEYREVOKED; -static PyObject *__pyx_n_s_ENOKEY; -static PyObject *__pyx_n_s_KEY_GRP_ALL; -static PyObject *__pyx_n_s_KEY_GRP_LINK; -static PyObject *__pyx_n_s_KEY_GRP_READ; -static PyObject *__pyx_n_s_KEY_GRP_SEARCH; -static PyObject *__pyx_n_s_KEY_GRP_SETATTR; -static PyObject *__pyx_n_s_KEY_GRP_VIEW; -static PyObject *__pyx_n_s_KEY_GRP_WRITE; -static PyObject *__pyx_n_s_KEY_OTH_ALL; -static PyObject *__pyx_n_s_KEY_OTH_LINK; -static PyObject *__pyx_n_s_KEY_OTH_READ; -static PyObject *__pyx_n_s_KEY_OTH_SEARCH; -static PyObject *__pyx_n_s_KEY_OTH_SETATTR; -static PyObject *__pyx_n_s_KEY_OTH_VIEW; -static PyObject *__pyx_n_s_KEY_OTH_WRITE; -static PyObject *__pyx_n_s_KEY_POS_ALL; -static PyObject *__pyx_n_s_KEY_POS_LINK; -static PyObject *__pyx_n_s_KEY_POS_READ; -static PyObject *__pyx_n_s_KEY_POS_SEARCH; -static PyObject *__pyx_n_s_KEY_POS_SETATTR; -static PyObject *__pyx_n_s_KEY_POS_VIEW; -static PyObject *__pyx_n_s_KEY_POS_WRITE; -static PyObject *__pyx_n_s_KEY_SPEC_PROCESS_KEYRING; -static PyObject *__pyx_n_s_KEY_SPEC_SESSION_KEYRING; -static PyObject *__pyx_n_s_KEY_SPEC_THREAD_KEYRING; -static PyObject *__pyx_n_s_KEY_SPEC_USER_KEYRING; -static PyObject *__pyx_n_s_KEY_SPEC_USER_SESSION_KEYRING; -static PyObject *__pyx_n_s_KEY_USR_ALL; -static PyObject *__pyx_n_s_KEY_USR_LINK; -static PyObject *__pyx_n_s_KEY_USR_READ; -static PyObject *__pyx_n_s_KEY_USR_SEARCH; -static PyObject *__pyx_n_s_KEY_USR_SETATTR; -static PyObject *__pyx_n_s_KEY_USR_VIEW; -static PyObject *__pyx_n_s_KEY_USR_WRITE; -static PyObject *__pyx_n_s_add_key; -static PyObject *__pyx_n_s_callout_info; -static PyObject *__pyx_n_s_callout_p; -static PyObject *__pyx_n_s_clear; -static PyObject *__pyx_n_s_cline_in_traceback; -static PyObject *__pyx_n_s_constants; -static PyObject *__pyx_n_s_desc_p; -static PyObject *__pyx_n_s_describe_key; -static PyObject *__pyx_n_s_description; -static PyObject *__pyx_n_s_destination; -static PyObject *__pyx_n_s_doc; -static PyObject *__pyx_n_s_error; -static PyObject *__pyx_n_s_join_session_keyring; -static PyObject *__pyx_n_s_key; -static PyObject *__pyx_n_s_key_type; -static PyObject *__pyx_n_s_key_type_p; -static PyObject *__pyx_n_s_keyperm; -static PyObject *__pyx_n_s_keyring; -static PyObject *__pyx_n_s_keyutils__keyutils; -static PyObject *__pyx_kp_s_keyutils__keyutils_pyx; -static PyObject *__pyx_n_s_link; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_metaclass; -static PyObject *__pyx_n_s_module; -static PyObject *__pyx_n_s_name; -static PyObject *__pyx_n_s_name_2; -static PyObject *__pyx_n_s_name_p; -static PyObject *__pyx_n_s_obj; -static PyObject *__pyx_n_s_payload; -static PyObject *__pyx_n_s_payload_len; -static PyObject *__pyx_n_s_payload_p; -static PyObject *__pyx_n_s_perm; -static PyObject *__pyx_n_s_prepare; -static PyObject *__pyx_n_s_ptr; -static PyObject *__pyx_n_s_qualname; -static PyObject *__pyx_n_s_rc; -static PyObject *__pyx_n_s_read_key; -static PyObject *__pyx_n_s_request_key; -static PyObject *__pyx_n_s_revoke; -static PyObject *__pyx_n_s_search; -static PyObject *__pyx_n_s_session_to_parent; -static PyObject *__pyx_n_s_set_perm; -static PyObject *__pyx_n_s_set_timeout; -static PyObject *__pyx_n_s_size; -static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_timeout; -static PyObject *__pyx_n_s_unlink; -static PyObject *__pyx_n_s_update_key; -static PyObject *__pyx_pf_8keyutils_9_keyutils_add_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_key_type, PyObject *__pyx_v_description, PyObject *__pyx_v_payload, int __pyx_v_keyring); /* proto */ -static PyObject *__pyx_pf_8keyutils_9_keyutils_2request_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_key_type, PyObject *__pyx_v_description, PyObject *__pyx_v_callout_info, int __pyx_v_keyring); /* proto */ -static PyObject *__pyx_pf_8keyutils_9_keyutils_4search(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_keyring, PyObject *__pyx_v_key_type, PyObject *__pyx_v_description, int __pyx_v_destination); /* proto */ -static PyObject *__pyx_pf_8keyutils_9_keyutils_6update_key(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_key, PyObject *__pyx_v_payload); /* proto */ -static PyObject *__pyx_pf_8keyutils_9_keyutils_8read_key(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_key); /* proto */ -static PyObject *__pyx_pf_8keyutils_9_keyutils_10describe_key(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_key); /* proto */ -static PyObject *__pyx_pf_8keyutils_9_keyutils_12join_session_keyring(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name); /* proto */ -static PyObject *__pyx_pf_8keyutils_9_keyutils_14session_to_parent(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_8keyutils_9_keyutils_16link(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_key, int __pyx_v_keyring); /* proto */ -static PyObject *__pyx_pf_8keyutils_9_keyutils_18unlink(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_key, int __pyx_v_keyring); /* proto */ -static PyObject *__pyx_pf_8keyutils_9_keyutils_20revoke(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_key); /* proto */ -static PyObject *__pyx_pf_8keyutils_9_keyutils_22set_perm(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_key, int __pyx_v_perm); /* proto */ -static PyObject *__pyx_pf_8keyutils_9_keyutils_24set_timeout(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_key, int __pyx_v_timeout); /* proto */ -static PyObject *__pyx_pf_8keyutils_9_keyutils_26clear(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_keyring); /* proto */ -static PyObject *__pyx_tuple_; -static PyObject *__pyx_tuple__3; -static PyObject *__pyx_tuple__5; -static PyObject *__pyx_tuple__7; -static PyObject *__pyx_tuple__9; -static PyObject *__pyx_tuple__11; -static PyObject *__pyx_tuple__13; -static PyObject *__pyx_tuple__15; -static PyObject *__pyx_tuple__17; -static PyObject *__pyx_tuple__19; -static PyObject *__pyx_tuple__21; -static PyObject *__pyx_tuple__23; -static PyObject *__pyx_tuple__25; -static PyObject *__pyx_tuple__27; -static PyObject *__pyx_codeobj__2; -static PyObject *__pyx_codeobj__4; -static PyObject *__pyx_codeobj__6; -static PyObject *__pyx_codeobj__8; -static PyObject *__pyx_codeobj__10; -static PyObject *__pyx_codeobj__12; -static PyObject *__pyx_codeobj__14; -static PyObject *__pyx_codeobj__16; -static PyObject *__pyx_codeobj__18; -static PyObject *__pyx_codeobj__20; -static PyObject *__pyx_codeobj__22; -static PyObject *__pyx_codeobj__24; -static PyObject *__pyx_codeobj__26; -static PyObject *__pyx_codeobj__28; -/* Late includes */ - -/* "keyutils/_keyutils.pyx":125 - * - * - * def add_key(bytes key_type, bytes description, bytes payload, int keyring): # <<<<<<<<<<<<<< - * cdef int rc - * cdef char *key_type_p = key_type - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8keyutils_9_keyutils_1add_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8keyutils_9_keyutils_1add_key = {"add_key", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8keyutils_9_keyutils_1add_key, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_8keyutils_9_keyutils_1add_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_key_type = 0; - PyObject *__pyx_v_description = 0; - PyObject *__pyx_v_payload = 0; - int __pyx_v_keyring; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("add_key (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key_type,&__pyx_n_s_description,&__pyx_n_s_payload,&__pyx_n_s_keyring,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key_type)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_description)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("add_key", 1, 4, 4, 1); __PYX_ERR(0, 125, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_payload)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("add_key", 1, 4, 4, 2); __PYX_ERR(0, 125, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_keyring)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("add_key", 1, 4, 4, 3); __PYX_ERR(0, 125, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_key") < 0)) __PYX_ERR(0, 125, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - } - __pyx_v_key_type = ((PyObject*)values[0]); - __pyx_v_description = ((PyObject*)values[1]); - __pyx_v_payload = ((PyObject*)values[2]); - __pyx_v_keyring = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_keyring == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("add_key", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 125, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("keyutils._keyutils.add_key", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key_type), (&PyBytes_Type), 1, "key_type", 1))) __PYX_ERR(0, 125, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_description), (&PyBytes_Type), 1, "description", 1))) __PYX_ERR(0, 125, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_payload), (&PyBytes_Type), 1, "payload", 1))) __PYX_ERR(0, 125, __pyx_L1_error) - __pyx_r = __pyx_pf_8keyutils_9_keyutils_add_key(__pyx_self, __pyx_v_key_type, __pyx_v_description, __pyx_v_payload, __pyx_v_keyring); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8keyutils_9_keyutils_add_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_key_type, PyObject *__pyx_v_description, PyObject *__pyx_v_payload, int __pyx_v_keyring) { - int __pyx_v_rc; - char *__pyx_v_key_type_p; - char *__pyx_v_desc_p; - int __pyx_v_payload_len; - char *__pyx_v_payload_p; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - char *__pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - Py_ssize_t __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - __Pyx_RefNannySetupContext("add_key", 0); - - /* "keyutils/_keyutils.pyx":127 - * def add_key(bytes key_type, bytes description, bytes payload, int keyring): - * cdef int rc - * cdef char *key_type_p = key_type # <<<<<<<<<<<<<< - * cdef char *desc_p = description - * cdef int payload_len - */ - if (unlikely(__pyx_v_key_type == Py_None)) { - PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 127, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_PyBytes_AsWritableString(__pyx_v_key_type); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 127, __pyx_L1_error) - __pyx_v_key_type_p = __pyx_t_1; - - /* "keyutils/_keyutils.pyx":128 - * cdef int rc - * cdef char *key_type_p = key_type - * cdef char *desc_p = description # <<<<<<<<<<<<<< - * cdef int payload_len - * cdef char *payload_p - */ - if (unlikely(__pyx_v_description == Py_None)) { - PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 128, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_PyBytes_AsWritableString(__pyx_v_description); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 128, __pyx_L1_error) - __pyx_v_desc_p = __pyx_t_1; - - /* "keyutils/_keyutils.pyx":131 - * cdef int payload_len - * cdef char *payload_p - * if payload is None: # <<<<<<<<<<<<<< - * payload_p = NULL - * payload_len = 0 - */ - __pyx_t_2 = (__pyx_v_payload == ((PyObject*)Py_None)); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - - /* "keyutils/_keyutils.pyx":132 - * cdef char *payload_p - * if payload is None: - * payload_p = NULL # <<<<<<<<<<<<<< - * payload_len = 0 - * else: - */ - __pyx_v_payload_p = NULL; - - /* "keyutils/_keyutils.pyx":133 - * if payload is None: - * payload_p = NULL - * payload_len = 0 # <<<<<<<<<<<<<< - * else: - * payload_p = payload - */ - __pyx_v_payload_len = 0; - - /* "keyutils/_keyutils.pyx":131 - * cdef int payload_len - * cdef char *payload_p - * if payload is None: # <<<<<<<<<<<<<< - * payload_p = NULL - * payload_len = 0 - */ - goto __pyx_L3; - } - - /* "keyutils/_keyutils.pyx":135 - * payload_len = 0 - * else: - * payload_p = payload # <<<<<<<<<<<<<< - * payload_len = len(payload) - * with nogil: - */ - /*else*/ { - if (unlikely(__pyx_v_payload == Py_None)) { - PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 135, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_PyBytes_AsWritableString(__pyx_v_payload); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 135, __pyx_L1_error) - __pyx_v_payload_p = __pyx_t_1; - - /* "keyutils/_keyutils.pyx":136 - * else: - * payload_p = payload - * payload_len = len(payload) # <<<<<<<<<<<<<< - * with nogil: - * rc = c_add_key(key_type_p, desc_p, payload_p, payload_len, keyring) - */ - if (unlikely(__pyx_v_payload == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 136, __pyx_L1_error) - } - __pyx_t_4 = PyBytes_GET_SIZE(__pyx_v_payload); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 136, __pyx_L1_error) - __pyx_v_payload_len = __pyx_t_4; - } - __pyx_L3:; - - /* "keyutils/_keyutils.pyx":137 - * payload_p = payload - * payload_len = len(payload) - * with nogil: # <<<<<<<<<<<<<< - * rc = c_add_key(key_type_p, desc_p, payload_p, payload_len, keyring) - * if rc < 0: - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - - /* "keyutils/_keyutils.pyx":138 - * payload_len = len(payload) - * with nogil: - * rc = c_add_key(key_type_p, desc_p, payload_p, payload_len, keyring) # <<<<<<<<<<<<<< - * if rc < 0: - * PyErr_SetFromErrno(error) - */ - __pyx_v_rc = add_key(__pyx_v_key_type_p, __pyx_v_desc_p, __pyx_v_payload_p, __pyx_v_payload_len, __pyx_v_keyring); - } - - /* "keyutils/_keyutils.pyx":137 - * payload_p = payload - * payload_len = len(payload) - * with nogil: # <<<<<<<<<<<<<< - * rc = c_add_key(key_type_p, desc_p, payload_p, payload_len, keyring) - * if rc < 0: - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L6; - } - __pyx_L6:; - } - } - - /* "keyutils/_keyutils.pyx":139 - * with nogil: - * rc = c_add_key(key_type_p, desc_p, payload_p, payload_len, keyring) - * if rc < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - __pyx_t_3 = ((__pyx_v_rc < 0) != 0); - if (__pyx_t_3) { - - /* "keyutils/_keyutils.pyx":140 - * rc = c_add_key(key_type_p, desc_p, payload_p, payload_len, keyring) - * if rc < 0: - * PyErr_SetFromErrno(error) # <<<<<<<<<<<<<< - * else: - * return rc - */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyErr_SetFromErrno(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "keyutils/_keyutils.pyx":139 - * with nogil: - * rc = c_add_key(key_type_p, desc_p, payload_p, payload_len, keyring) - * if rc < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - goto __pyx_L7; - } - - /* "keyutils/_keyutils.pyx":142 - * PyErr_SetFromErrno(error) - * else: - * return rc # <<<<<<<<<<<<<< - * - * - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 142, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; - } - __pyx_L7:; - - /* "keyutils/_keyutils.pyx":125 - * - * - * def add_key(bytes key_type, bytes description, bytes payload, int keyring): # <<<<<<<<<<<<<< - * cdef int rc - * cdef char *key_type_p = key_type - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("keyutils._keyutils.add_key", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "keyutils/_keyutils.pyx":145 - * - * - * def request_key(bytes key_type, bytes description, bytes callout_info, int keyring): # <<<<<<<<<<<<<< - * cdef char *key_type_p = key_type - * cdef char *desc_p = description - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8keyutils_9_keyutils_3request_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8keyutils_9_keyutils_3request_key = {"request_key", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8keyutils_9_keyutils_3request_key, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_8keyutils_9_keyutils_3request_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_key_type = 0; - PyObject *__pyx_v_description = 0; - PyObject *__pyx_v_callout_info = 0; - int __pyx_v_keyring; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("request_key (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key_type,&__pyx_n_s_description,&__pyx_n_s_callout_info,&__pyx_n_s_keyring,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key_type)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_description)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("request_key", 1, 4, 4, 1); __PYX_ERR(0, 145, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callout_info)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("request_key", 1, 4, 4, 2); __PYX_ERR(0, 145, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_keyring)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("request_key", 1, 4, 4, 3); __PYX_ERR(0, 145, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "request_key") < 0)) __PYX_ERR(0, 145, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - } - __pyx_v_key_type = ((PyObject*)values[0]); - __pyx_v_description = ((PyObject*)values[1]); - __pyx_v_callout_info = ((PyObject*)values[2]); - __pyx_v_keyring = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_keyring == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("request_key", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 145, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("keyutils._keyutils.request_key", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key_type), (&PyBytes_Type), 1, "key_type", 1))) __PYX_ERR(0, 145, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_description), (&PyBytes_Type), 1, "description", 1))) __PYX_ERR(0, 145, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_callout_info), (&PyBytes_Type), 1, "callout_info", 1))) __PYX_ERR(0, 145, __pyx_L1_error) - __pyx_r = __pyx_pf_8keyutils_9_keyutils_2request_key(__pyx_self, __pyx_v_key_type, __pyx_v_description, __pyx_v_callout_info, __pyx_v_keyring); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8keyutils_9_keyutils_2request_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_key_type, PyObject *__pyx_v_description, PyObject *__pyx_v_callout_info, int __pyx_v_keyring) { - char *__pyx_v_key_type_p; - char *__pyx_v_desc_p; - char *__pyx_v_callout_p; - int __pyx_v_rc; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - char *__pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannySetupContext("request_key", 0); - - /* "keyutils/_keyutils.pyx":146 - * - * def request_key(bytes key_type, bytes description, bytes callout_info, int keyring): - * cdef char *key_type_p = key_type # <<<<<<<<<<<<<< - * cdef char *desc_p = description - * cdef char *callout_p - */ - if (unlikely(__pyx_v_key_type == Py_None)) { - PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 146, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_PyBytes_AsWritableString(__pyx_v_key_type); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 146, __pyx_L1_error) - __pyx_v_key_type_p = __pyx_t_1; - - /* "keyutils/_keyutils.pyx":147 - * def request_key(bytes key_type, bytes description, bytes callout_info, int keyring): - * cdef char *key_type_p = key_type - * cdef char *desc_p = description # <<<<<<<<<<<<<< - * cdef char *callout_p - * cdef int rc - */ - if (unlikely(__pyx_v_description == Py_None)) { - PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 147, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_PyBytes_AsWritableString(__pyx_v_description); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 147, __pyx_L1_error) - __pyx_v_desc_p = __pyx_t_1; - - /* "keyutils/_keyutils.pyx":150 - * cdef char *callout_p - * cdef int rc - * if callout_info is None: # <<<<<<<<<<<<<< - * callout_p = NULL - * else: - */ - __pyx_t_2 = (__pyx_v_callout_info == ((PyObject*)Py_None)); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - - /* "keyutils/_keyutils.pyx":151 - * cdef int rc - * if callout_info is None: - * callout_p = NULL # <<<<<<<<<<<<<< - * else: - * callout_p = callout_info - */ - __pyx_v_callout_p = NULL; - - /* "keyutils/_keyutils.pyx":150 - * cdef char *callout_p - * cdef int rc - * if callout_info is None: # <<<<<<<<<<<<<< - * callout_p = NULL - * else: - */ - goto __pyx_L3; - } - - /* "keyutils/_keyutils.pyx":153 - * callout_p = NULL - * else: - * callout_p = callout_info # <<<<<<<<<<<<<< - * with nogil: - * rc = c_request_key(key_type_p, desc_p, callout_p, keyring) - */ - /*else*/ { - if (unlikely(__pyx_v_callout_info == Py_None)) { - PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 153, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_PyBytes_AsWritableString(__pyx_v_callout_info); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 153, __pyx_L1_error) - __pyx_v_callout_p = __pyx_t_1; - } - __pyx_L3:; - - /* "keyutils/_keyutils.pyx":154 - * else: - * callout_p = callout_info - * with nogil: # <<<<<<<<<<<<<< - * rc = c_request_key(key_type_p, desc_p, callout_p, keyring) - * if rc < 0: - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - - /* "keyutils/_keyutils.pyx":155 - * callout_p = callout_info - * with nogil: - * rc = c_request_key(key_type_p, desc_p, callout_p, keyring) # <<<<<<<<<<<<<< - * if rc < 0: - * PyErr_SetFromErrno(error) - */ - __pyx_v_rc = request_key(__pyx_v_key_type_p, __pyx_v_desc_p, __pyx_v_callout_p, __pyx_v_keyring); - } - - /* "keyutils/_keyutils.pyx":154 - * else: - * callout_p = callout_info - * with nogil: # <<<<<<<<<<<<<< - * rc = c_request_key(key_type_p, desc_p, callout_p, keyring) - * if rc < 0: - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L6; - } - __pyx_L6:; - } - } - - /* "keyutils/_keyutils.pyx":156 - * with nogil: - * rc = c_request_key(key_type_p, desc_p, callout_p, keyring) - * if rc < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - __pyx_t_3 = ((__pyx_v_rc < 0) != 0); - if (__pyx_t_3) { - - /* "keyutils/_keyutils.pyx":157 - * rc = c_request_key(key_type_p, desc_p, callout_p, keyring) - * if rc < 0: - * PyErr_SetFromErrno(error) # <<<<<<<<<<<<<< - * else: - * return rc - */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 157, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyErr_SetFromErrno(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 157, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "keyutils/_keyutils.pyx":156 - * with nogil: - * rc = c_request_key(key_type_p, desc_p, callout_p, keyring) - * if rc < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - goto __pyx_L7; - } - - /* "keyutils/_keyutils.pyx":159 - * PyErr_SetFromErrno(error) - * else: - * return rc # <<<<<<<<<<<<<< - * - * - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 159, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - } - __pyx_L7:; - - /* "keyutils/_keyutils.pyx":145 - * - * - * def request_key(bytes key_type, bytes description, bytes callout_info, int keyring): # <<<<<<<<<<<<<< - * cdef char *key_type_p = key_type - * cdef char *desc_p = description - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("keyutils._keyutils.request_key", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "keyutils/_keyutils.pyx":162 - * - * - * def search(int keyring, bytes key_type, bytes description, int destination): # <<<<<<<<<<<<<< - * cdef char *key_type_p = key_type - * cdef char *desc_p = description - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8keyutils_9_keyutils_5search(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8keyutils_9_keyutils_5search = {"search", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8keyutils_9_keyutils_5search, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_8keyutils_9_keyutils_5search(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_keyring; - PyObject *__pyx_v_key_type = 0; - PyObject *__pyx_v_description = 0; - int __pyx_v_destination; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("search (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_keyring,&__pyx_n_s_key_type,&__pyx_n_s_description,&__pyx_n_s_destination,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_keyring)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key_type)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("search", 1, 4, 4, 1); __PYX_ERR(0, 162, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_description)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("search", 1, 4, 4, 2); __PYX_ERR(0, 162, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_destination)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("search", 1, 4, 4, 3); __PYX_ERR(0, 162, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "search") < 0)) __PYX_ERR(0, 162, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - } - __pyx_v_keyring = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_keyring == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 162, __pyx_L3_error) - __pyx_v_key_type = ((PyObject*)values[1]); - __pyx_v_description = ((PyObject*)values[2]); - __pyx_v_destination = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_destination == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 162, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("search", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 162, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("keyutils._keyutils.search", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key_type), (&PyBytes_Type), 1, "key_type", 1))) __PYX_ERR(0, 162, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_description), (&PyBytes_Type), 1, "description", 1))) __PYX_ERR(0, 162, __pyx_L1_error) - __pyx_r = __pyx_pf_8keyutils_9_keyutils_4search(__pyx_self, __pyx_v_keyring, __pyx_v_key_type, __pyx_v_description, __pyx_v_destination); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8keyutils_9_keyutils_4search(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_keyring, PyObject *__pyx_v_key_type, PyObject *__pyx_v_description, int __pyx_v_destination) { - char *__pyx_v_key_type_p; - char *__pyx_v_desc_p; - int __pyx_v_rc; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - char *__pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("search", 0); - - /* "keyutils/_keyutils.pyx":163 - * - * def search(int keyring, bytes key_type, bytes description, int destination): - * cdef char *key_type_p = key_type # <<<<<<<<<<<<<< - * cdef char *desc_p = description - * cdef int rc - */ - if (unlikely(__pyx_v_key_type == Py_None)) { - PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 163, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_PyBytes_AsWritableString(__pyx_v_key_type); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 163, __pyx_L1_error) - __pyx_v_key_type_p = __pyx_t_1; - - /* "keyutils/_keyutils.pyx":164 - * def search(int keyring, bytes key_type, bytes description, int destination): - * cdef char *key_type_p = key_type - * cdef char *desc_p = description # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: - */ - if (unlikely(__pyx_v_description == Py_None)) { - PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 164, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_PyBytes_AsWritableString(__pyx_v_description); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 164, __pyx_L1_error) - __pyx_v_desc_p = __pyx_t_1; - - /* "keyutils/_keyutils.pyx":166 - * cdef char *desc_p = description - * cdef int rc - * with nogil: # <<<<<<<<<<<<<< - * rc = c_search(keyring, key_type_p, desc_p, destination) - * if rc < 0: - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - - /* "keyutils/_keyutils.pyx":167 - * cdef int rc - * with nogil: - * rc = c_search(keyring, key_type_p, desc_p, destination) # <<<<<<<<<<<<<< - * if rc < 0: - * PyErr_SetFromErrno(error) - */ - __pyx_v_rc = keyctl_search(__pyx_v_keyring, __pyx_v_key_type_p, __pyx_v_desc_p, __pyx_v_destination); - } - - /* "keyutils/_keyutils.pyx":166 - * cdef char *desc_p = description - * cdef int rc - * with nogil: # <<<<<<<<<<<<<< - * rc = c_search(keyring, key_type_p, desc_p, destination) - * if rc < 0: - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } - - /* "keyutils/_keyutils.pyx":168 - * with nogil: - * rc = c_search(keyring, key_type_p, desc_p, destination) - * if rc < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - __pyx_t_2 = ((__pyx_v_rc < 0) != 0); - if (__pyx_t_2) { - - /* "keyutils/_keyutils.pyx":169 - * rc = c_search(keyring, key_type_p, desc_p, destination) - * if rc < 0: - * PyErr_SetFromErrno(error) # <<<<<<<<<<<<<< - * else: - * return rc - */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 169, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyErr_SetFromErrno(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 169, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "keyutils/_keyutils.pyx":168 - * with nogil: - * rc = c_search(keyring, key_type_p, desc_p, destination) - * if rc < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - goto __pyx_L6; - } - - /* "keyutils/_keyutils.pyx":171 - * PyErr_SetFromErrno(error) - * else: - * return rc # <<<<<<<<<<<<<< - * - * - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 171, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } - __pyx_L6:; - - /* "keyutils/_keyutils.pyx":162 - * - * - * def search(int keyring, bytes key_type, bytes description, int destination): # <<<<<<<<<<<<<< - * cdef char *key_type_p = key_type - * cdef char *desc_p = description - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("keyutils._keyutils.search", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "keyutils/_keyutils.pyx":174 - * - * - * def update_key(int key, bytes payload): # <<<<<<<<<<<<<< - * cdef int rc - * cdef int payload_len - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8keyutils_9_keyutils_7update_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8keyutils_9_keyutils_7update_key = {"update_key", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8keyutils_9_keyutils_7update_key, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_8keyutils_9_keyutils_7update_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_key; - PyObject *__pyx_v_payload = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("update_key (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_payload,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_payload)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("update_key", 1, 2, 2, 1); __PYX_ERR(0, 174, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "update_key") < 0)) __PYX_ERR(0, 174, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_key = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_key == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 174, __pyx_L3_error) - __pyx_v_payload = ((PyObject*)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("update_key", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 174, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("keyutils._keyutils.update_key", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_payload), (&PyBytes_Type), 1, "payload", 1))) __PYX_ERR(0, 174, __pyx_L1_error) - __pyx_r = __pyx_pf_8keyutils_9_keyutils_6update_key(__pyx_self, __pyx_v_key, __pyx_v_payload); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8keyutils_9_keyutils_6update_key(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_key, PyObject *__pyx_v_payload) { - int __pyx_v_rc; - int __pyx_v_payload_len; - char *__pyx_v_payload_p; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - char *__pyx_t_3; - Py_ssize_t __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - __Pyx_RefNannySetupContext("update_key", 0); - - /* "keyutils/_keyutils.pyx":178 - * cdef int payload_len - * cdef char *payload_p - * if payload is None: # <<<<<<<<<<<<<< - * payload_p = NULL - * payload_len = 0 - */ - __pyx_t_1 = (__pyx_v_payload == ((PyObject*)Py_None)); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "keyutils/_keyutils.pyx":179 - * cdef char *payload_p - * if payload is None: - * payload_p = NULL # <<<<<<<<<<<<<< - * payload_len = 0 - * else: - */ - __pyx_v_payload_p = NULL; - - /* "keyutils/_keyutils.pyx":180 - * if payload is None: - * payload_p = NULL - * payload_len = 0 # <<<<<<<<<<<<<< - * else: - * payload_p = payload - */ - __pyx_v_payload_len = 0; - - /* "keyutils/_keyutils.pyx":178 - * cdef int payload_len - * cdef char *payload_p - * if payload is None: # <<<<<<<<<<<<<< - * payload_p = NULL - * payload_len = 0 - */ - goto __pyx_L3; - } - - /* "keyutils/_keyutils.pyx":182 - * payload_len = 0 - * else: - * payload_p = payload # <<<<<<<<<<<<<< - * payload_len = len(payload) - * with nogil: - */ - /*else*/ { - if (unlikely(__pyx_v_payload == Py_None)) { - PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 182, __pyx_L1_error) - } - __pyx_t_3 = __Pyx_PyBytes_AsWritableString(__pyx_v_payload); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L1_error) - __pyx_v_payload_p = __pyx_t_3; - - /* "keyutils/_keyutils.pyx":183 - * else: - * payload_p = payload - * payload_len = len(payload) # <<<<<<<<<<<<<< - * with nogil: - * rc = c_update(key, payload_p, payload_len) - */ - if (unlikely(__pyx_v_payload == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 183, __pyx_L1_error) - } - __pyx_t_4 = PyBytes_GET_SIZE(__pyx_v_payload); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 183, __pyx_L1_error) - __pyx_v_payload_len = __pyx_t_4; - } - __pyx_L3:; - - /* "keyutils/_keyutils.pyx":184 - * payload_p = payload - * payload_len = len(payload) - * with nogil: # <<<<<<<<<<<<<< - * rc = c_update(key, payload_p, payload_len) - * if rc < 0: - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - - /* "keyutils/_keyutils.pyx":185 - * payload_len = len(payload) - * with nogil: - * rc = c_update(key, payload_p, payload_len) # <<<<<<<<<<<<<< - * if rc < 0: - * PyErr_SetFromErrno(error) - */ - __pyx_v_rc = keyctl_update(__pyx_v_key, __pyx_v_payload_p, __pyx_v_payload_len); - } - - /* "keyutils/_keyutils.pyx":184 - * payload_p = payload - * payload_len = len(payload) - * with nogil: # <<<<<<<<<<<<<< - * rc = c_update(key, payload_p, payload_len) - * if rc < 0: - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L6; - } - __pyx_L6:; - } - } - - /* "keyutils/_keyutils.pyx":186 - * with nogil: - * rc = c_update(key, payload_p, payload_len) - * if rc < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - __pyx_t_2 = ((__pyx_v_rc < 0) != 0); - if (__pyx_t_2) { - - /* "keyutils/_keyutils.pyx":187 - * rc = c_update(key, payload_p, payload_len) - * if rc < 0: - * PyErr_SetFromErrno(error) # <<<<<<<<<<<<<< - * else: - * return None - */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 187, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyErr_SetFromErrno(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 187, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "keyutils/_keyutils.pyx":186 - * with nogil: - * rc = c_update(key, payload_p, payload_len) - * if rc < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - goto __pyx_L7; - } - - /* "keyutils/_keyutils.pyx":189 - * PyErr_SetFromErrno(error) - * else: - * return None # <<<<<<<<<<<<<< - * - * - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - } - __pyx_L7:; - - /* "keyutils/_keyutils.pyx":174 - * - * - * def update_key(int key, bytes payload): # <<<<<<<<<<<<<< - * cdef int rc - * cdef int payload_len - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("keyutils._keyutils.update_key", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "keyutils/_keyutils.pyx":192 - * - * - * def read_key(int key): # <<<<<<<<<<<<<< - * cdef int size - * cdef void *ptr - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8keyutils_9_keyutils_9read_key(PyObject *__pyx_self, PyObject *__pyx_arg_key); /*proto*/ -static PyMethodDef __pyx_mdef_8keyutils_9_keyutils_9read_key = {"read_key", (PyCFunction)__pyx_pw_8keyutils_9_keyutils_9read_key, METH_O, 0}; -static PyObject *__pyx_pw_8keyutils_9_keyutils_9read_key(PyObject *__pyx_self, PyObject *__pyx_arg_key) { - int __pyx_v_key; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read_key (wrapper)", 0); - assert(__pyx_arg_key); { - __pyx_v_key = __Pyx_PyInt_As_int(__pyx_arg_key); if (unlikely((__pyx_v_key == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 192, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("keyutils._keyutils.read_key", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8keyutils_9_keyutils_8read_key(__pyx_self, ((int)__pyx_v_key)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8keyutils_9_keyutils_8read_key(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_key) { - int __pyx_v_size; - void *__pyx_v_ptr; - PyObject *__pyx_v_obj = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("read_key", 0); - - /* "keyutils/_keyutils.pyx":196 - * cdef void *ptr - * cdef bytes obj - * with nogil: # <<<<<<<<<<<<<< - * size = c_read_alloc(key, &ptr) - * if size < 0: - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - - /* "keyutils/_keyutils.pyx":197 - * cdef bytes obj - * with nogil: - * size = c_read_alloc(key, &ptr) # <<<<<<<<<<<<<< - * if size < 0: - * PyErr_SetFromErrno(error) - */ - __pyx_v_size = keyctl_read_alloc(__pyx_v_key, (&__pyx_v_ptr)); - } - - /* "keyutils/_keyutils.pyx":196 - * cdef void *ptr - * cdef bytes obj - * with nogil: # <<<<<<<<<<<<<< - * size = c_read_alloc(key, &ptr) - * if size < 0: - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } - - /* "keyutils/_keyutils.pyx":198 - * with nogil: - * size = c_read_alloc(key, &ptr) - * if size < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - __pyx_t_1 = ((__pyx_v_size < 0) != 0); - if (__pyx_t_1) { - - /* "keyutils/_keyutils.pyx":199 - * size = c_read_alloc(key, &ptr) - * if size < 0: - * PyErr_SetFromErrno(error) # <<<<<<<<<<<<<< - * else: - * obj = PyBytes_FromStringAndSize(ptr, size) - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_error); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 199, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyErr_SetFromErrno(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 199, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "keyutils/_keyutils.pyx":198 - * with nogil: - * size = c_read_alloc(key, &ptr) - * if size < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - goto __pyx_L6; - } - - /* "keyutils/_keyutils.pyx":201 - * PyErr_SetFromErrno(error) - * else: - * obj = PyBytes_FromStringAndSize(ptr, size) # <<<<<<<<<<<<<< - * stdlib.free(ptr) - * return obj - */ - /*else*/ { - __pyx_t_3 = PyBytes_FromStringAndSize(((char *)__pyx_v_ptr), __pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 201, __pyx_L1_error) - __pyx_v_obj = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "keyutils/_keyutils.pyx":202 - * else: - * obj = PyBytes_FromStringAndSize(ptr, size) - * stdlib.free(ptr) # <<<<<<<<<<<<<< - * return obj - * - */ - free(__pyx_v_ptr); - - /* "keyutils/_keyutils.pyx":203 - * obj = PyBytes_FromStringAndSize(ptr, size) - * stdlib.free(ptr) - * return obj # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_obj); - __pyx_r = __pyx_v_obj; - goto __pyx_L0; - } - __pyx_L6:; - - /* "keyutils/_keyutils.pyx":192 - * - * - * def read_key(int key): # <<<<<<<<<<<<<< - * cdef int size - * cdef void *ptr - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("keyutils._keyutils.read_key", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_obj); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "keyutils/_keyutils.pyx":206 - * - * - * def describe_key(int key): # <<<<<<<<<<<<<< - * cdef int size - * cdef char *ptr - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8keyutils_9_keyutils_11describe_key(PyObject *__pyx_self, PyObject *__pyx_arg_key); /*proto*/ -static PyMethodDef __pyx_mdef_8keyutils_9_keyutils_11describe_key = {"describe_key", (PyCFunction)__pyx_pw_8keyutils_9_keyutils_11describe_key, METH_O, 0}; -static PyObject *__pyx_pw_8keyutils_9_keyutils_11describe_key(PyObject *__pyx_self, PyObject *__pyx_arg_key) { - int __pyx_v_key; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("describe_key (wrapper)", 0); - assert(__pyx_arg_key); { - __pyx_v_key = __Pyx_PyInt_As_int(__pyx_arg_key); if (unlikely((__pyx_v_key == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 206, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("keyutils._keyutils.describe_key", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8keyutils_9_keyutils_10describe_key(__pyx_self, ((int)__pyx_v_key)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8keyutils_9_keyutils_10describe_key(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_key) { - int __pyx_v_size; - char *__pyx_v_ptr; - PyObject *__pyx_v_obj = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("describe_key", 0); - - /* "keyutils/_keyutils.pyx":210 - * cdef char *ptr - * cdef bytes obj - * with nogil: # <<<<<<<<<<<<<< - * size = c_describe_alloc(key, &ptr) - * if size < 0: - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - - /* "keyutils/_keyutils.pyx":211 - * cdef bytes obj - * with nogil: - * size = c_describe_alloc(key, &ptr) # <<<<<<<<<<<<<< - * if size < 0: - * PyErr_SetFromErrno(error) - */ - __pyx_v_size = keyctl_describe_alloc(__pyx_v_key, (&__pyx_v_ptr)); - } - - /* "keyutils/_keyutils.pyx":210 - * cdef char *ptr - * cdef bytes obj - * with nogil: # <<<<<<<<<<<<<< - * size = c_describe_alloc(key, &ptr) - * if size < 0: - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } - - /* "keyutils/_keyutils.pyx":212 - * with nogil: - * size = c_describe_alloc(key, &ptr) - * if size < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - __pyx_t_1 = ((__pyx_v_size < 0) != 0); - if (__pyx_t_1) { - - /* "keyutils/_keyutils.pyx":213 - * size = c_describe_alloc(key, &ptr) - * if size < 0: - * PyErr_SetFromErrno(error) # <<<<<<<<<<<<<< - * else: - * obj = PyBytes_FromStringAndSize(ptr, size) - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_error); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyErr_SetFromErrno(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "keyutils/_keyutils.pyx":212 - * with nogil: - * size = c_describe_alloc(key, &ptr) - * if size < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - goto __pyx_L6; - } - - /* "keyutils/_keyutils.pyx":215 - * PyErr_SetFromErrno(error) - * else: - * obj = PyBytes_FromStringAndSize(ptr, size) # <<<<<<<<<<<<<< - * stdlib.free(ptr) - * return obj - */ - /*else*/ { - __pyx_t_3 = PyBytes_FromStringAndSize(((char *)__pyx_v_ptr), __pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 215, __pyx_L1_error) - __pyx_v_obj = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "keyutils/_keyutils.pyx":216 - * else: - * obj = PyBytes_FromStringAndSize(ptr, size) - * stdlib.free(ptr) # <<<<<<<<<<<<<< - * return obj - * - */ - free(__pyx_v_ptr); - - /* "keyutils/_keyutils.pyx":217 - * obj = PyBytes_FromStringAndSize(ptr, size) - * stdlib.free(ptr) - * return obj # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_obj); - __pyx_r = __pyx_v_obj; - goto __pyx_L0; - } - __pyx_L6:; - - /* "keyutils/_keyutils.pyx":206 - * - * - * def describe_key(int key): # <<<<<<<<<<<<<< - * cdef int size - * cdef char *ptr - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("keyutils._keyutils.describe_key", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_obj); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "keyutils/_keyutils.pyx":220 - * - * - * def join_session_keyring(name): # <<<<<<<<<<<<<< - * cdef char *name_p - * cdef int rc - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8keyutils_9_keyutils_13join_session_keyring(PyObject *__pyx_self, PyObject *__pyx_v_name); /*proto*/ -static PyMethodDef __pyx_mdef_8keyutils_9_keyutils_13join_session_keyring = {"join_session_keyring", (PyCFunction)__pyx_pw_8keyutils_9_keyutils_13join_session_keyring, METH_O, 0}; -static PyObject *__pyx_pw_8keyutils_9_keyutils_13join_session_keyring(PyObject *__pyx_self, PyObject *__pyx_v_name) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("join_session_keyring (wrapper)", 0); - __pyx_r = __pyx_pf_8keyutils_9_keyutils_12join_session_keyring(__pyx_self, ((PyObject *)__pyx_v_name)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8keyutils_9_keyutils_12join_session_keyring(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name) { - char *__pyx_v_name_p; - int __pyx_v_rc; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - char *__pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannySetupContext("join_session_keyring", 0); - - /* "keyutils/_keyutils.pyx":223 - * cdef char *name_p - * cdef int rc - * if name is None: # <<<<<<<<<<<<<< - * name_p = NULL - * else: - */ - __pyx_t_1 = (__pyx_v_name == Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "keyutils/_keyutils.pyx":224 - * cdef int rc - * if name is None: - * name_p = NULL # <<<<<<<<<<<<<< - * else: - * name_p = name - */ - __pyx_v_name_p = NULL; - - /* "keyutils/_keyutils.pyx":223 - * cdef char *name_p - * cdef int rc - * if name is None: # <<<<<<<<<<<<<< - * name_p = NULL - * else: - */ - goto __pyx_L3; - } - - /* "keyutils/_keyutils.pyx":226 - * name_p = NULL - * else: - * name_p = name # <<<<<<<<<<<<<< - * with nogil: - * rc = c_join_session_keyring(name_p) - */ - /*else*/ { - __pyx_t_3 = __Pyx_PyObject_AsWritableString(__pyx_v_name); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L1_error) - __pyx_v_name_p = __pyx_t_3; - } - __pyx_L3:; - - /* "keyutils/_keyutils.pyx":227 - * else: - * name_p = name - * with nogil: # <<<<<<<<<<<<<< - * rc = c_join_session_keyring(name_p) - * if rc < 0: - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - - /* "keyutils/_keyutils.pyx":228 - * name_p = name - * with nogil: - * rc = c_join_session_keyring(name_p) # <<<<<<<<<<<<<< - * if rc < 0: - * PyErr_SetFromErrno(error) - */ - __pyx_v_rc = keyctl_join_session_keyring(__pyx_v_name_p); - } - - /* "keyutils/_keyutils.pyx":227 - * else: - * name_p = name - * with nogil: # <<<<<<<<<<<<<< - * rc = c_join_session_keyring(name_p) - * if rc < 0: - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L6; - } - __pyx_L6:; - } - } - - /* "keyutils/_keyutils.pyx":229 - * with nogil: - * rc = c_join_session_keyring(name_p) - * if rc < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - __pyx_t_2 = ((__pyx_v_rc < 0) != 0); - if (__pyx_t_2) { - - /* "keyutils/_keyutils.pyx":230 - * rc = c_join_session_keyring(name_p) - * if rc < 0: - * PyErr_SetFromErrno(error) # <<<<<<<<<<<<<< - * else: - * return rc - */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 230, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyErr_SetFromErrno(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 230, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "keyutils/_keyutils.pyx":229 - * with nogil: - * rc = c_join_session_keyring(name_p) - * if rc < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - goto __pyx_L7; - } - - /* "keyutils/_keyutils.pyx":232 - * PyErr_SetFromErrno(error) - * else: - * return rc # <<<<<<<<<<<<<< - * - * - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 232, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - } - __pyx_L7:; - - /* "keyutils/_keyutils.pyx":220 - * - * - * def join_session_keyring(name): # <<<<<<<<<<<<<< - * cdef char *name_p - * cdef int rc - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("keyutils._keyutils.join_session_keyring", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "keyutils/_keyutils.pyx":235 - * - * - * def session_to_parent(): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8keyutils_9_keyutils_15session_to_parent(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_8keyutils_9_keyutils_15session_to_parent = {"session_to_parent", (PyCFunction)__pyx_pw_8keyutils_9_keyutils_15session_to_parent, METH_NOARGS, 0}; -static PyObject *__pyx_pw_8keyutils_9_keyutils_15session_to_parent(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("session_to_parent (wrapper)", 0); - __pyx_r = __pyx_pf_8keyutils_9_keyutils_14session_to_parent(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8keyutils_9_keyutils_14session_to_parent(CYTHON_UNUSED PyObject *__pyx_self) { - int __pyx_v_rc; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("session_to_parent", 0); - - /* "keyutils/_keyutils.pyx":237 - * def session_to_parent(): - * cdef int rc - * with nogil: # <<<<<<<<<<<<<< - * rc = c_session_to_parent() - * if rc < 0: - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - - /* "keyutils/_keyutils.pyx":238 - * cdef int rc - * with nogil: - * rc = c_session_to_parent() # <<<<<<<<<<<<<< - * if rc < 0: - * PyErr_SetFromErrno(error) - */ - __pyx_v_rc = keyctl_session_to_parent(); - } - - /* "keyutils/_keyutils.pyx":237 - * def session_to_parent(): - * cdef int rc - * with nogil: # <<<<<<<<<<<<<< - * rc = c_session_to_parent() - * if rc < 0: - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } - - /* "keyutils/_keyutils.pyx":239 - * with nogil: - * rc = c_session_to_parent() - * if rc < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - __pyx_t_1 = ((__pyx_v_rc < 0) != 0); - if (__pyx_t_1) { - - /* "keyutils/_keyutils.pyx":240 - * rc = c_session_to_parent() - * if rc < 0: - * PyErr_SetFromErrno(error) # <<<<<<<<<<<<<< - * else: - * return None - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_error); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyErr_SetFromErrno(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "keyutils/_keyutils.pyx":239 - * with nogil: - * rc = c_session_to_parent() - * if rc < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - goto __pyx_L6; - } - - /* "keyutils/_keyutils.pyx":242 - * PyErr_SetFromErrno(error) - * else: - * return None # <<<<<<<<<<<<<< - * - * - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - } - __pyx_L6:; - - /* "keyutils/_keyutils.pyx":235 - * - * - * def session_to_parent(): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("keyutils._keyutils.session_to_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "keyutils/_keyutils.pyx":245 - * - * - * def link(int key, int keyring): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8keyutils_9_keyutils_17link(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8keyutils_9_keyutils_17link = {"link", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8keyutils_9_keyutils_17link, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_8keyutils_9_keyutils_17link(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_key; - int __pyx_v_keyring; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("link (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_keyring,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_keyring)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("link", 1, 2, 2, 1); __PYX_ERR(0, 245, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "link") < 0)) __PYX_ERR(0, 245, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_key = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_key == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 245, __pyx_L3_error) - __pyx_v_keyring = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_keyring == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 245, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("link", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 245, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("keyutils._keyutils.link", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8keyutils_9_keyutils_16link(__pyx_self, __pyx_v_key, __pyx_v_keyring); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8keyutils_9_keyutils_16link(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_key, int __pyx_v_keyring) { - int __pyx_v_rc; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("link", 0); - - /* "keyutils/_keyutils.pyx":247 - * def link(int key, int keyring): - * cdef int rc - * with nogil: # <<<<<<<<<<<<<< - * rc = c_link(key, keyring) - * if rc < 0: - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - - /* "keyutils/_keyutils.pyx":248 - * cdef int rc - * with nogil: - * rc = c_link(key, keyring) # <<<<<<<<<<<<<< - * if rc < 0: - * PyErr_SetFromErrno(error) - */ - __pyx_v_rc = keyctl_link(__pyx_v_key, __pyx_v_keyring); - } - - /* "keyutils/_keyutils.pyx":247 - * def link(int key, int keyring): - * cdef int rc - * with nogil: # <<<<<<<<<<<<<< - * rc = c_link(key, keyring) - * if rc < 0: - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } - - /* "keyutils/_keyutils.pyx":249 - * with nogil: - * rc = c_link(key, keyring) - * if rc < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - __pyx_t_1 = ((__pyx_v_rc < 0) != 0); - if (__pyx_t_1) { - - /* "keyutils/_keyutils.pyx":250 - * rc = c_link(key, keyring) - * if rc < 0: - * PyErr_SetFromErrno(error) # <<<<<<<<<<<<<< - * else: - * return None - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_error); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyErr_SetFromErrno(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "keyutils/_keyutils.pyx":249 - * with nogil: - * rc = c_link(key, keyring) - * if rc < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - goto __pyx_L6; - } - - /* "keyutils/_keyutils.pyx":252 - * PyErr_SetFromErrno(error) - * else: - * return None # <<<<<<<<<<<<<< - * - * - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - } - __pyx_L6:; - - /* "keyutils/_keyutils.pyx":245 - * - * - * def link(int key, int keyring): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("keyutils._keyutils.link", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "keyutils/_keyutils.pyx":255 - * - * - * def unlink(int key, int keyring): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8keyutils_9_keyutils_19unlink(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8keyutils_9_keyutils_19unlink = {"unlink", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8keyutils_9_keyutils_19unlink, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_8keyutils_9_keyutils_19unlink(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_key; - int __pyx_v_keyring; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("unlink (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_keyring,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_keyring)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("unlink", 1, 2, 2, 1); __PYX_ERR(0, 255, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "unlink") < 0)) __PYX_ERR(0, 255, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_key = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_key == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 255, __pyx_L3_error) - __pyx_v_keyring = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_keyring == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 255, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("unlink", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 255, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("keyutils._keyutils.unlink", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8keyutils_9_keyutils_18unlink(__pyx_self, __pyx_v_key, __pyx_v_keyring); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8keyutils_9_keyutils_18unlink(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_key, int __pyx_v_keyring) { - int __pyx_v_rc; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("unlink", 0); - - /* "keyutils/_keyutils.pyx":257 - * def unlink(int key, int keyring): - * cdef int rc - * with nogil: # <<<<<<<<<<<<<< - * rc = c_unlink(key, keyring) - * if rc < 0: - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - - /* "keyutils/_keyutils.pyx":258 - * cdef int rc - * with nogil: - * rc = c_unlink(key, keyring) # <<<<<<<<<<<<<< - * if rc < 0: - * PyErr_SetFromErrno(error) - */ - __pyx_v_rc = keyctl_unlink(__pyx_v_key, __pyx_v_keyring); - } - - /* "keyutils/_keyutils.pyx":257 - * def unlink(int key, int keyring): - * cdef int rc - * with nogil: # <<<<<<<<<<<<<< - * rc = c_unlink(key, keyring) - * if rc < 0: - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } - - /* "keyutils/_keyutils.pyx":259 - * with nogil: - * rc = c_unlink(key, keyring) - * if rc < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - __pyx_t_1 = ((__pyx_v_rc < 0) != 0); - if (__pyx_t_1) { - - /* "keyutils/_keyutils.pyx":260 - * rc = c_unlink(key, keyring) - * if rc < 0: - * PyErr_SetFromErrno(error) # <<<<<<<<<<<<<< - * else: - * return None - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_error); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyErr_SetFromErrno(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "keyutils/_keyutils.pyx":259 - * with nogil: - * rc = c_unlink(key, keyring) - * if rc < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - goto __pyx_L6; - } - - /* "keyutils/_keyutils.pyx":262 - * PyErr_SetFromErrno(error) - * else: - * return None # <<<<<<<<<<<<<< - * - * - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - } - __pyx_L6:; - - /* "keyutils/_keyutils.pyx":255 - * - * - * def unlink(int key, int keyring): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("keyutils._keyutils.unlink", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "keyutils/_keyutils.pyx":265 - * - * - * def revoke(int key): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8keyutils_9_keyutils_21revoke(PyObject *__pyx_self, PyObject *__pyx_arg_key); /*proto*/ -static PyMethodDef __pyx_mdef_8keyutils_9_keyutils_21revoke = {"revoke", (PyCFunction)__pyx_pw_8keyutils_9_keyutils_21revoke, METH_O, 0}; -static PyObject *__pyx_pw_8keyutils_9_keyutils_21revoke(PyObject *__pyx_self, PyObject *__pyx_arg_key) { - int __pyx_v_key; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("revoke (wrapper)", 0); - assert(__pyx_arg_key); { - __pyx_v_key = __Pyx_PyInt_As_int(__pyx_arg_key); if (unlikely((__pyx_v_key == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 265, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("keyutils._keyutils.revoke", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8keyutils_9_keyutils_20revoke(__pyx_self, ((int)__pyx_v_key)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8keyutils_9_keyutils_20revoke(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_key) { - int __pyx_v_rc; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("revoke", 0); - - /* "keyutils/_keyutils.pyx":267 - * def revoke(int key): - * cdef int rc - * with nogil: # <<<<<<<<<<<<<< - * rc = c_revoke(key) - * if rc < 0: - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - - /* "keyutils/_keyutils.pyx":268 - * cdef int rc - * with nogil: - * rc = c_revoke(key) # <<<<<<<<<<<<<< - * if rc < 0: - * PyErr_SetFromErrno(error) - */ - __pyx_v_rc = keyctl_revoke(__pyx_v_key); - } - - /* "keyutils/_keyutils.pyx":267 - * def revoke(int key): - * cdef int rc - * with nogil: # <<<<<<<<<<<<<< - * rc = c_revoke(key) - * if rc < 0: - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } - - /* "keyutils/_keyutils.pyx":269 - * with nogil: - * rc = c_revoke(key) - * if rc < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - __pyx_t_1 = ((__pyx_v_rc < 0) != 0); - if (__pyx_t_1) { - - /* "keyutils/_keyutils.pyx":270 - * rc = c_revoke(key) - * if rc < 0: - * PyErr_SetFromErrno(error) # <<<<<<<<<<<<<< - * else: - * return None - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_error); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyErr_SetFromErrno(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 270, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "keyutils/_keyutils.pyx":269 - * with nogil: - * rc = c_revoke(key) - * if rc < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - goto __pyx_L6; - } - - /* "keyutils/_keyutils.pyx":272 - * PyErr_SetFromErrno(error) - * else: - * return None # <<<<<<<<<<<<<< - * - * - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - } - __pyx_L6:; - - /* "keyutils/_keyutils.pyx":265 - * - * - * def revoke(int key): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("keyutils._keyutils.revoke", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "keyutils/_keyutils.pyx":275 - * - * - * def set_perm(int key, int perm): # <<<<<<<<<<<<<< - * cdef int rc - * cdef int keyperm - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8keyutils_9_keyutils_23set_perm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8keyutils_9_keyutils_23set_perm = {"set_perm", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8keyutils_9_keyutils_23set_perm, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_8keyutils_9_keyutils_23set_perm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_key; - int __pyx_v_perm; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_perm (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_perm,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_perm)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("set_perm", 1, 2, 2, 1); __PYX_ERR(0, 275, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_perm") < 0)) __PYX_ERR(0, 275, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_key = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_key == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 275, __pyx_L3_error) - __pyx_v_perm = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_perm == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 275, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_perm", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 275, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("keyutils._keyutils.set_perm", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8keyutils_9_keyutils_22set_perm(__pyx_self, __pyx_v_key, __pyx_v_perm); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8keyutils_9_keyutils_22set_perm(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_key, int __pyx_v_perm) { - int __pyx_v_rc; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("set_perm", 0); - - /* "keyutils/_keyutils.pyx":278 - * cdef int rc - * cdef int keyperm - * with nogil: # <<<<<<<<<<<<<< - * rc = c_setperm(key, perm) - * if rc < 0: - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - - /* "keyutils/_keyutils.pyx":279 - * cdef int keyperm - * with nogil: - * rc = c_setperm(key, perm) # <<<<<<<<<<<<<< - * if rc < 0: - * PyErr_SetFromErrno(error) - */ - __pyx_v_rc = keyctl_setperm(__pyx_v_key, __pyx_v_perm); - } - - /* "keyutils/_keyutils.pyx":278 - * cdef int rc - * cdef int keyperm - * with nogil: # <<<<<<<<<<<<<< - * rc = c_setperm(key, perm) - * if rc < 0: - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } - - /* "keyutils/_keyutils.pyx":280 - * with nogil: - * rc = c_setperm(key, perm) - * if rc < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - __pyx_t_1 = ((__pyx_v_rc < 0) != 0); - if (__pyx_t_1) { - - /* "keyutils/_keyutils.pyx":281 - * rc = c_setperm(key, perm) - * if rc < 0: - * PyErr_SetFromErrno(error) # <<<<<<<<<<<<<< - * else: - * return None - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_error); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 281, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyErr_SetFromErrno(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 281, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "keyutils/_keyutils.pyx":280 - * with nogil: - * rc = c_setperm(key, perm) - * if rc < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - goto __pyx_L6; - } - - /* "keyutils/_keyutils.pyx":283 - * PyErr_SetFromErrno(error) - * else: - * return None # <<<<<<<<<<<<<< - * - * - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - } - __pyx_L6:; - - /* "keyutils/_keyutils.pyx":275 - * - * - * def set_perm(int key, int perm): # <<<<<<<<<<<<<< - * cdef int rc - * cdef int keyperm - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("keyutils._keyutils.set_perm", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "keyutils/_keyutils.pyx":286 - * - * - * def set_timeout(int key, int timeout): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8keyutils_9_keyutils_25set_timeout(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8keyutils_9_keyutils_25set_timeout = {"set_timeout", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8keyutils_9_keyutils_25set_timeout, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_8keyutils_9_keyutils_25set_timeout(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_key; - int __pyx_v_timeout; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_timeout (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_timeout,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeout)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("set_timeout", 1, 2, 2, 1); __PYX_ERR(0, 286, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_timeout") < 0)) __PYX_ERR(0, 286, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_key = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_key == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 286, __pyx_L3_error) - __pyx_v_timeout = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_timeout == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 286, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_timeout", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 286, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("keyutils._keyutils.set_timeout", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8keyutils_9_keyutils_24set_timeout(__pyx_self, __pyx_v_key, __pyx_v_timeout); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8keyutils_9_keyutils_24set_timeout(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_key, int __pyx_v_timeout) { - int __pyx_v_rc; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("set_timeout", 0); - - /* "keyutils/_keyutils.pyx":288 - * def set_timeout(int key, int timeout): - * cdef int rc - * with nogil: # <<<<<<<<<<<<<< - * rc = c_set_timeout(key, timeout) - * if rc < 0: - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - - /* "keyutils/_keyutils.pyx":289 - * cdef int rc - * with nogil: - * rc = c_set_timeout(key, timeout) # <<<<<<<<<<<<<< - * if rc < 0: - * PyErr_SetFromErrno(error) - */ - __pyx_v_rc = keyctl_set_timeout(__pyx_v_key, __pyx_v_timeout); - } - - /* "keyutils/_keyutils.pyx":288 - * def set_timeout(int key, int timeout): - * cdef int rc - * with nogil: # <<<<<<<<<<<<<< - * rc = c_set_timeout(key, timeout) - * if rc < 0: - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } - - /* "keyutils/_keyutils.pyx":290 - * with nogil: - * rc = c_set_timeout(key, timeout) - * if rc < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - __pyx_t_1 = ((__pyx_v_rc < 0) != 0); - if (__pyx_t_1) { - - /* "keyutils/_keyutils.pyx":291 - * rc = c_set_timeout(key, timeout) - * if rc < 0: - * PyErr_SetFromErrno(error) # <<<<<<<<<<<<<< - * else: - * return None - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_error); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 291, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyErr_SetFromErrno(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 291, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "keyutils/_keyutils.pyx":290 - * with nogil: - * rc = c_set_timeout(key, timeout) - * if rc < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - goto __pyx_L6; - } - - /* "keyutils/_keyutils.pyx":293 - * PyErr_SetFromErrno(error) - * else: - * return None # <<<<<<<<<<<<<< - * - * - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - } - __pyx_L6:; - - /* "keyutils/_keyutils.pyx":286 - * - * - * def set_timeout(int key, int timeout): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("keyutils._keyutils.set_timeout", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "keyutils/_keyutils.pyx":296 - * - * - * def clear(int keyring): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8keyutils_9_keyutils_27clear(PyObject *__pyx_self, PyObject *__pyx_arg_keyring); /*proto*/ -static PyMethodDef __pyx_mdef_8keyutils_9_keyutils_27clear = {"clear", (PyCFunction)__pyx_pw_8keyutils_9_keyutils_27clear, METH_O, 0}; -static PyObject *__pyx_pw_8keyutils_9_keyutils_27clear(PyObject *__pyx_self, PyObject *__pyx_arg_keyring) { - int __pyx_v_keyring; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("clear (wrapper)", 0); - assert(__pyx_arg_keyring); { - __pyx_v_keyring = __Pyx_PyInt_As_int(__pyx_arg_keyring); if (unlikely((__pyx_v_keyring == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 296, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("keyutils._keyutils.clear", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8keyutils_9_keyutils_26clear(__pyx_self, ((int)__pyx_v_keyring)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8keyutils_9_keyutils_26clear(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_keyring) { - int __pyx_v_rc; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("clear", 0); - - /* "keyutils/_keyutils.pyx":298 - * def clear(int keyring): - * cdef int rc - * with nogil: # <<<<<<<<<<<<<< - * rc = c_clear(keyring) - * if rc < 0: - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - - /* "keyutils/_keyutils.pyx":299 - * cdef int rc - * with nogil: - * rc = c_clear(keyring) # <<<<<<<<<<<<<< - * if rc < 0: - * PyErr_SetFromErrno(error) - */ - __pyx_v_rc = keyctl_clear(__pyx_v_keyring); - } - - /* "keyutils/_keyutils.pyx":298 - * def clear(int keyring): - * cdef int rc - * with nogil: # <<<<<<<<<<<<<< - * rc = c_clear(keyring) - * if rc < 0: - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } - - /* "keyutils/_keyutils.pyx":300 - * with nogil: - * rc = c_clear(keyring) - * if rc < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - __pyx_t_1 = ((__pyx_v_rc < 0) != 0); - if (__pyx_t_1) { - - /* "keyutils/_keyutils.pyx":301 - * rc = c_clear(keyring) - * if rc < 0: - * PyErr_SetFromErrno(error) # <<<<<<<<<<<<<< - * else: - * return None - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_error); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 301, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyErr_SetFromErrno(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 301, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "keyutils/_keyutils.pyx":300 - * with nogil: - * rc = c_clear(keyring) - * if rc < 0: # <<<<<<<<<<<<<< - * PyErr_SetFromErrno(error) - * else: - */ - goto __pyx_L6; - } - - /* "keyutils/_keyutils.pyx":303 - * PyErr_SetFromErrno(error) - * else: - * return None # <<<<<<<<<<<<<< - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - } - __pyx_L6:; - - /* "keyutils/_keyutils.pyx":296 - * - * - * def clear(int keyring): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("keyutils._keyutils.clear", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec__keyutils(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec__keyutils}, - {0, NULL} -}; -#endif - -static struct PyModuleDef __pyx_moduledef = { - PyModuleDef_HEAD_INIT, - "_keyutils", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #else - -1, /* m_size */ - #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ - #endif - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif -#ifndef CYTHON_SMALL_CODE -#if defined(__clang__) - #define CYTHON_SMALL_CODE -#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) - #define CYTHON_SMALL_CODE __attribute__((cold)) -#else - #define CYTHON_SMALL_CODE -#endif -#endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_n_s_EKEYEXPIRED, __pyx_k_EKEYEXPIRED, sizeof(__pyx_k_EKEYEXPIRED), 0, 0, 1, 1}, - {&__pyx_n_s_EKEYREJECTED, __pyx_k_EKEYREJECTED, sizeof(__pyx_k_EKEYREJECTED), 0, 0, 1, 1}, - {&__pyx_n_s_EKEYREVOKED, __pyx_k_EKEYREVOKED, sizeof(__pyx_k_EKEYREVOKED), 0, 0, 1, 1}, - {&__pyx_n_s_ENOKEY, __pyx_k_ENOKEY, sizeof(__pyx_k_ENOKEY), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_GRP_ALL, __pyx_k_KEY_GRP_ALL, sizeof(__pyx_k_KEY_GRP_ALL), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_GRP_LINK, __pyx_k_KEY_GRP_LINK, sizeof(__pyx_k_KEY_GRP_LINK), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_GRP_READ, __pyx_k_KEY_GRP_READ, sizeof(__pyx_k_KEY_GRP_READ), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_GRP_SEARCH, __pyx_k_KEY_GRP_SEARCH, sizeof(__pyx_k_KEY_GRP_SEARCH), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_GRP_SETATTR, __pyx_k_KEY_GRP_SETATTR, sizeof(__pyx_k_KEY_GRP_SETATTR), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_GRP_VIEW, __pyx_k_KEY_GRP_VIEW, sizeof(__pyx_k_KEY_GRP_VIEW), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_GRP_WRITE, __pyx_k_KEY_GRP_WRITE, sizeof(__pyx_k_KEY_GRP_WRITE), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_OTH_ALL, __pyx_k_KEY_OTH_ALL, sizeof(__pyx_k_KEY_OTH_ALL), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_OTH_LINK, __pyx_k_KEY_OTH_LINK, sizeof(__pyx_k_KEY_OTH_LINK), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_OTH_READ, __pyx_k_KEY_OTH_READ, sizeof(__pyx_k_KEY_OTH_READ), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_OTH_SEARCH, __pyx_k_KEY_OTH_SEARCH, sizeof(__pyx_k_KEY_OTH_SEARCH), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_OTH_SETATTR, __pyx_k_KEY_OTH_SETATTR, sizeof(__pyx_k_KEY_OTH_SETATTR), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_OTH_VIEW, __pyx_k_KEY_OTH_VIEW, sizeof(__pyx_k_KEY_OTH_VIEW), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_OTH_WRITE, __pyx_k_KEY_OTH_WRITE, sizeof(__pyx_k_KEY_OTH_WRITE), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_POS_ALL, __pyx_k_KEY_POS_ALL, sizeof(__pyx_k_KEY_POS_ALL), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_POS_LINK, __pyx_k_KEY_POS_LINK, sizeof(__pyx_k_KEY_POS_LINK), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_POS_READ, __pyx_k_KEY_POS_READ, sizeof(__pyx_k_KEY_POS_READ), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_POS_SEARCH, __pyx_k_KEY_POS_SEARCH, sizeof(__pyx_k_KEY_POS_SEARCH), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_POS_SETATTR, __pyx_k_KEY_POS_SETATTR, sizeof(__pyx_k_KEY_POS_SETATTR), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_POS_VIEW, __pyx_k_KEY_POS_VIEW, sizeof(__pyx_k_KEY_POS_VIEW), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_POS_WRITE, __pyx_k_KEY_POS_WRITE, sizeof(__pyx_k_KEY_POS_WRITE), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_SPEC_PROCESS_KEYRING, __pyx_k_KEY_SPEC_PROCESS_KEYRING, sizeof(__pyx_k_KEY_SPEC_PROCESS_KEYRING), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_SPEC_SESSION_KEYRING, __pyx_k_KEY_SPEC_SESSION_KEYRING, sizeof(__pyx_k_KEY_SPEC_SESSION_KEYRING), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_SPEC_THREAD_KEYRING, __pyx_k_KEY_SPEC_THREAD_KEYRING, sizeof(__pyx_k_KEY_SPEC_THREAD_KEYRING), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_SPEC_USER_KEYRING, __pyx_k_KEY_SPEC_USER_KEYRING, sizeof(__pyx_k_KEY_SPEC_USER_KEYRING), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_SPEC_USER_SESSION_KEYRING, __pyx_k_KEY_SPEC_USER_SESSION_KEYRING, sizeof(__pyx_k_KEY_SPEC_USER_SESSION_KEYRING), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_USR_ALL, __pyx_k_KEY_USR_ALL, sizeof(__pyx_k_KEY_USR_ALL), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_USR_LINK, __pyx_k_KEY_USR_LINK, sizeof(__pyx_k_KEY_USR_LINK), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_USR_READ, __pyx_k_KEY_USR_READ, sizeof(__pyx_k_KEY_USR_READ), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_USR_SEARCH, __pyx_k_KEY_USR_SEARCH, sizeof(__pyx_k_KEY_USR_SEARCH), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_USR_SETATTR, __pyx_k_KEY_USR_SETATTR, sizeof(__pyx_k_KEY_USR_SETATTR), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_USR_VIEW, __pyx_k_KEY_USR_VIEW, sizeof(__pyx_k_KEY_USR_VIEW), 0, 0, 1, 1}, - {&__pyx_n_s_KEY_USR_WRITE, __pyx_k_KEY_USR_WRITE, sizeof(__pyx_k_KEY_USR_WRITE), 0, 0, 1, 1}, - {&__pyx_n_s_add_key, __pyx_k_add_key, sizeof(__pyx_k_add_key), 0, 0, 1, 1}, - {&__pyx_n_s_callout_info, __pyx_k_callout_info, sizeof(__pyx_k_callout_info), 0, 0, 1, 1}, - {&__pyx_n_s_callout_p, __pyx_k_callout_p, sizeof(__pyx_k_callout_p), 0, 0, 1, 1}, - {&__pyx_n_s_clear, __pyx_k_clear, sizeof(__pyx_k_clear), 0, 0, 1, 1}, - {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, - {&__pyx_n_s_constants, __pyx_k_constants, sizeof(__pyx_k_constants), 0, 0, 1, 1}, - {&__pyx_n_s_desc_p, __pyx_k_desc_p, sizeof(__pyx_k_desc_p), 0, 0, 1, 1}, - {&__pyx_n_s_describe_key, __pyx_k_describe_key, sizeof(__pyx_k_describe_key), 0, 0, 1, 1}, - {&__pyx_n_s_description, __pyx_k_description, sizeof(__pyx_k_description), 0, 0, 1, 1}, - {&__pyx_n_s_destination, __pyx_k_destination, sizeof(__pyx_k_destination), 0, 0, 1, 1}, - {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, - {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, - {&__pyx_n_s_join_session_keyring, __pyx_k_join_session_keyring, sizeof(__pyx_k_join_session_keyring), 0, 0, 1, 1}, - {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1}, - {&__pyx_n_s_key_type, __pyx_k_key_type, sizeof(__pyx_k_key_type), 0, 0, 1, 1}, - {&__pyx_n_s_key_type_p, __pyx_k_key_type_p, sizeof(__pyx_k_key_type_p), 0, 0, 1, 1}, - {&__pyx_n_s_keyperm, __pyx_k_keyperm, sizeof(__pyx_k_keyperm), 0, 0, 1, 1}, - {&__pyx_n_s_keyring, __pyx_k_keyring, sizeof(__pyx_k_keyring), 0, 0, 1, 1}, - {&__pyx_n_s_keyutils__keyutils, __pyx_k_keyutils__keyutils, sizeof(__pyx_k_keyutils__keyutils), 0, 0, 1, 1}, - {&__pyx_kp_s_keyutils__keyutils_pyx, __pyx_k_keyutils__keyutils_pyx, sizeof(__pyx_k_keyutils__keyutils_pyx), 0, 0, 1, 0}, - {&__pyx_n_s_link, __pyx_k_link, sizeof(__pyx_k_link), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1}, - {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, - {&__pyx_n_s_name_p, __pyx_k_name_p, sizeof(__pyx_k_name_p), 0, 0, 1, 1}, - {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, - {&__pyx_n_s_payload, __pyx_k_payload, sizeof(__pyx_k_payload), 0, 0, 1, 1}, - {&__pyx_n_s_payload_len, __pyx_k_payload_len, sizeof(__pyx_k_payload_len), 0, 0, 1, 1}, - {&__pyx_n_s_payload_p, __pyx_k_payload_p, sizeof(__pyx_k_payload_p), 0, 0, 1, 1}, - {&__pyx_n_s_perm, __pyx_k_perm, sizeof(__pyx_k_perm), 0, 0, 1, 1}, - {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, - {&__pyx_n_s_ptr, __pyx_k_ptr, sizeof(__pyx_k_ptr), 0, 0, 1, 1}, - {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1}, - {&__pyx_n_s_rc, __pyx_k_rc, sizeof(__pyx_k_rc), 0, 0, 1, 1}, - {&__pyx_n_s_read_key, __pyx_k_read_key, sizeof(__pyx_k_read_key), 0, 0, 1, 1}, - {&__pyx_n_s_request_key, __pyx_k_request_key, sizeof(__pyx_k_request_key), 0, 0, 1, 1}, - {&__pyx_n_s_revoke, __pyx_k_revoke, sizeof(__pyx_k_revoke), 0, 0, 1, 1}, - {&__pyx_n_s_search, __pyx_k_search, sizeof(__pyx_k_search), 0, 0, 1, 1}, - {&__pyx_n_s_session_to_parent, __pyx_k_session_to_parent, sizeof(__pyx_k_session_to_parent), 0, 0, 1, 1}, - {&__pyx_n_s_set_perm, __pyx_k_set_perm, sizeof(__pyx_k_set_perm), 0, 0, 1, 1}, - {&__pyx_n_s_set_timeout, __pyx_k_set_timeout, sizeof(__pyx_k_set_timeout), 0, 0, 1, 1}, - {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_timeout, __pyx_k_timeout, sizeof(__pyx_k_timeout), 0, 0, 1, 1}, - {&__pyx_n_s_unlink, __pyx_k_unlink, sizeof(__pyx_k_unlink), 0, 0, 1, 1}, - {&__pyx_n_s_update_key, __pyx_k_update_key, sizeof(__pyx_k_update_key), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - return 0; -} - -static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - - /* "keyutils/_keyutils.pyx":125 - * - * - * def add_key(bytes key_type, bytes description, bytes payload, int keyring): # <<<<<<<<<<<<<< - * cdef int rc - * cdef char *key_type_p = key_type - */ - __pyx_tuple_ = PyTuple_Pack(9, __pyx_n_s_key_type, __pyx_n_s_description, __pyx_n_s_payload, __pyx_n_s_keyring, __pyx_n_s_rc, __pyx_n_s_key_type_p, __pyx_n_s_desc_p, __pyx_n_s_payload_len, __pyx_n_s_payload_p); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 125, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple_); - __Pyx_GIVEREF(__pyx_tuple_); - __pyx_codeobj__2 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple_, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_keyutils__keyutils_pyx, __pyx_n_s_add_key, 125, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__2)) __PYX_ERR(0, 125, __pyx_L1_error) - - /* "keyutils/_keyutils.pyx":145 - * - * - * def request_key(bytes key_type, bytes description, bytes callout_info, int keyring): # <<<<<<<<<<<<<< - * cdef char *key_type_p = key_type - * cdef char *desc_p = description - */ - __pyx_tuple__3 = PyTuple_Pack(8, __pyx_n_s_key_type, __pyx_n_s_description, __pyx_n_s_callout_info, __pyx_n_s_keyring, __pyx_n_s_key_type_p, __pyx_n_s_desc_p, __pyx_n_s_callout_p, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 145, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); - __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(4, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__3, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_keyutils__keyutils_pyx, __pyx_n_s_request_key, 145, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 145, __pyx_L1_error) - - /* "keyutils/_keyutils.pyx":162 - * - * - * def search(int keyring, bytes key_type, bytes description, int destination): # <<<<<<<<<<<<<< - * cdef char *key_type_p = key_type - * cdef char *desc_p = description - */ - __pyx_tuple__5 = PyTuple_Pack(7, __pyx_n_s_keyring, __pyx_n_s_key_type, __pyx_n_s_description, __pyx_n_s_destination, __pyx_n_s_key_type_p, __pyx_n_s_desc_p, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 162, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); - __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(4, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_keyutils__keyutils_pyx, __pyx_n_s_search, 162, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 162, __pyx_L1_error) - - /* "keyutils/_keyutils.pyx":174 - * - * - * def update_key(int key, bytes payload): # <<<<<<<<<<<<<< - * cdef int rc - * cdef int payload_len - */ - __pyx_tuple__7 = PyTuple_Pack(5, __pyx_n_s_key, __pyx_n_s_payload, __pyx_n_s_rc, __pyx_n_s_payload_len, __pyx_n_s_payload_p); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 174, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); - __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_keyutils__keyutils_pyx, __pyx_n_s_update_key, 174, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 174, __pyx_L1_error) - - /* "keyutils/_keyutils.pyx":192 - * - * - * def read_key(int key): # <<<<<<<<<<<<<< - * cdef int size - * cdef void *ptr - */ - __pyx_tuple__9 = PyTuple_Pack(5, __pyx_n_s_key, __pyx_n_s_key, __pyx_n_s_size, __pyx_n_s_ptr, __pyx_n_s_obj); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 192, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); - __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_keyutils__keyutils_pyx, __pyx_n_s_read_key, 192, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 192, __pyx_L1_error) - - /* "keyutils/_keyutils.pyx":206 - * - * - * def describe_key(int key): # <<<<<<<<<<<<<< - * cdef int size - * cdef char *ptr - */ - __pyx_tuple__11 = PyTuple_Pack(5, __pyx_n_s_key, __pyx_n_s_key, __pyx_n_s_size, __pyx_n_s_ptr, __pyx_n_s_obj); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 206, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); - __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_keyutils__keyutils_pyx, __pyx_n_s_describe_key, 206, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 206, __pyx_L1_error) - - /* "keyutils/_keyutils.pyx":220 - * - * - * def join_session_keyring(name): # <<<<<<<<<<<<<< - * cdef char *name_p - * cdef int rc - */ - __pyx_tuple__13 = PyTuple_Pack(3, __pyx_n_s_name_2, __pyx_n_s_name_p, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__13); - __Pyx_GIVEREF(__pyx_tuple__13); - __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_keyutils__keyutils_pyx, __pyx_n_s_join_session_keyring, 220, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 220, __pyx_L1_error) - - /* "keyutils/_keyutils.pyx":235 - * - * - * def session_to_parent(): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: - */ - __pyx_tuple__15 = PyTuple_Pack(1, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__15); - __Pyx_GIVEREF(__pyx_tuple__15); - __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_keyutils__keyutils_pyx, __pyx_n_s_session_to_parent, 235, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 235, __pyx_L1_error) - - /* "keyutils/_keyutils.pyx":245 - * - * - * def link(int key, int keyring): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: - */ - __pyx_tuple__17 = PyTuple_Pack(3, __pyx_n_s_key, __pyx_n_s_keyring, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 245, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__17); - __Pyx_GIVEREF(__pyx_tuple__17); - __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_keyutils__keyutils_pyx, __pyx_n_s_link, 245, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 245, __pyx_L1_error) - - /* "keyutils/_keyutils.pyx":255 - * - * - * def unlink(int key, int keyring): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: - */ - __pyx_tuple__19 = PyTuple_Pack(3, __pyx_n_s_key, __pyx_n_s_keyring, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 255, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__19); - __Pyx_GIVEREF(__pyx_tuple__19); - __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_keyutils__keyutils_pyx, __pyx_n_s_unlink, 255, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 255, __pyx_L1_error) - - /* "keyutils/_keyutils.pyx":265 - * - * - * def revoke(int key): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: - */ - __pyx_tuple__21 = PyTuple_Pack(3, __pyx_n_s_key, __pyx_n_s_key, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 265, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__21); - __Pyx_GIVEREF(__pyx_tuple__21); - __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_keyutils__keyutils_pyx, __pyx_n_s_revoke, 265, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 265, __pyx_L1_error) - - /* "keyutils/_keyutils.pyx":275 - * - * - * def set_perm(int key, int perm): # <<<<<<<<<<<<<< - * cdef int rc - * cdef int keyperm - */ - __pyx_tuple__23 = PyTuple_Pack(4, __pyx_n_s_key, __pyx_n_s_perm, __pyx_n_s_rc, __pyx_n_s_keyperm); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 275, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__23); - __Pyx_GIVEREF(__pyx_tuple__23); - __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_keyutils__keyutils_pyx, __pyx_n_s_set_perm, 275, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 275, __pyx_L1_error) - - /* "keyutils/_keyutils.pyx":286 - * - * - * def set_timeout(int key, int timeout): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: - */ - __pyx_tuple__25 = PyTuple_Pack(3, __pyx_n_s_key, __pyx_n_s_timeout, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 286, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__25); - __Pyx_GIVEREF(__pyx_tuple__25); - __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_keyutils__keyutils_pyx, __pyx_n_s_set_timeout, 286, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 286, __pyx_L1_error) - - /* "keyutils/_keyutils.pyx":296 - * - * - * def clear(int keyring): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: - */ - __pyx_tuple__27 = PyTuple_Pack(3, __pyx_n_s_keyring, __pyx_n_s_keyring, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 296, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__27); - __Pyx_GIVEREF(__pyx_tuple__27); - __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_keyutils__keyutils_pyx, __pyx_n_s_clear, 296, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 296, __pyx_L1_error) - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} - -static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - return 0; - __pyx_L1_error:; - return -1; -} - -static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ - -static int __Pyx_modinit_global_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); - /*--- Global init code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_variable_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); - /*--- Variable export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_function_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); - /*--- Function export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_type_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); - /*--- Type init code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_type_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); - /*--- Type import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_variable_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); - /*--- Variable import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_function_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); - /*--- Function import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - - -#if PY_MAJOR_VERSION < 3 -#ifdef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC void -#else -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC -#endif -#else -#ifdef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC PyObject * -#else -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC -#endif -#endif - - -#if PY_MAJOR_VERSION < 3 -__Pyx_PyMODINIT_FUNC init_keyutils(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC init_keyutils(void) -#else -__Pyx_PyMODINIT_FUNC PyInit__keyutils(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC PyInit__keyutils(void) -#if CYTHON_PEP489_MULTI_PHASE_INIT -{ - return PyModuleDef_Init(&__pyx_moduledef); -} -static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { - #if PY_VERSION_HEX >= 0x030700A1 - static PY_INT64_T main_interpreter_id = -1; - PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); - if (main_interpreter_id == -1) { - main_interpreter_id = current_id; - return (unlikely(current_id == -1)) ? -1 : 0; - } else if (unlikely(main_interpreter_id != current_id)) - #else - static PyInterpreterState *main_interpreter = NULL; - PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; - if (!main_interpreter) { - main_interpreter = current_interpreter; - } else if (unlikely(main_interpreter != current_interpreter)) - #endif - { - PyErr_SetString( - PyExc_ImportError, - "Interpreter change detected - this module can only be loaded into one interpreter per process."); - return -1; - } - return 0; -} -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { - PyObject *value = PyObject_GetAttrString(spec, from_name); - int result = 0; - if (likely(value)) { - if (allow_none || value != Py_None) { - result = PyDict_SetItemString(moddict, to_name, value); - } - Py_DECREF(value); - } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - } else { - result = -1; - } - return result; -} -static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { - PyObject *module = NULL, *moddict, *modname; - if (__Pyx_check_single_interpreter()) - return NULL; - if (__pyx_m) - return __Pyx_NewRef(__pyx_m); - modname = PyObject_GetAttrString(spec, "name"); - if (unlikely(!modname)) goto bad; - module = PyModule_NewObject(modname); - Py_DECREF(modname); - if (unlikely(!module)) goto bad; - moddict = PyModule_GetDict(module); - if (unlikely(!moddict)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; - return module; -bad: - Py_XDECREF(module); - return NULL; -} - - -static CYTHON_SMALL_CODE int __pyx_pymod_exec__keyutils(PyObject *__pyx_pyinit_module) -#endif -#endif -{ - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannyDeclarations - #if CYTHON_PEP489_MULTI_PHASE_INIT - if (__pyx_m) { - if (__pyx_m == __pyx_pyinit_module) return 0; - PyErr_SetString(PyExc_RuntimeError, "Module '_keyutils' has already been imported. Re-initialisation is not supported."); - return -1; - } - #elif PY_MAJOR_VERSION >= 3 - if (__pyx_m) return __Pyx_NewRef(__pyx_m); - #endif - #if CYTHON_REFNANNY -__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); -if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); -} -#endif - __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit__keyutils(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pxy_PyFrame_Initialize_Offsets - __Pxy_PyFrame_Initialize_Offsets(); - #endif - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - #ifdef WITH_THREAD /* Python build with threading support? */ - PyEval_InitThreads(); - #endif - #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); - #else - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("_keyutils", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) - #if CYTHON_COMPILING_IN_PYPY - Py_INCREF(__pyx_b); - #endif - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - if (__pyx_module_is_main_keyutils___keyutils) { - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "keyutils._keyutils")) { - if (unlikely(PyDict_SetItemString(modules, "keyutils._keyutils", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - } - } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global type/function init code ---*/ - (void)__Pyx_modinit_global_init_code(); - (void)__Pyx_modinit_variable_export_code(); - (void)__Pyx_modinit_function_export_code(); - (void)__Pyx_modinit_type_init_code(); - (void)__Pyx_modinit_type_import_code(); - (void)__Pyx_modinit_variable_import_code(); - (void)__Pyx_modinit_function_import_code(); - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - - /* "keyutils/_keyutils.pyx":81 - * - * - * class error(Exception): # <<<<<<<<<<<<<< - * pass - * - */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - __Pyx_GIVEREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_error, __pyx_n_s_error, (PyObject *) NULL, __pyx_n_s_keyutils__keyutils, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_error, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_error, __pyx_t_4) < 0) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "keyutils/_keyutils.pyx":85 - * - * - * class constants: # <<<<<<<<<<<<<< - * KEY_SPEC_THREAD_KEYRING = c_KEY_SPEC_THREAD_KEYRING - * KEY_SPEC_PROCESS_KEYRING = c_KEY_SPEC_PROCESS_KEYRING - */ - __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_constants, __pyx_n_s_constants, (PyObject *) NULL, __pyx_n_s_keyutils__keyutils, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - - /* "keyutils/_keyutils.pyx":86 - * - * class constants: - * KEY_SPEC_THREAD_KEYRING = c_KEY_SPEC_THREAD_KEYRING # <<<<<<<<<<<<<< - * KEY_SPEC_PROCESS_KEYRING = c_KEY_SPEC_PROCESS_KEYRING - * KEY_SPEC_SESSION_KEYRING = c_KEY_SPEC_SESSION_KEYRING - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_SPEC_THREAD_KEYRING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_SPEC_THREAD_KEYRING, __pyx_t_2) < 0) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":87 - * class constants: - * KEY_SPEC_THREAD_KEYRING = c_KEY_SPEC_THREAD_KEYRING - * KEY_SPEC_PROCESS_KEYRING = c_KEY_SPEC_PROCESS_KEYRING # <<<<<<<<<<<<<< - * KEY_SPEC_SESSION_KEYRING = c_KEY_SPEC_SESSION_KEYRING - * KEY_SPEC_USER_KEYRING = c_KEY_SPEC_USER_KEYRING - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_SPEC_PROCESS_KEYRING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_SPEC_PROCESS_KEYRING, __pyx_t_2) < 0) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":88 - * KEY_SPEC_THREAD_KEYRING = c_KEY_SPEC_THREAD_KEYRING - * KEY_SPEC_PROCESS_KEYRING = c_KEY_SPEC_PROCESS_KEYRING - * KEY_SPEC_SESSION_KEYRING = c_KEY_SPEC_SESSION_KEYRING # <<<<<<<<<<<<<< - * KEY_SPEC_USER_KEYRING = c_KEY_SPEC_USER_KEYRING - * KEY_SPEC_USER_SESSION_KEYRING = c_KEY_SPEC_USER_SESSION_KEYRING - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_SPEC_SESSION_KEYRING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_SPEC_SESSION_KEYRING, __pyx_t_2) < 0) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":89 - * KEY_SPEC_PROCESS_KEYRING = c_KEY_SPEC_PROCESS_KEYRING - * KEY_SPEC_SESSION_KEYRING = c_KEY_SPEC_SESSION_KEYRING - * KEY_SPEC_USER_KEYRING = c_KEY_SPEC_USER_KEYRING # <<<<<<<<<<<<<< - * KEY_SPEC_USER_SESSION_KEYRING = c_KEY_SPEC_USER_SESSION_KEYRING - * ENOKEY = c_ENOKEY - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_SPEC_USER_KEYRING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_SPEC_USER_KEYRING, __pyx_t_2) < 0) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":90 - * KEY_SPEC_SESSION_KEYRING = c_KEY_SPEC_SESSION_KEYRING - * KEY_SPEC_USER_KEYRING = c_KEY_SPEC_USER_KEYRING - * KEY_SPEC_USER_SESSION_KEYRING = c_KEY_SPEC_USER_SESSION_KEYRING # <<<<<<<<<<<<<< - * ENOKEY = c_ENOKEY - * EKEYEXPIRED = c_EKEYEXPIRED - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_SPEC_USER_SESSION_KEYRING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_SPEC_USER_SESSION_KEYRING, __pyx_t_2) < 0) __PYX_ERR(0, 90, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":91 - * KEY_SPEC_USER_KEYRING = c_KEY_SPEC_USER_KEYRING - * KEY_SPEC_USER_SESSION_KEYRING = c_KEY_SPEC_USER_SESSION_KEYRING - * ENOKEY = c_ENOKEY # <<<<<<<<<<<<<< - * EKEYEXPIRED = c_EKEYEXPIRED - * EKEYREVOKED = c_EKEYREVOKED - */ - __pyx_t_2 = __Pyx_PyInt_From_int(ENOKEY); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_ENOKEY, __pyx_t_2) < 0) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":92 - * KEY_SPEC_USER_SESSION_KEYRING = c_KEY_SPEC_USER_SESSION_KEYRING - * ENOKEY = c_ENOKEY - * EKEYEXPIRED = c_EKEYEXPIRED # <<<<<<<<<<<<<< - * EKEYREVOKED = c_EKEYREVOKED - * EKEYREJECTED = c_EKEYREJECTED - */ - __pyx_t_2 = __Pyx_PyInt_From_int(EKEYEXPIRED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_EKEYEXPIRED, __pyx_t_2) < 0) __PYX_ERR(0, 92, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":93 - * ENOKEY = c_ENOKEY - * EKEYEXPIRED = c_EKEYEXPIRED - * EKEYREVOKED = c_EKEYREVOKED # <<<<<<<<<<<<<< - * EKEYREJECTED = c_EKEYREJECTED - * KEY_POS_VIEW = c_KEY_POS_VIEW - */ - __pyx_t_2 = __Pyx_PyInt_From_int(EKEYREVOKED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_EKEYREVOKED, __pyx_t_2) < 0) __PYX_ERR(0, 93, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":94 - * EKEYEXPIRED = c_EKEYEXPIRED - * EKEYREVOKED = c_EKEYREVOKED - * EKEYREJECTED = c_EKEYREJECTED # <<<<<<<<<<<<<< - * KEY_POS_VIEW = c_KEY_POS_VIEW - * KEY_POS_READ = c_KEY_POS_READ - */ - __pyx_t_2 = __Pyx_PyInt_From_int(EKEYREJECTED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_EKEYREJECTED, __pyx_t_2) < 0) __PYX_ERR(0, 94, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":95 - * EKEYREVOKED = c_EKEYREVOKED - * EKEYREJECTED = c_EKEYREJECTED - * KEY_POS_VIEW = c_KEY_POS_VIEW # <<<<<<<<<<<<<< - * KEY_POS_READ = c_KEY_POS_READ - * KEY_POS_WRITE = c_KEY_POS_WRITE - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_POS_VIEW); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_POS_VIEW, __pyx_t_2) < 0) __PYX_ERR(0, 95, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":96 - * EKEYREJECTED = c_EKEYREJECTED - * KEY_POS_VIEW = c_KEY_POS_VIEW - * KEY_POS_READ = c_KEY_POS_READ # <<<<<<<<<<<<<< - * KEY_POS_WRITE = c_KEY_POS_WRITE - * KEY_POS_SEARCH = c_KEY_POS_SEARCH - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_POS_READ); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_POS_READ, __pyx_t_2) < 0) __PYX_ERR(0, 96, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":97 - * KEY_POS_VIEW = c_KEY_POS_VIEW - * KEY_POS_READ = c_KEY_POS_READ - * KEY_POS_WRITE = c_KEY_POS_WRITE # <<<<<<<<<<<<<< - * KEY_POS_SEARCH = c_KEY_POS_SEARCH - * KEY_POS_LINK = c_KEY_POS_LINK - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_POS_WRITE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_POS_WRITE, __pyx_t_2) < 0) __PYX_ERR(0, 97, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":98 - * KEY_POS_READ = c_KEY_POS_READ - * KEY_POS_WRITE = c_KEY_POS_WRITE - * KEY_POS_SEARCH = c_KEY_POS_SEARCH # <<<<<<<<<<<<<< - * KEY_POS_LINK = c_KEY_POS_LINK - * KEY_POS_SETATTR = c_KEY_POS_SETATTR - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_POS_SEARCH); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_POS_SEARCH, __pyx_t_2) < 0) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":99 - * KEY_POS_WRITE = c_KEY_POS_WRITE - * KEY_POS_SEARCH = c_KEY_POS_SEARCH - * KEY_POS_LINK = c_KEY_POS_LINK # <<<<<<<<<<<<<< - * KEY_POS_SETATTR = c_KEY_POS_SETATTR - * KEY_POS_ALL = c_KEY_POS_ALL - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_POS_LINK); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_POS_LINK, __pyx_t_2) < 0) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":100 - * KEY_POS_SEARCH = c_KEY_POS_SEARCH - * KEY_POS_LINK = c_KEY_POS_LINK - * KEY_POS_SETATTR = c_KEY_POS_SETATTR # <<<<<<<<<<<<<< - * KEY_POS_ALL = c_KEY_POS_ALL - * KEY_USR_VIEW = c_KEY_USR_VIEW - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_POS_SETATTR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_POS_SETATTR, __pyx_t_2) < 0) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":101 - * KEY_POS_LINK = c_KEY_POS_LINK - * KEY_POS_SETATTR = c_KEY_POS_SETATTR - * KEY_POS_ALL = c_KEY_POS_ALL # <<<<<<<<<<<<<< - * KEY_USR_VIEW = c_KEY_USR_VIEW - * KEY_USR_READ = c_KEY_USR_READ - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_POS_ALL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_POS_ALL, __pyx_t_2) < 0) __PYX_ERR(0, 101, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":102 - * KEY_POS_SETATTR = c_KEY_POS_SETATTR - * KEY_POS_ALL = c_KEY_POS_ALL - * KEY_USR_VIEW = c_KEY_USR_VIEW # <<<<<<<<<<<<<< - * KEY_USR_READ = c_KEY_USR_READ - * KEY_USR_WRITE = c_KEY_USR_WRITE - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_USR_VIEW); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 102, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_USR_VIEW, __pyx_t_2) < 0) __PYX_ERR(0, 102, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":103 - * KEY_POS_ALL = c_KEY_POS_ALL - * KEY_USR_VIEW = c_KEY_USR_VIEW - * KEY_USR_READ = c_KEY_USR_READ # <<<<<<<<<<<<<< - * KEY_USR_WRITE = c_KEY_USR_WRITE - * KEY_USR_SEARCH = c_KEY_USR_SEARCH - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_USR_READ); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_USR_READ, __pyx_t_2) < 0) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":104 - * KEY_USR_VIEW = c_KEY_USR_VIEW - * KEY_USR_READ = c_KEY_USR_READ - * KEY_USR_WRITE = c_KEY_USR_WRITE # <<<<<<<<<<<<<< - * KEY_USR_SEARCH = c_KEY_USR_SEARCH - * KEY_USR_LINK = c_KEY_USR_LINK - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_USR_WRITE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_USR_WRITE, __pyx_t_2) < 0) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":105 - * KEY_USR_READ = c_KEY_USR_READ - * KEY_USR_WRITE = c_KEY_USR_WRITE - * KEY_USR_SEARCH = c_KEY_USR_SEARCH # <<<<<<<<<<<<<< - * KEY_USR_LINK = c_KEY_USR_LINK - * KEY_USR_SETATTR = c_KEY_USR_SETATTR - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_USR_SEARCH); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_USR_SEARCH, __pyx_t_2) < 0) __PYX_ERR(0, 105, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":106 - * KEY_USR_WRITE = c_KEY_USR_WRITE - * KEY_USR_SEARCH = c_KEY_USR_SEARCH - * KEY_USR_LINK = c_KEY_USR_LINK # <<<<<<<<<<<<<< - * KEY_USR_SETATTR = c_KEY_USR_SETATTR - * KEY_USR_ALL = c_KEY_USR_ALL - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_USR_LINK); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_USR_LINK, __pyx_t_2) < 0) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":107 - * KEY_USR_SEARCH = c_KEY_USR_SEARCH - * KEY_USR_LINK = c_KEY_USR_LINK - * KEY_USR_SETATTR = c_KEY_USR_SETATTR # <<<<<<<<<<<<<< - * KEY_USR_ALL = c_KEY_USR_ALL - * KEY_GRP_VIEW = c_KEY_GRP_VIEW - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_USR_SETATTR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 107, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_USR_SETATTR, __pyx_t_2) < 0) __PYX_ERR(0, 107, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":108 - * KEY_USR_LINK = c_KEY_USR_LINK - * KEY_USR_SETATTR = c_KEY_USR_SETATTR - * KEY_USR_ALL = c_KEY_USR_ALL # <<<<<<<<<<<<<< - * KEY_GRP_VIEW = c_KEY_GRP_VIEW - * KEY_GRP_READ = c_KEY_GRP_READ - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_USR_ALL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_USR_ALL, __pyx_t_2) < 0) __PYX_ERR(0, 108, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":109 - * KEY_USR_SETATTR = c_KEY_USR_SETATTR - * KEY_USR_ALL = c_KEY_USR_ALL - * KEY_GRP_VIEW = c_KEY_GRP_VIEW # <<<<<<<<<<<<<< - * KEY_GRP_READ = c_KEY_GRP_READ - * KEY_GRP_WRITE = c_KEY_GRP_WRITE - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_GRP_VIEW); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 109, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_GRP_VIEW, __pyx_t_2) < 0) __PYX_ERR(0, 109, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":110 - * KEY_USR_ALL = c_KEY_USR_ALL - * KEY_GRP_VIEW = c_KEY_GRP_VIEW - * KEY_GRP_READ = c_KEY_GRP_READ # <<<<<<<<<<<<<< - * KEY_GRP_WRITE = c_KEY_GRP_WRITE - * KEY_GRP_SEARCH = c_KEY_GRP_SEARCH - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_GRP_READ); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_GRP_READ, __pyx_t_2) < 0) __PYX_ERR(0, 110, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":111 - * KEY_GRP_VIEW = c_KEY_GRP_VIEW - * KEY_GRP_READ = c_KEY_GRP_READ - * KEY_GRP_WRITE = c_KEY_GRP_WRITE # <<<<<<<<<<<<<< - * KEY_GRP_SEARCH = c_KEY_GRP_SEARCH - * KEY_GRP_LINK = c_KEY_GRP_LINK - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_GRP_WRITE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_GRP_WRITE, __pyx_t_2) < 0) __PYX_ERR(0, 111, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":112 - * KEY_GRP_READ = c_KEY_GRP_READ - * KEY_GRP_WRITE = c_KEY_GRP_WRITE - * KEY_GRP_SEARCH = c_KEY_GRP_SEARCH # <<<<<<<<<<<<<< - * KEY_GRP_LINK = c_KEY_GRP_LINK - * KEY_GRP_SETATTR = c_KEY_GRP_SETATTR - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_GRP_SEARCH); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_GRP_SEARCH, __pyx_t_2) < 0) __PYX_ERR(0, 112, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":113 - * KEY_GRP_WRITE = c_KEY_GRP_WRITE - * KEY_GRP_SEARCH = c_KEY_GRP_SEARCH - * KEY_GRP_LINK = c_KEY_GRP_LINK # <<<<<<<<<<<<<< - * KEY_GRP_SETATTR = c_KEY_GRP_SETATTR - * KEY_GRP_ALL = c_KEY_GRP_ALL - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_GRP_LINK); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_GRP_LINK, __pyx_t_2) < 0) __PYX_ERR(0, 113, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":114 - * KEY_GRP_SEARCH = c_KEY_GRP_SEARCH - * KEY_GRP_LINK = c_KEY_GRP_LINK - * KEY_GRP_SETATTR = c_KEY_GRP_SETATTR # <<<<<<<<<<<<<< - * KEY_GRP_ALL = c_KEY_GRP_ALL - * KEY_OTH_VIEW = c_KEY_OTH_VIEW - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_GRP_SETATTR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_GRP_SETATTR, __pyx_t_2) < 0) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":115 - * KEY_GRP_LINK = c_KEY_GRP_LINK - * KEY_GRP_SETATTR = c_KEY_GRP_SETATTR - * KEY_GRP_ALL = c_KEY_GRP_ALL # <<<<<<<<<<<<<< - * KEY_OTH_VIEW = c_KEY_OTH_VIEW - * KEY_OTH_READ = c_KEY_OTH_READ - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_GRP_ALL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 115, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_GRP_ALL, __pyx_t_2) < 0) __PYX_ERR(0, 115, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":116 - * KEY_GRP_SETATTR = c_KEY_GRP_SETATTR - * KEY_GRP_ALL = c_KEY_GRP_ALL - * KEY_OTH_VIEW = c_KEY_OTH_VIEW # <<<<<<<<<<<<<< - * KEY_OTH_READ = c_KEY_OTH_READ - * KEY_OTH_WRITE = c_KEY_OTH_WRITE - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_OTH_VIEW); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_OTH_VIEW, __pyx_t_2) < 0) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":117 - * KEY_GRP_ALL = c_KEY_GRP_ALL - * KEY_OTH_VIEW = c_KEY_OTH_VIEW - * KEY_OTH_READ = c_KEY_OTH_READ # <<<<<<<<<<<<<< - * KEY_OTH_WRITE = c_KEY_OTH_WRITE - * KEY_OTH_SEARCH = c_KEY_OTH_SEARCH - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_OTH_READ); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_OTH_READ, __pyx_t_2) < 0) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":118 - * KEY_OTH_VIEW = c_KEY_OTH_VIEW - * KEY_OTH_READ = c_KEY_OTH_READ - * KEY_OTH_WRITE = c_KEY_OTH_WRITE # <<<<<<<<<<<<<< - * KEY_OTH_SEARCH = c_KEY_OTH_SEARCH - * KEY_OTH_LINK = c_KEY_OTH_LINK - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_OTH_WRITE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_OTH_WRITE, __pyx_t_2) < 0) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":119 - * KEY_OTH_READ = c_KEY_OTH_READ - * KEY_OTH_WRITE = c_KEY_OTH_WRITE - * KEY_OTH_SEARCH = c_KEY_OTH_SEARCH # <<<<<<<<<<<<<< - * KEY_OTH_LINK = c_KEY_OTH_LINK - * KEY_OTH_SETATTR = c_KEY_OTH_SETATTR - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_OTH_SEARCH); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_OTH_SEARCH, __pyx_t_2) < 0) __PYX_ERR(0, 119, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":120 - * KEY_OTH_WRITE = c_KEY_OTH_WRITE - * KEY_OTH_SEARCH = c_KEY_OTH_SEARCH - * KEY_OTH_LINK = c_KEY_OTH_LINK # <<<<<<<<<<<<<< - * KEY_OTH_SETATTR = c_KEY_OTH_SETATTR - * KEY_OTH_ALL = c_KEY_OTH_ALL - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_OTH_LINK); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_OTH_LINK, __pyx_t_2) < 0) __PYX_ERR(0, 120, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":121 - * KEY_OTH_SEARCH = c_KEY_OTH_SEARCH - * KEY_OTH_LINK = c_KEY_OTH_LINK - * KEY_OTH_SETATTR = c_KEY_OTH_SETATTR # <<<<<<<<<<<<<< - * KEY_OTH_ALL = c_KEY_OTH_ALL - * - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_OTH_SETATTR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_OTH_SETATTR, __pyx_t_2) < 0) __PYX_ERR(0, 121, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":122 - * KEY_OTH_LINK = c_KEY_OTH_LINK - * KEY_OTH_SETATTR = c_KEY_OTH_SETATTR - * KEY_OTH_ALL = c_KEY_OTH_ALL # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __Pyx_PyInt_From_int(KEY_OTH_ALL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_KEY_OTH_ALL, __pyx_t_2) < 0) __PYX_ERR(0, 122, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "keyutils/_keyutils.pyx":85 - * - * - * class constants: # <<<<<<<<<<<<<< - * KEY_SPEC_THREAD_KEYRING = c_KEY_SPEC_THREAD_KEYRING - * KEY_SPEC_PROCESS_KEYRING = c_KEY_SPEC_PROCESS_KEYRING - */ - __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_constants, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_constants, __pyx_t_2) < 0) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "keyutils/_keyutils.pyx":125 - * - * - * def add_key(bytes key_type, bytes description, bytes payload, int keyring): # <<<<<<<<<<<<<< - * cdef int rc - * cdef char *key_type_p = key_type - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8keyutils_9_keyutils_1add_key, NULL, __pyx_n_s_keyutils__keyutils); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_add_key, __pyx_t_1) < 0) __PYX_ERR(0, 125, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "keyutils/_keyutils.pyx":145 - * - * - * def request_key(bytes key_type, bytes description, bytes callout_info, int keyring): # <<<<<<<<<<<<<< - * cdef char *key_type_p = key_type - * cdef char *desc_p = description - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8keyutils_9_keyutils_3request_key, NULL, __pyx_n_s_keyutils__keyutils); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_request_key, __pyx_t_1) < 0) __PYX_ERR(0, 145, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "keyutils/_keyutils.pyx":162 - * - * - * def search(int keyring, bytes key_type, bytes description, int destination): # <<<<<<<<<<<<<< - * cdef char *key_type_p = key_type - * cdef char *desc_p = description - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8keyutils_9_keyutils_5search, NULL, __pyx_n_s_keyutils__keyutils); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_search, __pyx_t_1) < 0) __PYX_ERR(0, 162, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "keyutils/_keyutils.pyx":174 - * - * - * def update_key(int key, bytes payload): # <<<<<<<<<<<<<< - * cdef int rc - * cdef int payload_len - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8keyutils_9_keyutils_7update_key, NULL, __pyx_n_s_keyutils__keyutils); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_update_key, __pyx_t_1) < 0) __PYX_ERR(0, 174, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "keyutils/_keyutils.pyx":192 - * - * - * def read_key(int key): # <<<<<<<<<<<<<< - * cdef int size - * cdef void *ptr - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8keyutils_9_keyutils_9read_key, NULL, __pyx_n_s_keyutils__keyutils); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_read_key, __pyx_t_1) < 0) __PYX_ERR(0, 192, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "keyutils/_keyutils.pyx":206 - * - * - * def describe_key(int key): # <<<<<<<<<<<<<< - * cdef int size - * cdef char *ptr - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8keyutils_9_keyutils_11describe_key, NULL, __pyx_n_s_keyutils__keyutils); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_describe_key, __pyx_t_1) < 0) __PYX_ERR(0, 206, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "keyutils/_keyutils.pyx":220 - * - * - * def join_session_keyring(name): # <<<<<<<<<<<<<< - * cdef char *name_p - * cdef int rc - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8keyutils_9_keyutils_13join_session_keyring, NULL, __pyx_n_s_keyutils__keyutils); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_join_session_keyring, __pyx_t_1) < 0) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "keyutils/_keyutils.pyx":235 - * - * - * def session_to_parent(): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8keyutils_9_keyutils_15session_to_parent, NULL, __pyx_n_s_keyutils__keyutils); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_session_to_parent, __pyx_t_1) < 0) __PYX_ERR(0, 235, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "keyutils/_keyutils.pyx":245 - * - * - * def link(int key, int keyring): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8keyutils_9_keyutils_17link, NULL, __pyx_n_s_keyutils__keyutils); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_link, __pyx_t_1) < 0) __PYX_ERR(0, 245, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "keyutils/_keyutils.pyx":255 - * - * - * def unlink(int key, int keyring): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8keyutils_9_keyutils_19unlink, NULL, __pyx_n_s_keyutils__keyutils); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_unlink, __pyx_t_1) < 0) __PYX_ERR(0, 255, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "keyutils/_keyutils.pyx":265 - * - * - * def revoke(int key): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8keyutils_9_keyutils_21revoke, NULL, __pyx_n_s_keyutils__keyutils); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_revoke, __pyx_t_1) < 0) __PYX_ERR(0, 265, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "keyutils/_keyutils.pyx":275 - * - * - * def set_perm(int key, int perm): # <<<<<<<<<<<<<< - * cdef int rc - * cdef int keyperm - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8keyutils_9_keyutils_23set_perm, NULL, __pyx_n_s_keyutils__keyutils); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_perm, __pyx_t_1) < 0) __PYX_ERR(0, 275, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "keyutils/_keyutils.pyx":286 - * - * - * def set_timeout(int key, int timeout): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8keyutils_9_keyutils_25set_timeout, NULL, __pyx_n_s_keyutils__keyutils); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 286, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_timeout, __pyx_t_1) < 0) __PYX_ERR(0, 286, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "keyutils/_keyutils.pyx":296 - * - * - * def clear(int keyring): # <<<<<<<<<<<<<< - * cdef int rc - * with nogil: - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8keyutils_9_keyutils_27clear, NULL, __pyx_n_s_keyutils__keyutils); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_clear, __pyx_t_1) < 0) __PYX_ERR(0, 296, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "keyutils/_keyutils.pyx":1 - * # cython: language_level=2 # <<<<<<<<<<<<<< - * # - * # Copyright (c) SAS Institute Inc. - */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /*--- Wrapped vars code ---*/ - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - if (__pyx_m) { - if (__pyx_d) { - __Pyx_AddTraceback("init keyutils._keyutils", __pyx_clineno, __pyx_lineno, __pyx_filename); - } - Py_CLEAR(__pyx_m); - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init keyutils._keyutils"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if CYTHON_PEP489_MULTI_PHASE_INIT - return (__pyx_m != NULL) ? 0 : -1; - #elif PY_MAJOR_VERSION >= 3 - return __pyx_m; - #else - return; - #endif -} - -/* --- Runtime support code --- */ -/* Refnanny */ -#if CYTHON_REFNANNY -static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule(modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, "RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); -end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; -} -#endif - -/* RaiseArgTupleInvalid */ -static void __Pyx_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) -{ - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); -} - -/* RaiseDoubleKeywords */ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AsString(kw_name)); - #endif -} - -/* ParseKeywords */ -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - continue; - } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = (**name == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - -/* ArgTypeTest */ -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) -{ - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - else if (exact) { - #if PY_MAJOR_VERSION == 2 - if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif - } - else { - if (likely(__Pyx_TypeCheck(obj, type))) return 1; - } - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); - return 0; -} - -/* PyObjectGetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} -#endif - -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif - } - return result; -} - -/* GetModuleGlobalName */ -#if CYTHON_USE_DICT_VERSIONS -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) -#else -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) -#endif -{ - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 - result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } else if (unlikely(PyErr_Occurred())) { - return NULL; - } -#else - result = PyDict_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } -#endif -#else - result = PyObject_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } - PyErr_Clear(); -#endif - return __Pyx_GetBuiltinName(name); -} - -/* CalculateMetaclass */ -static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { - Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases); - for (i=0; i < nbases; i++) { - PyTypeObject *tmptype; - PyObject *tmp = PyTuple_GET_ITEM(bases, i); - tmptype = Py_TYPE(tmp); -#if PY_MAJOR_VERSION < 3 - if (tmptype == &PyClass_Type) - continue; -#endif - if (!metaclass) { - metaclass = tmptype; - continue; - } - if (PyType_IsSubtype(metaclass, tmptype)) - continue; - if (PyType_IsSubtype(tmptype, metaclass)) { - metaclass = tmptype; - continue; - } - PyErr_SetString(PyExc_TypeError, - "metaclass conflict: " - "the metaclass of a derived class " - "must be a (non-strict) subclass " - "of the metaclasses of all its bases"); - return NULL; - } - if (!metaclass) { -#if PY_MAJOR_VERSION < 3 - metaclass = &PyClass_Type; -#else - metaclass = &PyType_Type; -#endif - } - Py_INCREF((PyObject*) metaclass); - return (PyObject*) metaclass; -} - -/* Py3ClassCreate */ -static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, - PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { - PyObject *ns; - if (metaclass) { - PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare); - if (prep) { - PyObject *pargs = PyTuple_Pack(2, name, bases); - if (unlikely(!pargs)) { - Py_DECREF(prep); - return NULL; - } - ns = PyObject_Call(prep, pargs, mkw); - Py_DECREF(prep); - Py_DECREF(pargs); - } else { - if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError))) - return NULL; - PyErr_Clear(); - ns = PyDict_New(); - } - } else { - ns = PyDict_New(); - } - if (unlikely(!ns)) - return NULL; - if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad; - if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad; - if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad; - return ns; -bad: - Py_DECREF(ns); - return NULL; -} -static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, - PyObject *dict, PyObject *mkw, - int calculate_metaclass, int allow_py2_metaclass) { - PyObject *result, *margs; - PyObject *owned_metaclass = NULL; - if (allow_py2_metaclass) { - owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass); - if (owned_metaclass) { - metaclass = owned_metaclass; - } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) { - PyErr_Clear(); - } else { - return NULL; - } - } - if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) { - metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases); - Py_XDECREF(owned_metaclass); - if (unlikely(!metaclass)) - return NULL; - owned_metaclass = metaclass; - } - margs = PyTuple_Pack(3, name, bases, dict); - if (unlikely(!margs)) { - result = NULL; - } else { - result = PyObject_Call(metaclass, margs, mkw); - Py_DECREF(margs); - } - Py_XDECREF(owned_metaclass); - return result; -} - -/* PyErrFetchRestore */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} -#endif - -/* CLineInTraceback */ -#ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { - PyObject *use_cline; - PyObject *ptype, *pvalue, *ptraceback; -#if CYTHON_COMPILING_IN_CPYTHON - PyObject **cython_runtime_dict; -#endif - if (unlikely(!__pyx_cython_runtime)) { - return c_line; - } - __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); -#if CYTHON_COMPILING_IN_CPYTHON - cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); - if (likely(cython_runtime_dict)) { - __PYX_PY_DICT_LOOKUP_IF_MODIFIED( - use_cline, *cython_runtime_dict, - __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) - } else -#endif - { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); - if (use_cline_obj) { - use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; - Py_DECREF(use_cline_obj); - } else { - PyErr_Clear(); - use_cline = NULL; - } - } - if (!use_cline) { - c_line = 0; - PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); - } - else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { - c_line = 0; - } - __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); - return c_line; -} -#endif - -/* CodeObjectCache */ -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { - int start = 0, mid = 0, end = count - 1; - if (end >= 0 && code_line > entries[end].code_line) { - return count; - } - while (start < end) { - mid = start + (end - start) / 2; - if (code_line < entries[mid].code_line) { - end = mid; - } else if (code_line > entries[mid].code_line) { - start = mid + 1; - } else { - return mid; - } - } - if (code_line <= entries[mid].code_line) { - return mid; - } else { - return mid + 1; - } -} -static PyCodeObject *__pyx_find_code_object(int code_line) { - PyCodeObject* code_object; - int pos; - if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { - return NULL; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { - return NULL; - } - code_object = __pyx_code_cache.entries[pos].code_object; - Py_INCREF(code_object); - return code_object; -} -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { - int pos, i; - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - if (unlikely(!code_line)) { - return; - } - if (unlikely(!entries)) { - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); - if (likely(entries)) { - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = 64; - __pyx_code_cache.count = 1; - entries[0].code_line = code_line; - entries[0].code_object = code_object; - Py_INCREF(code_object); - } - return; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { - PyCodeObject* tmp = entries[pos].code_object; - entries[pos].code_object = code_object; - Py_DECREF(tmp); - return; - } - if (__pyx_code_cache.count == __pyx_code_cache.max_count) { - int new_max = __pyx_code_cache.max_count + 64; - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); - if (unlikely(!entries)) { - return; - } - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = new_max; - } - for (i=__pyx_code_cache.count; i>pos; i--) { - entries[i] = entries[i-1]; - } - entries[pos].code_line = code_line; - entries[pos].code_object = code_object; - __pyx_code_cache.count++; - Py_INCREF(code_object); -} - -/* AddTraceback */ -#include "compile.h" -#include "frameobject.h" -#include "traceback.h" -static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( - const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif - if (!py_srcfile) goto bad; - if (c_line) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #endif - } - else { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); - #endif - } - if (!py_funcname) goto bad; - py_code = __Pyx_PyCode_New( - 0, - 0, - 0, - 0, - 0, - __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ - py_srcfile, /*PyObject *filename,*/ - py_funcname, /*PyObject *name,*/ - py_line, - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); - return py_code; -bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); - return NULL; -} -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - if (c_line) { - c_line = __Pyx_CLineForTraceback(tstate, c_line); - } - py_code = __pyx_find_code_object(c_line ? -c_line : py_line); - if (!py_code) { - py_code = __Pyx_CreateCodeObjectForTraceback( - funcname, c_line, py_line, filename); - if (!py_code) goto bad; - __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); - } - py_frame = PyFrame_New( - tstate, /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - __Pyx_PyFrame_SetLineNumber(py_frame, py_line); - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { - const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(int) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(int) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(int), - 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) -#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) -#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ - {\ - func_type value = func_value;\ - if (sizeof(target_type) < sizeof(func_type)) {\ - if (unlikely(value != (func_type) (target_type) value)) {\ - func_type zero = 0;\ - if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ - return (target_type) -1;\ - if (is_unsigned && unlikely(value < zero))\ - goto raise_neg_overflow;\ - else\ - goto raise_overflow;\ - }\ - }\ - return (target_type) value;\ - } - -/* CIntFromPy */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (int) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (int) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(int) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - } -#endif - if (sizeof(int) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - int val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (int) -1; - } - } else { - int val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (int) -1; - val = __Pyx_PyInt_As_int(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to int"); - return (int) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; -} - -/* 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); - } -} - -/* CIntFromPy */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (long) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (long) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(long) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - } -#endif - if (sizeof(long) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - long val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (long) -1; - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (long) -1; - val = __Pyx_PyInt_As_long(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to long"); - return (long) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; -} - -/* FastTypeChecks */ -#if CYTHON_COMPILING_IN_CPYTHON -static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { - while (a) { - a = a->tp_base; - if (a == b) - return 1; - } - return b == &PyBaseObject_Type; -} -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { - PyObject *mro; - if (a == b) return 1; - mro = a->tp_mro; - if (likely(mro)) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(mro); - for (i = 0; i < n; i++) { - if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) - return 1; - } - return 0; - } - return __Pyx_InBases(a, b); -} -#if PY_MAJOR_VERSION == 2 -static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { - PyObject *exception, *value, *tb; - int res; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&exception, &value, &tb); - res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - if (!res) { - res = PyObject_IsSubclass(err, exc_type2); - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - } - __Pyx_ErrRestore(exception, value, tb); - return res; -} -#else -static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { - int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; - if (!res) { - res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); - } - return res; -} -#endif -static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - assert(PyExceptionClass_Check(exc_type)); - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; ip) { - #if PY_MAJOR_VERSION < 3 - if (t->is_unicode) { - *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); - } else if (t->intern) { - *t->p = PyString_InternFromString(t->s); - } else { - *t->p = PyString_FromStringAndSize(t->s, t->n - 1); - } - #else - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif - if (!*t->p) - return -1; - if (PyObject_Hash(*t->p) == -1) - return -1; - ++t; - } - return 0; -} - -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { - return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); -} -static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { - Py_ssize_t ignore; - return __Pyx_PyObject_AsStringAndSize(o, &ignore); -} -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -#if !CYTHON_PEP393_ENABLED -static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { - char* defenc_c; - PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); - if (!defenc) return NULL; - defenc_c = PyBytes_AS_STRING(defenc); -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - { - char* end = defenc_c + PyBytes_GET_SIZE(defenc); - char* c; - for (c = defenc_c; c < end; c++) { - if ((unsigned char) (*c) >= 128) { - PyUnicode_AsASCIIString(o); - return NULL; - } - } - } -#endif - *length = PyBytes_GET_SIZE(defenc); - return defenc_c; -} -#else -static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { - if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - if (likely(PyUnicode_IS_ASCII(o))) { - *length = PyUnicode_GET_LENGTH(o); - return PyUnicode_AsUTF8(o); - } else { - PyUnicode_AsASCIIString(o); - return NULL; - } -#else - return PyUnicode_AsUTF8AndSize(o, length); -#endif -} -#endif -#endif -static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT - if ( -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - __Pyx_sys_getdefaultencoding_not_ascii && -#endif - PyUnicode_Check(o)) { - return __Pyx_PyUnicode_AsStringAndSize(o, length); - } else -#endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) - if (PyByteArray_Check(o)) { - *length = PyByteArray_GET_SIZE(o); - return PyByteArray_AS_STRING(o); - } else -#endif - { - char* result; - int r = PyBytes_AsStringAndSize(o, &result, length); - if (unlikely(r < 0)) { - return NULL; - } else { - return result; - } - } -} -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - int is_true = x == Py_True; - if (is_true | (x == Py_False) | (x == Py_None)) return is_true; - else return PyObject_IsTrue(x); -} -static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { - int retval; - if (unlikely(!x)) return -1; - retval = __Pyx_PyObject_IsTrue(x); - Py_DECREF(x); - return retval; -} -static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { -#if PY_MAJOR_VERSION >= 3 - if (PyLong_Check(result)) { - if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, - "__int__ returned non-int (type %.200s). " - "The ability to return an instance of a strict subclass of int " - "is deprecated, and may be removed in a future version of Python.", - Py_TYPE(result)->tp_name)) { - Py_DECREF(result); - return NULL; - } - return result; - } -#endif - PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - type_name, type_name, Py_TYPE(result)->tp_name); - Py_DECREF(result); - return NULL; -} -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { -#if CYTHON_USE_TYPE_SLOTS - PyNumberMethods *m; -#endif - const char *name = NULL; - PyObject *res = NULL; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x) || PyLong_Check(x))) -#else - if (likely(PyLong_Check(x))) -#endif - return __Pyx_NewRef(x); -#if CYTHON_USE_TYPE_SLOTS - m = Py_TYPE(x)->tp_as_number; - #if PY_MAJOR_VERSION < 3 - if (m && m->nb_int) { - name = "int"; - res = m->nb_int(x); - } - else if (m && m->nb_long) { - name = "long"; - res = m->nb_long(x); - } - #else - if (likely(m && m->nb_int)) { - name = "int"; - res = m->nb_int(x); - } - #endif -#else - if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { - res = PyNumber_Int(x); - } -#endif - if (likely(res)) { -#if PY_MAJOR_VERSION < 3 - if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { -#else - if (unlikely(!PyLong_CheckExact(res))) { -#endif - return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); - } - } - else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, - "an integer is required"); - } - return res; -} -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject *x; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(b))) { - if (sizeof(Py_ssize_t) >= sizeof(long)) - return PyInt_AS_LONG(b); - else - return PyInt_AsSsize_t(b); - } -#endif - if (likely(PyLong_CheckExact(b))) { - #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; - } else { - switch (size) { - case 2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - } - } - #endif - return PyLong_AsSsize_t(b); - } - x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} -static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { - return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); -} -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { - return PyInt_FromSize_t(ival); -} - - -#endif /* Py_PYTHON_H */ diff --git a/keyutils/_keyutils.pyx b/keyutils/_keyutils.pyx index 76e6bac..282c7fa 100644 --- a/keyutils/_keyutils.pyx +++ b/keyutils/_keyutils.pyx @@ -1,4 +1,4 @@ -# cython: language_level=2 +# cython: language_level=3 # # Copyright (c) SAS Institute Inc. # diff --git a/package.sh b/package.sh new file mode 100755 index 0000000..13ceabe --- /dev/null +++ b/package.sh @@ -0,0 +1,4 @@ +#!/usr/bin/sh + +export DOCKER_BUILDKIT=1 +docker run --rm -v "$(pwd)":/io "$(docker build -q .)" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..8b5f23e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,2 @@ +[build-system] +requires = ["setuptools", "wheel", "cython"] \ No newline at end of file diff --git a/setup.py b/setup.py index 04a463a..b5d3725 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) SAS Institute Inc. and contributors # @@ -15,13 +15,11 @@ # limitations under the License. # - -import io - +from Cython.Build import cythonize from setuptools import Extension, setup -with io.open("README.rst", "r", encoding="utf-8") as f: +with open("README.rst", "r", encoding="utf-8") as f: long_description = f.read() setup( @@ -37,27 +35,22 @@ classifiers=[ "Topic :: Security", "Operating System :: POSIX :: Linux", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3.3", - "Programming Language :: Python :: 3.4", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ], platforms=[ "Linux", ], - ext_modules=[ + ext_modules=cythonize([ Extension( "keyutils._keyutils", ["keyutils/_keyutils.pyx"], libraries=["keyutils"], ), - ], + ]), setup_requires=[], tests_require=["pytest", "pytest-runner"], ) diff --git a/tox.ini b/tox.ini index 558763e..e4a99e0 100644 --- a/tox.ini +++ b/tox.ini @@ -1,34 +1,27 @@ [tox] -envlist = py{27,34,35,36,37,38,39,310,311} +envlist = py{38,39,310,311,312} skip_missing_interpreters = True [gh-actions] python = - 2.7: py27 - 3.4: py34 - 3.5: py35 - 3.6: py36 - 3.7: py37 3.8: py38, build, docs 3.9: py39 3.10: py310 3.11: py311 + 3.12: py312 [testenv] basepython = - py27: python2.7 - py34: python3.4 - py35: python3.5 - py36: python3.6 - py37: python3.7 py38: python3.8 py39: python3.9 py310: python3.10 py311: python3.11 + py312: python3.12 {lint,radon}: {env:TOXPYTHON:python3} -[testenv:{py27,py34,py35,py36,py37,py38,py39,py310,py311}] +[testenv:{py38,py39,py310,py311,py312}] deps = + cython coverage pytest pytest-cov @@ -44,6 +37,7 @@ commands_post = [testenv:lint] deps = + cython flake8>=3 ; flake8-docstrings flake8-bugbear @@ -55,7 +49,9 @@ commands = isort --verbose --check-only --diff keyutils test setup.py [testenv:radon] -deps = radon +deps = + cython + radon commands = radon cc -s --total-average --no-assert -nb keyutils/ radon mi -m -s keyutils/